RyroNZ / UE4MasterServer

This is a plugin for Unreal Engine 4 that adds server registration, deregistration etc with a master server.
http://ryanpost.me
zlib License
223 stars 73 forks source link

Server Still thinks session is active #11

Closed TimSSweeney closed 4 years ago

TimSSweeney commented 4 years ago

Whenever I start a session, close the game and look for sessions again, the server still returns an active session, if I try to join it, nothing happens. Closing the server and restarting it fixes this but how can I ensure the server knows the session is dead when I close the game. Is there a heartbeat somewhere that I can fix?

RyroNZ commented 4 years ago

Hey Tim,

There is a heartbeat, the server is dropped after 60 seconds of no contact. This can be configured in PerformHeartbeat() in the plugin, and should match the servers heartbeat time + a small buffer for latency. I might update it so the server it tells the client how long to wait between heartbeats so it's only configured in one place.

RyroNZ commented 4 years ago

Just pushed this up, you can now configure the heartbeat time in the server file (check self.time_between_heartbeats) and the client will be kept in sync with this.

TimSSweeney commented 4 years ago

Line 43 right?

TimSSweeney commented 4 years ago

Also how does the port forwarding thing work? do the clients need to enable port forwarding or the server?

RyroNZ commented 4 years ago

Yeah line 43. Clients have to port forward and open firewall to the game server so it's open to the internet, but the master server can check that a client is port forwarded and only show the game server in the list if it is. If a client's game is open to the internet the create session node will route through success, if it isn't the create session node will fail. Hope that helps.

RyroNZ commented 4 years ago

You need to also open the port to your server which is 8081 by default.

TimSSweeney commented 4 years ago

So if I were to distribute a game with this plugin, what would I need my clients to do ?

RyroNZ commented 4 years ago

They would need to port forward there game server and that's it.

TimSSweeney commented 4 years ago

is there any way around that?

RyroNZ commented 4 years ago

You'd need a NAT punchthrough server which isn't currently supported by this implementation. Port forwarding is pretty standard stuff when you're hosting servers.

TimSSweeney commented 4 years ago

I don't mean I want my client hosting the master server, I will be hosting it but I just wanted to know if the people that want to access the master server have to port forward?

RyroNZ commented 4 years ago

They don't have to port forward to access the master server, they have to port forward their game server so people can actually join them from the internet. The master server won't put their server in the server list if it's not connectable from the Internet because nobody will be able to connect to it.

XZCendence commented 4 years ago

Then how does the steam OSS do this without needing port forwarding? Wouldn't the basic session principle be the same?

TimSSweeney commented 4 years ago

I'm not sure

RyroNZ commented 4 years ago

It's because they have a nat punchthrough server which they've written into the steam OSS. I've written this myself. I may look at adding a method to do that but I'd need to research it further.

lukaspirkl commented 4 years ago

Do you have any update regarding nat punch-through? I was learning about this concept recently and this article is a great starting point. http://www.mindcontrol.org/~hplus/nat-punch.html