x

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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

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?

Product Version: UE 4.18
Tags:
more ▼

asked Feb 14 '18 at 06:32 PM in C++ Programming

avatar image

Balgy
65 3 8 11

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

1 answer: sort voted first

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).

Here's a lovely tutorial explaining how to get started with Game Sessions.

more ▼

answered Jun 24 '18 at 12:57 AM

avatar image

Jay2645
183 4 11 23

(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