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"

Online Subsystem and Sessions WTF

I am trying to wrap my brain around the Online Subsystem and I thought Shooter Game would be a decent example. However all I seem to be doing is getting utterly lost. I've look around at a few tutorials and my game scenario is that you can play single player or join a dedicated server to play online. Your machine will never be the host.

Similar to the Shooter Game I created a new GameInstance and GameSession class. From what I assume a build dedicated server will call RegisterServer when it comes online. Within that function it will create the GameSession. The thing I do not understand is the GameSession never seems to be created on the client, and yet the GameInstance performs operations such as Searching and Joining through the GameSession object. The GameSession even has functions for Hosting, Finding, and Joining Sessions. In another tutorial I have found those same functions are on the GameInstance, which makes more since because GameSession object would not be created in a non dedicated server build.

I'm pretty sure you need to create a GameSession on the dedicated server, I'm not sure why the GameInstance on the client needs/uses the GameSession when one would not be created... am I missing something?

Product Version: UE 4.21
more ▼

asked Nov 23 '18 at 07:33 AM in C++ Programming

avatar image

499 32 25 57

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

1 answer: sort voted first

Okay, this one was a late night rant really. I'm still not sure how this works or if this works in the Shooter Game but I've decided to just ignore it. Basically what I have done is have Session Creation, Startup, and Destruction be Handled by the Custom Session for my game. GameInstance Handles Finding and Joining Sessions.

more ▼

answered Nov 29 '18 at 07:59 AM

avatar image

499 32 25 57

avatar image ArcainOne Jun 12 '19 at 12:01 AM

So with age comes insight. I believe what is happening is the ShooterGame leverages a non-dedicated host setup so p2p I believe. So because Clients need to Create the Session, all the logic for creating and hosting is in the Session Object itself, which makes since. However for a Dedicated Server setup with No p2p but all dedication I suggest doing as I did and have my session object handle session creation as the dedicated server will call RegisterServer and start the process, and all your find and join logic in the GameInstance. I've also seen one person put it into an intermediate object that can be leveraged by both the P2P and Dedicated Server models.

avatar image ArcainOne Jun 13 '19 at 03:37 AM

Its always that one tiny bit crucial of information that brings all the missing pieces tumbling down and enlightenment is achieved. It was this post that put it all together: https://answers.unrealengine.com/questions/758391/gamesession-or-gameinstance.html?sort=oldest

The AGameSession exists only on the server and it is the GameMode that keeps a reference to it. GameInstance is generally where you Find and Join Sessions but if you are doing a P2P Game it is also where you can start a new session. If you are doing a Dedicated Server than Register Dedicated Server is where you want to do that, The Game Mode itself on a Dedicated Server will create the session and call Register.

(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