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"

How to destroy a session when the listen server host closes the game?

Say you're in a game that's hosted on a listen server and the host decides to quit the game, you automatically get booted to the main menu, but the "local" session is never destroyed. Which means you won't be able to start a server again without restarting the whole game. When you disconnect from the game from my in-game menu, the session is successfully destroyed using a using a function I wrote. Basically, I'm just looking for a good place to call my destroy session function for when you're disconnected by the server. I'm using the steam subsystem btw.

Product Version: UE 4.12
Tags:
more ▼

asked Jul 03 '16 at 03:17 AM in C++ Programming

avatar image

Chris528
327 20 21 36

avatar image Chris528 Jul 03 '16 at 08:28 PM

Maybe overriding ClientReturnToMainMenu for my player controller class would be a good start?

avatar image tmek Jul 07 '16 at 11:34 PM

The GameInstance HandleNetworkError virtual function/event gets called if you're on the client and the host disconnects.

avatar image Koralgoll Sep 26 '16 at 12:09 PM

Can you show us how you destroy local session in your function?

avatar image Spiris Sep 26 '16 at 01:42 PM

There are a number of places that I have found that would be a good place to call destroy session, but each of them that I have found have a rare case where they will not destroy the session when it needs to be destroyed. The best place I have found currently as a 'catch all' fix is the time when the player opts to join session, or host session.
If you call destroy session just prior to join/host session, on a success or fail condition you will know you are in the clear to get another session.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

This node is also used for leaving sessions. Clients also need to call this node when they leave a game.

more ▼

answered Jan 16 '17 at 05:35 AM

avatar image

youthnick
175 1 5 7

(comments are locked)
10|2000 characters needed characters left
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