GameMode philosophy

Hello,

I would like to understand what the philosophy is for GameMode use.

If I want to make a game like Unreal with lot of scenarios (Death Match, Flag,…) and a lot of map and I want to use all scenario in each map. My idea is to create a menu where the players can choose the map and after the scenario. I think I can use GameMode to record scenario, I’m right ?

My issue is I’have create a menu in UMG with a blueprint script and I find how to load the selected map but no way how to load the selected Scenario (GameMode).

Could you please help me to understand the GameMode philosophy and how load a GameMode in Blueprint ?

Thanks.

+1, I don’t see what use the GameMode is, I haven’t needed to use it for anything so far. I’d like to know more about it.

If there isn’t something new in 4.8, you just can’t do that in Blueprints. You can load a GameMode in C++ by passing the GameMode name and
i saw that someone got it to work in previous version by using the ConsoleCommand node, but i had no luck with it.

The only way you can setup a GameMode for your Map in BP is by overriding the GameMode of the Map. Open the Map and on the Top, click on “Blueprints…”.
Then, the most bottom options is “World Override”. Here you can select the GameMode that you want to use for this Map. Sadly as long as you can’t change
the GameMode via BPs, you will need to have the Map duplicated with 2 or more different GameModes.

Or you try and start to learn C++ to expose a function that helps you setting the GameMode at runtime! (:

The GameMode is really what its name says. A Mode of your Game. Each GameMode has room for a specific PlayerController, DefaultPawn, GameState, PlayerState, etc. class.
You don’t exactly need to put any logic into the GameMode, but you will want to put different classes into the Default values of the GameMode, so you can have different behavior in your
game.

For example, you could have a different PlayerCharacter spawning. Or you have a different GameState where you save Players in Teams instead of a normal PlayerList.
You could also define different Weapons that your Players should start with (pistol only etc). This is what your GameMode is for. Giving the ability to have all the important classes exactly
fitting to your GameMode. So you don’t need to put the logic of Free for All, Teamdeathmatch, Capture the Flag, King of the Hill, etc. all in one class, but just create an additional GameMode
and define the logic insight of the classes.

Things that your GameModes and other classes share will be put in a Parent class. This is basic programming!

Default Values of a GameMode BP.

http://puu.sh/iM44l/4b31450517.png

If your game consists of one game mode, you probably wouldn’t need it, especially if it is single player.

When you need to determine more things about your game then you will need it. The most obvious thing is setting up default pawns, controllers and the like. With it you could do things like determine a minimum amount of players to start the game, handle giving your players a score, etc.

It is one of those things that you need to play around with as there aren’t too many good tutorials online other than showing how to set up the default pawn. The generic shooter project makes good use of it. I suggest getting it asap if you can.

In the level world settings you set your default game mode. You can also load a specific game mode for a level by executing the open command with some parameters. Just have a look at the documentation Game Mode and Game State | Unreal Engine Documentation

Hello,

I would like to thanks all for yours answers.

Ok, I will continue my thinking with C++

Our game will be a strategical FPS with multiplayers. I hope to have between 3 and 5 maps and between 5 and 15 different rules (GameMode).

We want that every different rules can be played on any map.

So our idea is to have in each map a bomb for the “Minesweeper rule”, a falg for the “Capture the flag rule”, etc… And when the game start and the type of game is choose, we activate only the object we need and the good rule… So my idea is to use GameMode for this but may be is not the good solution ???

Thanks

No, that is a good solution. You just need to have a functiom that you override in your gamemodes with different logic to enable the flag or what ever you want. The scoring system should be place in the GameState and PlayerState classes which are also different with every gamemode. So that perfectly matches your requirements (:

Edit: depending on what you want to do, you might consider using the gamestate for the init of the map, since the gamemode does only exist on the server. gamestate exists on ckients too. So if you want to call an rpc to the client, you must go over the playercontroller. This could be done with the postlogin function of the gamemode. Just test around what fits your needs.

Thanks ! And is it a good solution to have all objects for all rules and each map and when we init the map we activate only the objects we need ?

Personally, I see GameMode as a referee or game master. Remember a game has two opposing sides and a ref to manage them.
I like to make stealth games, and I use GameMode to notify AI pawns of major changes, like player has been spotted and alert the rest. I use GameMode to broadcast that to all (living) AI pawns, after tracking all pawns in a level first. It’s easiest to do that in an Actor that’s ever present like GameMode.
Hope that helps.

Here’s a good thread to keep in touch with.

Thank you for all.

With all your ideas, I’ve create a GameMode for each rule (Flag, deathmatch) and I create a menu with a blueprint script that launch the game (level + GameMode). You can find the blueprint here :

In my exemple, I launch the level “ThirstPersonExempleMap” and I can choose with the button the GameMode I want. The first button launch the “GM_Bomb” GameMode. Be careful for the path:

  • The name of my GameMode is : GM_Bomb
  • The path where my GameMode BP is : /Game/GameMode/
    So the option string is : “?Game=/Game/GameMode/GM_Bomb.GM_Bomb_C”

-> You have to finish the path by “_C”

The second button launch the “GM_Cube” GameMode…

Thanks !

That’s really good to know. So i need to update my Marketplace Project again.

I googled exactly that and asked multiple people, resulting in the answer “The ?Game= Option is somewhat not working anymore”.

Screw that, now i need to deleted the second map and change the Openlevel button.

Will write that down for the next major update/fix.