-
-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace master-server (UDP-based) with Game Coordinator (TCP-based) #9411
Conversation
8905bd6
to
b6aa8dd
Compare
b6aa8dd
to
636ef6a
Compare
Another argument for dropping UDP support: ngrok (and several other reverse-tunneling services) only work with TCP, so this is a very welcome change. 👍 |
636ef6a
to
e8638bb
Compare
I think this is ready. Game Coordinator is deployed, and talks (two-way) with the Master Server. So anything listed in the Master Server shows up via the Game Coordinator, and the other way around. Of course you cannot join those servers that are exchanged, as they for sure are of a different revision, but that is not really the point here ;) It could use some testing of some people, just registering their server, see if they can find it, etc etc. But .. I think this is ready :) |
As we now use the Game Coordinator for announcements, there is no longer a need to use the Master Server for this.
This removes all UDP from the game except for a local broadcast to find LAN games. So long Master Server, and tnx for all the fish!
e8638bb
to
f5dcc7e
Compare
Motivation / Problem
This is a part of #9017.
Currently OpenTTD communicates over UDP with the master-server to register itself, and the master-server uses UDP to polls the server for game-state. This has several disadvantages, as we noticed over the years:
In total, it became pretty clear we should just stop using UDP, and switch completely to TCP. Well, I say completely .. local LAN discovery is and always will be UDP based. That is just how multicasts work ;)
To be clear, this doesn't mean OpenTTD will always be using TCP. It is surely an option to use some library like https://github.com/ValveSoftware/GameNetworkingSockets that does resilient connections over UDP. Either way, we first have to change to a single way of doing stuff, before we can think about changing it all to something else. And this is far out of scope of this PR.
Description
This removes all master-server communication and all UDP-related code from OpenTTD, and replaces it with a TCP-based Game Coordinator code.
Again, the local LAN discovery still uses UDP and remains.
Why the change of name? To keep it clear that this is a completely different component. And in the future the Game Coordinator will be tasked with many other tasks, like join-keys, STUN, TURN, etc. It much more takes on the role of a coordinator, and no longer "just" lists the servers.
In the background, master-server and Game Coordinator communicate with each other, so the server-listing will be a combination of both for 1.12+. 1.11 will only see 1.11 and older servers.
The way it works is like this (and yes, this is documented in
network_coordinator.cpp
, just to beat LordAro to the punch :P):Basically this means as soon as the client clicks "Search Internet", it gets the full list of servers, including their details. It no longer has to send a flood of UDP packets to all servers.
Private
is renamed toLocal
, as there is no such thing asPrivate
.. a server is either accessible locally (or by the IP if you happen to know that), or publicly listed. This change makes the later addition ofInvite Only
a lot more sensible to the user.Future PRs will extend this functionality with invite-codes, STUN, TURN, ... But, baby-steps.
Limitations
Currently there are a few rough edged, but further PRs will address those. For example:
CLIENT_UPDATE
sends all the NewGRF data every time. But as they can never change, this is a waste of bandwidth.Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.