[4.9.2] Transfer Hosting the Server to a Client

Just for clarity:
Im using [4.9.2] and I have the Advanced Sessions Plugin installed in my project.

My project allows players to freely create, enter, and leave servers based on preset “sector” coords. (click a sector on the map and it happens automatically)
For example, if a player wants to go to sector 0,3 it will check if a session is already running for that sector map and if so join it. If not it will instead create that session.

There is a problem with this in that, if the host of that session decides to go to a different “sector”, I have to destroy the session or it will fail.
If I destroy the session it will boot every other player from the sector, because the session was destroyed.

So how can I transfer ownership of the session to a different player such that the host can leave without disrupting the other players?
Can this be done with Blueprint Scripting, or should I re-ask in the C++ forum?

I don’t think that this would be possible in Blueprints (no idea about the Session Plugin though).
Wouldn’t this be better solved by just having a DedicatedServer per Sector where people can freely connect and leave?

Ive not dealt with dedicated servers. Ill go ahead and also ask in the C++ forum, but can players set them up similarly to how Im doing it now?
Id rather not have fixed servers like that in the event that I can’t support them at some point in the future.
If I set it up so the servers are handled on the player side, then they could still play MP even if I can’t directly support the servers.
Or at least thats my line of thought.

Well yeah, for Dedicated Server you would have them somewhere hosted (which also removes cheating!).
If you don’t want that then you need to stick with the ListenServers (where the hosting player can easily cheat).
If cheating is not a problem then I would stick to the ListenServers. Would be nice if you could leave a link to the c++ thread in here.
Would be interested in the host transfer too.

C++ thread:

What you’re talking about is host migration and unfortunately there is no easy way to do this . You have to code it yourself which means overriding network and session code which is a minefield and a headache. Im not saying it’s impossible as obviously other games / people have done it .

I originally had listen servers as we were making a multiplayer shooter game but as suggested here it was quickly apparen’t how easy it is for cheating and host dropping to occur.

I have since switched to dedicated servers . And now use a dedicated server manager which can start and stop servers at will so in effect players can host and join servers but if they were to drop from game the server is still online meaning game continues and dropped players can even rejoin of you want them to.

When game ends server recieves function to shut down so it is only running and using resources while the game is running . If no players then no server instances are running.

In basics the way it works is this

Player clicks umg host button
This constructs a json object using varest plugin and sends all player,server data,map name etc into a database via php script.

Then my external dedicated server manager listens for the json object and when it recieves the object it calls function to start the server.

I am currently trying to figure out network sockets . If I could find a way to open a network socket between unreal and the server manager it would be even easier and better and more secure to send data .

I cannot take credit for the system this guy helped me and had the original idea . I just tweaked it and adjusted it for my needs

System can be seen in action here . All credit to this guy

Also I wouldn’t worry about costs to begin with I am hosting 5 games/server instances on my own machine just fine which is OK for testing or to begin with. Although it does depend how many players you want on each instance etc

Or if you have the money ou can buy a virtual server for around £40 a month to get you underway

And realistically you only need to expand if you’re player Base grows . And if you have a big player Base then theoretically you will or should be making enough money to support the servers

That depends on what type of cheating you are referring to.
My game is not aim dependent, so aimbotting isn’t a thing I need to worry about.
But I do want to have players “build up/level up” their character over the course of play.

To what degree can cheating occur on listen servers?
Will I have to worry about them giving themselves free items/levels? or is it more along the lines aim botting?

theoretically, cheating from the listen server can take any form you can imagine. If there is a variable replicated from the listen server, then it can be hacked, and it will then replicate to all clients.
Even if it doesn’t replicate, it will at least affect the server player.
So you name it. If it’s a variable it can be changed, and (though more difficult) if it’s a function it can be called.

The way unreal’s networking architecture prevents cheating is that things only replicate from server to client, with the exception of some kinds of remote procedure calls, which are part of your design for your game. However, this doesn’t prevent the server player themselves from hacking their own game running on the server side.

So dedicated server means every player is a client, so any hacking they do to their own game affects only them, and then the server corrects them next replication and says “No… THIS is what happened, and how it happened,” which is the version of reality all the players get set to by the server anyway.

So yeah, health, lives, score, speed, location, size, inventory, leveling up, ANYTHING.

This was often a problem back in 1998 with networked games of Worms 2 (made by Team17, not an Unreal game). People would host listen servers and then when things didn’t go their way, they’d cheat and suddenly give themselves a hacked minigun where each bullet does the largest explosion possible in the game. I still beat that guy by the way, mostly by luck and some great jumping skills getting me across the few pixels left of the landscape, as his bullet spread was too much to hit me from so far away, and to hit any of the tiny shreds of land I was standing on. Eventually he just messed up and fell in the water himself.