Download

OpenLevel with options....

So if you open a level, and pass it listen, that makes sense… if you pass it listen?game=xxxx … well, where in blueprints do you get what xxxx is? Or where does this ‘game’ get set? Or what should XXXX be equal to? the name of your gamemode bp class?

Not finding any info on this after searching around for quite a while. Best I could find is reference that lists it as game=GameInfo … which appears to have been replaced with game mode.

I can’t tell you what the xxxx must be for “game=”, but this should be equal to the GameMode class you want
to use for that map. All options you add (for example ?ServerName=MyServer?NumberOfPlayers=12) can be found
in the “Option String” in the GameMode. It is a String Variable that is already available if you search for it.
You can then make an array of strings with the String functions by splitting the string at the “?”.

Hmm, was unaware of the built in ‘options string’. Thanks for that info. I did a print string and it get’s the whole string ‘listen?game=xxxx’ … unfortunately I am unable to figure out how to set what gamemode I want for the loaded level even if I break that info out and get the XXXX. As each level loads with the ‘default’ game level. But what if you want to play a map in different modes? The lack of clear documentation is somewhat annoying.

AH!

the input to game needs to include the path to the class, and the . with repeat and _C there. That info was buried pages back in my search.

/Game/BlueprintsLogic/GameModes/L_Deathmatch.L_Deathmatch_C

But to make it easier, you can go to your DefaltGame.ini and add something like this:

[/Script/Engine.GameMode]
+GameModeClassAliases=(ShortName=“DM”,GameClassName="/Game/BlueprintsLogic/GameModes/L_Deathmatch.L_Deathmatch_C")

that creates an alias to the mode so you can just use game=DM in that instance and it loads the proper mode when loading the level.

3 Likes

Glad to read that (: Thanks for the info!

As of recent engine versions, this changed in config location (DefaultEngine.ini now) and syntax. Here’s an example.


[/Script/EngineSettings.GameMapsSettings]
+GameModeClassAliases=(Name="TDM",GameMode="/Script/ShooterGame.ShooterGameMode_TeamDeathMatch")
+GameModeClassAliases=(Name="DM",GameMode="/Script/ShooterGame.ShooterGameMode_FreeForAll")

It can also be edited in Project Settings / Maps and Modes / Default Modes (advanced options).

2 Likes