5.3 Engine Class

#1
Hi there ! (Old unreal engine user :p !)

I'm trying to make my own game without using GameSDK source, i made a blank projet to start with.
I integrated the steamworks SDK to the sources but to use it correctly i need to make a CGame - CGameStartup class and get an access to Update().

I made a quick class for CGame and CGameStartup to start with but i don't know how to say the engine to override the default class and use mine.
I've take a look on the GameSDK source (Too many file and reference everywhere un-understable code...) but i didn't find anything and on the docs too...

Really really quick made class

Code: Select all

class CGame : public IGame, public IGameFrameworkListener, public IPlatformOS::IPlatformListener, public IInputEventListener, public ISystemEventListener CGame::CGame() { } CGame::~CGame() { } bool CGame::Init(/*IGameFramework* pFramework*/) { return true; } bool CGame::CompleteInit() { return true; } void CGame::Shutdown() { }
My goal is to get a IGame - IGameStartup class to be able to create (the steam network) at game start and Tick on it to get data etc.

Also is it possible to build an exe file of a packed game ? i didn't found any way to as unreal did.

Thank you in advance for your cooperation !

Re: 5.3 Engine Class

#2
You should use the ICryPlugin interface for this. Then you can use the OnPluginUpdate function to update everything. For a real example of how to implement this take a look at CryPerceptionSystem or CrySensorSystem. That's the easiest method to get an update function without having to mess with IGame and CryAction. Or you can take a look at one of the game templates and see how the GamePlugin is implemented, it inherits ICryPlugin.

Forgot to mention that you can then make your plugin inherit and use the ISystemEventListener to listen for game start/init and shutdown events. Don't forget to register your class as a listener with

Code: Select all

gEnv->pSystem->GetISystemEventDispatcher()->RegisterListener(this, "CMyPlugin");
My Youtube Channel

Re: 5.3 Engine Class

#3
Thanks for the quick reply.

I already tryed with the CGamePlugin class given by default, the function is never call sadly....

Code: Select all

void CGamePlugin::OnPluginUpdate(EPluginUpdateType updateType) { CryLogAlways("ONPLUGING UPDATE"); }
Ok i'm dumb for a bit i had to add on Initialize:

Code: Select all

ICryPlugin::SetUpdateFlags(EUpdateType_Update);
Also by creating IGame class don't the code should be clear to share data between player, handle collision etc than use a all in one class plugin ?
I'm pertty new with CE and the docs is so bad i'm a bit confuse with Engine class hierarchy.

Re: 5.3 Engine Class

#4
Also by creating IGame class don't the code should be clear to share data between player, handle collision etc than use a all in one class plugin ?
I'm not sure what you mean by that. Can you explain please? You can do anything IGame does in your plugin as well. If you take a look at the GameSDK implementation of IGame (Game.h, Game.cpp) all it does is just inherit from a bunch of other common interfaces and listen for events and act on them. You can call your plugin CGame as well and do everything you can with the IGame interface. I think the goal with newest Cryengine versions is to make the game independent of CryAction so that's why we shouldn't use IGame anymore.
My Youtube Channel

Re: 5.3 Engine Class

#5
Yes, i saw that, i checked GameSDK and it could be interesting :).
Also i made a new Plugin class (copy past the CCrySensorSystemPlugin and rework thing in to fit my need) but i still don't find where to say to the engine use it, the plugin compile the code is correct but it never start.....

Re: 5.3 Engine Class

#6
write a component, write a function exposed to schemyctic, then create a schemytic class and add previous component, call component function in its graph.drag class to the scene. check result. check system component, such as mesh, rigidbody, decal component source code.

Re: 5.3 Engine Class

#7
It is a steamworks plugin i don't want to make it exposed on 'front' i only want it to work on back and do the stuff, i only don't find how to make the plugin start as the CGamePlugin start, but event with a singleton the plugin don't start......

Re: 5.3 Engine Class

#8
Yes, i saw that, i checked GameSDK and it could be interesting :).
Also i made a new Plugin class (copy past the CCrySensorSystemPlugin and rework thing in to fit my need) but i still don't find where to say to the engine use it, the plugin compile the code is correct but it never start.....
Did you create an interface (such as IMyPlugin.h) that inherits from ICryPlugin and then make another class (MyPluginDLL.h) that inherits from your interface? Or did you just create a single class that inherits ICryPlugin? Did you generate new GUIDs for your classes? That may be why. Can you post your code for your classes otherwise it's really hard to help.
My Youtube Channel

Re: 5.3 Engine Class

#9
Well i made a simple inherance from ICryPlugin as i don't need an interface as my library is already an interface:

Code: Select all

// Steam plugin manager class CSteamManager : public ICryPlugin , public ISystemEventListener { public: CRYINTERFACE_SIMPLE(ICryPlugin) CRYGENERATE_SINGLETONCLASS(CSteamManager, "CSteamManagerPlugin", 0xF01255B0A4E74DC6, 0x91E10AF18906FE7C) virtual ~CSteamManager(); //! Retrieve name of plugin. virtual const char* GetName() const override { return "SteamManagerPlugin"; } //! Retrieve category for the plugin. virtual const char* GetCategory() const override { return "Steam"; } //! This is called to initialize the new plugin. virtual bool Initialize(SSystemGlobalEnvironment& env, const SSystemInitParams& initParams) override; virtual void OnPluginUpdate(EPluginUpdateType updateType) override; // ISystemEventListener virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override; //need to make a correct call for each dunction this is temp function // Check all steam requierement before continue bool Initialize(); // void Top_Secret(); // Get if our user has log on steam bool isLoggon(); // Get our player SteamID class CSteamID& getSteamID(); };

Code: Select all

bool CSteamManager::Initialize(SSystemGlobalEnvironment& env, const SSystemInitParams& initParams) { gEnv->pSystem->GetISystemEventDispatcher()->RegisterListener(this); ICryPlugin::SetUpdateFlags(EUpdateType_Update); CryAssert("Steam plugin as been Initialized.\n", "SteamManager.cpp", 34, false); // never passed return true; }

Re: 5.3 Engine Class

#10
The issue is that you're using

Code: Select all

CRYGENERATE_SINGLETONCLASS
because if you go to its definition it says "Deprecated macro: Use CRYGENERATE_SINGLETONCLASS_GUID instead. Please refer to the Migrating Guide from CRYENGINE 5.3 to CRYENGINE 5.4 for more details."

So use this instead

Code: Select all

CRYGENERATE_SINGLETONCLASS_GUID(CSteamManager, "CSteamManagerPlugin", "yourGUIDgoeshere"_cry_guid)
Generate new GUID by going to Tools->Create GUID and select format 4. Also, remove the brackets from the number.
My Youtube Channel

Who is online

Users browsing this forum: No registered users and 4 guests