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"

Handling server migration?

So in a typical UE4 non-dedicated networking architecture (where one player is the authoritative host that other clients can connect to), when the host disconnects, it seems to kick all players from the map. What is the recommended way to handle this if you wish to keep the game going? Is there some way to intercept this behavior and transfer authority over to one of the clients, effectively making them the new server? Or is the game mode/instance/state broken to the point of no return, and all server-side data lost forever?

Product Version: UE 4.15
Tags:
more ▼

asked Jul 13 '17 at 09:39 PM in C++ Programming

avatar image

MichaelWion
250 27 40 50

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

2 answers: sort voted first

Hey!

Im sure Engine has events when a player gets disconnected from server so maybe that will be a good point to start investigate possibilities there..

But im sure you can not save anything from server except if you save before disconnect happens...

Lets say server suddenly crash, at that moment all data will be purged from memory, everything stop right? No access, no data except if you do some datasave system maybe, but i have several issues with this... But first the concept:

For restart server in other client you need save everything on clients, which cause some security questions.. but forgot this :) Lets say you save everything about world/level in every 1 min on clients too like a save game or something :)

If session / connection closed simply you just restart the map as single player :) It is one solution, but how can other players join to this maybe or something?

This is the hardest part, because without backend you cant do something like this and actually im not sure with backend you can do this but again one idea :)

Lets say you implement a master server backend in your architecture. Some player host a new game, new game is registered and every data maybe collected (who is connected, who was server etc.) Clients saving the world in every min, so they have map data.

Server disconnects, master server notified we lost connection with server. Master server notify clients , maybe select a new server, forcing to start new listen server and a few sec later command other clients to rejoin. :)

But for this you need implement master server backend into your clients, server code etc and you need run a backend for your master server.

more ▼

answered Jul 14 '17 at 07:25 AM

avatar image

AmphDev
1.5k 15 9 33

avatar image MichaelWion Jul 14 '17 at 04:50 PM

If important data is replicated to clients, we probably won't even need to utilize USaveGame at all. And I like the idea of having a master server backend, keeping track of sessions and disconnections, however...

I'm actually utilizing the Steam OSS, so I'm not sure if a master server is possible to implement... Originally, I attempted to have an authoritative dedicated server architecture working with OnlineSubsystemNull, which worked wonderfully until I tried to implement non-LAN session searching/joining. I was forced to move to OnlineSubsystemSteam, but then I couldn't find sessions with a dedicated server, so I moved to the standard client-server architecture. Now I'm able to find sessions both online and on LAN, but at the cost of not having a dedicated server.

And the issue still exists on how to tell a client "you are the new server", and somehow actually get the engine to believe this.

avatar image Nerdballer Games May 01 '18 at 06:56 PM

Doesn't seem like an issue to me: you replicate an array of players in Game State, adding them to the array on event post-login. The first player in the array is the new server, fires up a new game instance, and then all other clients attempt to join. They all Know who's the new server. This is just one of many ways to do it.

I'm still vague on what the function calls to do this are, and what info needs to be saved. If anyone knows

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

Why would every client's game crash upon host disconnect? That's not what happens. It just boots them back to the main menu, or whatever you as the coder prefers.

more ▼

answered May 01 '18 at 06:59 PM

avatar image

Nerdballer Games
35 5 15 15

(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