Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Game State, Game Instance & Game Mode. Which one to use for what?

I'm making a simple co-op multiplayer game. You complete a level by defeating X amount of enemies and then you move on to next level (stream or not).

Where would be best to store the variable that determines if you won that level? So far, I'm using level blueprint to store "global" or level-specific variables but it seems like they're best stored elsewhere. Game Mode seems to be server-only? So a client can't access Game Mode vars? I don't get it.

Product Version: UE 4.16
more ▼

asked Jul 07 '17 at 06:17 AM in Using UE4

avatar image

31 6 8 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hey, did you check out eXi's Network Compendium? It's huge, but important that you understand the whole framework and not only your 3 mentioned classes. I hope it helps you as much as it helped me! <3

more ▼

answered Jul 07 '17 at 06:49 AM

avatar image

4.1k 88 38 152

avatar image c0ldpr0xy Jul 07 '17 at 08:45 PM

Yo, that PDF is a gift from the heavens. Thanks.

avatar image Faygdon Sep 23 '17 at 11:16 AM

i love u, thats exactly what i need

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey! Super simple, just seems hard to understand ;)

Let me explain:

GameMode: you have right, exist only on server. It is a secured actor which are hackproof because exist only on server, so clients cant modify it for example. But im sure many cause are there, why it is only on server :)

No matter, exist only on server. Gamemode is the actor who owns and controll all of your rules which your game need. For example imagine a shooter game with Team DeathMatch Mode!

Gamemode will check scores, time and will decide when match is over and which team is winner! Clear and simple right? But..

GameState: gamestate is a simplified actor which will replicate to every client. So Server will have one GameState and every Client will have a copy of that!!! Because of replication you can use unreal engines networking in gamestate, replicate variables, call multicast rpcs and so on.

Why Gamestate is important?

Go back our TDM example. You have two team which have team scores. when team 1 achieving score GameMode should decide and add one point to team 1. So basically scoring as i said below controlled on server by Gamemode. But you want show that score on Client Uis right? For that you need GameState because GameState can replicate variable, so team scores should be stored in gamestate but only Gamemode can change it :) Again clear right? For security reason we do not allow players to modify team scores, when someone dies we notify Gamemode this player died, Gamemode will decide we need add point for team or not, Gamemode modify point in Gamestate, Gamestate replicate score variable, Client Uis will refresh with new score :)

Gamemode and gamestate arent persistent actors, that means when you change level new gamemode and new gamestate will be spawned. So if you load a brand new level gamemode, gamestates will be destroyed (client gamestates too) and when new map loaded new gm gs will be spawned.


Gameinstance actually is your game itself. Gameistance is persistent actor which will created when you first start the game and will be there as long your game runs. No matter if you changing levels or players disconnecting from servers or go back to main menu, gameinstance will be there if game running.

Gameinstance is used for many cause like login and account check or giving informations about last played match or something.

Go back to our tdm example.

You want show some statistics for players after match ended, but you want to show that when new map is loading in background for example. For this you can use gameinstance.

After match ended you send your statistics via gamestate and store in gameinstance, start load new level and you can use data from gameinstance, because gameinstance will be not destroyed :)

This GameInstance example isnt the best, but i hope you understand the point.

more ▼

answered Jul 07 '17 at 06:50 AM

avatar image

1.5k 15 9 33

avatar image c0ldpr0xy Jul 07 '17 at 08:45 PM

Thanks for the explanation, bookmarked.

avatar image joeGraf STAFF Jun 20 '18 at 08:41 PM

GameInstances are UObjects and not Actors.

avatar image Gradess Mar 21 '19 at 12:14 PM

Thank you very much!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question