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 ?
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
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!
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.
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 ???
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.
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.