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
Feature: join servers based on their invite code #9432
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…dress This allows future extensions to have different ways of referencing a server, instead of forcing to use IP:port.
TrueBrain
changed the title
Feature: also allow using invite codes to join servers
Feature: join servers based on their invite code
Jul 11, 2021
Okay, I deployed a compatible Game Coordinator on staging; from what I can see it is doing what it should be doing, but it could of course use a bit of testing :) Tnx to #9429 this became a lot easier, you just have to set the env-variable |
Invite codes works for me with IPv6 or IPv4 (not both at the same time of course, current limitation of GC ;) ) |
rubidium42
reviewed
Jul 11, 2021
Normally TCPConnecter will do a DNS resolving of the connection_string and connect to it. But for SERVER_ADDRESS_INVITE_CODE this is different: the Game Coordinator does the "resolving". This means we need to allow TCPConnecter to not setup a connection and allow it to be told when a connection has been setup by an external (to TCPConnecter) part of the code. We do this by telling the (active) socket for the connection. This means the rest of the code doesn't need to know the TCPConnecter is not doing a simple resolve+connect. The rest of the code only cares the connection is established; not how it was established.
TrueBrain
force-pushed
the
invite-codes
branch
2 times, most recently
from
July 11, 2021 17:26
d043338
to
9d31875
Compare
This removes the need to know a server IP to join it. Invite codes are small (~7 characters) indentifiers for servers, which can be exchanged with other players to join the servers.
rubidium42
approved these changes
Jul 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
!!WARNING!!
This is currently only working with staging. See
Testing
how to test this PR!Motivation / Problem
Currently joining a server requires you to have either of these two:
This is often annoying if you want your friend to join the same server.
Additionally, this allows for several other future additions, that without a system like this would be impossible:
Description
There are now two type of connection-strings:
hostname:port
.+
.The
+
of the connection-string to indicate invite codes is part of the network protocol, and the Game Coordinator can either give a server address or an invite code per server. This is done for backwards compatibility, allowing you to still see servers from 1.11 and before. These are always server address based, ofc.As using an invite code means you do not know the
hostname:port
of the server, several packets are needed to talk to the Game Coordinator to discover this information. The idea is very simple:hostname:port
of the server. (in the future, STUN and TURN will be added)Testing
This is deployed on staging as of now, and you can test that by starting OpenTTD with:
OTTD_COORDINATOR_CS="coordinator.openttd.org:4976" ./openttd
It will NOT (!) work on production, so starting this PR unmodified will result in a non-functional multiplayer experience!
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.