GameSession or GameInstance
What is the difference between using the Game Instance class to interact with the session interface rather than the Game Session class?
asked Feb 14 '18 at 06:32 PM in C++ Programming
So the Game Instance is on every single instance of the game, designed to hold data which should persist from the moment the user enters your game until the moment the user exits the game. Even if the player never touches any multiplayer functions, the Game Instance will still exist on their machine (although it is not replicated in any way to other machines). The Game Session is somewhat similar, but can be thought of as like a "server" for clients to find. If a player creates a new Game Session, they become a server, with other people connecting to their Game Session being clients.
For example, a player may boot into the main menu of the game, triggering the Game Instance. They go to the multiplayer section and ask for a list of servers to join (or some matchmaking algorithm). The Game Instance then goes and finds as many Game Sessions as it can, then joins one of them (either by the user clicking on one in the server browser or via a matchmaking algorithm). The Game Instance can also create new Game Sessions, which can again be listed as valid sessions for other Game Instances to join. Each session is only created on the server, and can do things like load various maps, start different GameModes, etc, and inbetween matches players are kept together (unless they manually disconnect or the session ends). Sessions can also forcibly disconnect players if needed, either through kicking or banning players, and can also have a list of "admin" players, if you want the server host/people the server host selects to have special powers (like banning or kicking players via console or chat message).
Follow this question
Once you sign in you will be able to subscribe for any updates here