I am planning to create a code plugin (enemy waves generator) that may be having its own Game mode and Game state. Now the problem is since the plugin is meant to be used for different games but each game can have its own Game mode so the plugin will not be able to work as meant. The user would have to merge his game mode with the plugin’s game mode. And this to me seems to be a hurdle for the plugin. How can I ensure that player shouldn’t have to change his/her game mode?
Perhaps make a Game Instance Subsystem for your plugin? It gets instantiated automatically if the plugin is enabled.
make a new gametype above the game mode and fill it with what you need and extend the game state to a new game state on top the old one so all the code you add is in your 2 files not the ones below. Then when they add in your plugin in it will add your content with out messing up anything below it.
Is the subsystem replicated through the network?
Hi so if I understood correctly user will only have to reparent his gamemode?
No. The benefit of the subsystems is just that it gets instantiated automatically and is easy to access in Blueprint.
Note that you can also bind to these GameModeBase events.
FGameModeEvents::FGameModeInitializedEvent FGameModeEvents::GameModeInitializedEvent; FGameModeEvents::FGameModePreLoginEvent FGameModeEvents::GameModePreLoginEvent; FGameModeEvents::FGameModePostLoginEvent FGameModeEvents::GameModePostLoginEvent; FGameModeEvents::FGameModeLogoutEvent FGameModeEvents::GameModeLogoutEvent; FGameModeEvents::FGameModeMatchStateSetEvent FGameModeEvents::GameModeMatchStateSetEvent;
You will call your game mode and use it. Example deathmatch and team deathmatch you will make your own, named whatever you want it to be named. Then call and use it as a gametype mode that gets played.