Download

multiple gamemodes in one game level?

hello,
i am confused at using gamemodes.
in my level i will have a character that act as worker,can drive car,can using maschines,and maybe a fps mode.
i think that are 4 gamemodes:
worker
drive
maschine
fps

can i switch between gamemodes and my character state will persist?
so if me stay in front of a car i will switch to game mode drive.
if me exist driving switch to worker gamemode.
if me hit a trigger i wil switch to gamemode fps.

or should i use only one gamemode?

@MarkusR

There isn’t a fixed rule for all game types imo…

It depends on what works best for your game use case. But you’ll want to keep the code organized and tight, and easy to extend later. So to start, make a clear choice as to whether to destroy or merely hide / disable your character, when you get in and out of vehicles etc. If you destroy / respawn your character each time, you’ll need to cache settings somewhere, such as inventory / clothes etc, maybe in Gamemode / Game-Instance etc. But you may also choose or actually need to store some or all of those variables inside the possessed Vehicle, which in-turn will recover / recreate those once you respawn as a character after exiting the car. You can also store settings in Player-Controller as well, as its probably only the Pawn that will ever change here…

The answer overall though lies is keeping things as simple as possible for your use case… Before you decide, make a complete list of features and settings that each mode will require. Then look through a bunch of existing templates to see what patterns are used most often, that tend to work best. The clue lies in the genre of the game and whether you’re dealing with single-player / multiplayer or both. An RPG with lots of customization requires a very different mode to an FPS. Same goes for RTS etc… If the game is definitely going to have multiplayer that’s the most critical aspect to get right now ahead of time, above all else… Overall, find a working template close to what you’ve got planned and you’ll save yourself heaps of headaches later on…

@franktech thank you.
yes, its complicated, i will have clean blueprints and no chaos.
instead of hiding a character i think its better to destroy this object and for driving i will use a car controller blueprint with its own hud, and at exit i spawn a new character.
i tend to one gamemode in my level to start as human and for testing it make sense to use multiple gamemodes.