Download

Multiple Gamemodes

Hello, I am creating a game with different modes such as FFA, Capture the Flag, etc.

Right now it is set up so when you click ‘Host Game’ on the Main Menu HUD, it goes to a different level, but I don’t know how to go about calling those different game modes in the blueprints.

I want to be able to click a button to choose the Game Mode, then click Host and be sent to that map with the correct Game Mode.

Is there a way to have a different Game Mode for each map? Thank you.

If you want to use a single map for all game modes, add the game mode as part of the command line.
Something like:


MyMap?Game=/Game/GameMode/BP_FFA.BP_FFA_C

If you setup the alias system, you can shorten that to:


MyMap?Game=FFA

By alias system, I mean the GameModeClassAlias list in your DefaultEngine.ini:



[/Script/EngineSettings.GameMapsSettings]
+GameModeClassAliases=(Name="FFA",GameMode="/Game/GameMode/BP_FFA.BP_FFA_C")
+GameModeClassAliases=(Name="CTF",GameMode="/Game/GameMode/BP_CaptureTheFlag.BP_CaptureTheFlag_C")


If you need to have specific game mode related changes to a map for it to work correctly, I recommend using the permanent map as the gamemode map and adding the map geometry and so on as a submap.
Then you can use the prefix system to define the game mode:



[/Script/EngineSettings.GameMapsSettings]
+GameModeMapPrefixes=(Name="FFA-",GameMode="/Game/GameMode/BP_FFA.BP_FFA_C")
+GameModeMapPrefixes=(Name="CTF-",GameMode="/Game/GameMode/BP_CaptureTheFlag.BP_CaptureTheFlag_C")


We use the latter method, as it quickly became difficult to contain so many different game mode changes in a single map :expressionless: