Add support for V3 tunnels#845
Open
11EJDE11 wants to merge 101 commits into
Open
Conversation
Add V3GameTunnelBridge Add V3TunnelCommunicator Add V3TunnelNegotiator Add TunnelFailed event Update supported tunnel versions
Fixup GameCreationWindow control visibility Remove unnecessary tunnel parameter in V3PlayerInfo Add NegotiationStatusPanel Add tunnel negotiations to CnCNetGameLobby Add V3 tunnel support to CnCNetGameLobby
Move to file-scoped namespaces Fix missing texture on status panel Fix issue with decider seeing OK instead of ping results
Fix an issue with automatic tunnel selection Style fixups Split TunnelChosenEventArgs into new file
Remove IDisposable on bridge
Remove unecessary code
Better updating of player ping indicators
|
Nightly build for this pull request:
|
Contributor
|
Perhaps the ability to add a button within one of the clients ini files to toggle between V2 and V3 would be useful. Just a thought |
SadPencil
reviewed
Nov 17, 2025
| @@ -0,0 +1,248 @@ | |||
| using System; | |||
Member
There was a problem hiding this comment.
write #nullable enable since you are using the nullable syntax. Same for other new files
Member
There was a problem hiding this comment.
Thanks, done now.
Please place #nullable enable in the first line
Fix V2 tunnels not matching
…hind a lock. -Send negotiated packet loss in the TunnelChoice packet so both peers display it without extra IRC messages. -Derive V3 in-game player ids from the host's start message position instead of the local player index. -Link decider tunnel-wait timeouts to the negotiation token so they cancel on dispose. -Disable the host launch button until all V3 dynamic negotiations succeed. -Remove dead tunnelErrorMode field, make AddTunnels atomic, and fix V3PlayerNegotiator log prefix.
| else | ||
| { | ||
| connection.QueueMessage(QueuedMessageType.SYSTEM_MESSAGE, 9, "PART " + ChannelName); | ||
| connection.QueueMessage(QueuedMessageType.INSTANT_MESSAGE, 0, "PART " + ChannelName); |
| if (status == NegotiationStatus.Failed) | ||
| return "Tunnel negotiation failed".L10N("Client:Main:TunnelNegotiationFailed"); | ||
|
|
||
| if (v3Info?.Tunnel != null && status == NegotiationStatus.Succeeded) |
This file contains hidden or 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
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.
Closes #349
New
UserINISettingson: games use V2 tunnels (overridesUseDynamicTunnels).If
off: games use V3 tunnels.on: lobbies start with no predefined tunnel; tunnel negotiations occurs as players join.If
off: games use static V3 tunnels (unless legacy mode is enabled).New Lobby Commands
/tunnelmode [<mode>]Modes:
0 - V3 (static)
1 - V3 (dynamic)
2 - V2 (legacy)
/negstatus/tunnelinfoNew CTCP Messages
PLYTNL <address>:<port>NEGINFO <target_player>;status[;<ping>]TNLRENEG <failed_address>:<failed_port>TNLFAIL <tunnel_name>STARTV2/STARTV3STARThas been versioned intoSTARTV2andSTARTV3.How V3 Tunnels Work
In V2, all players share a single tunnel.
Example:
In V3 dynamic mode, each pair of players negotiates the best tunnel route:
The client now acts as an intermediary: the game connects to the client, which then routes packets to the negotiated tunnels. This is for both static and dynamic V3.
Negotiation Process
Negotiations occur automatically when players join a lobby and take a few seconds once the player list has arrived.
RTT, packet loss, and average latency are measured.
Connectedpackets and sendsPingRequestpackets.PingResponsepackets.If
Ping unofficial CnCNet tunnelsis disabled, you will only negotiate over official tunnels.Example Log Output (truncated)
Tunnel Failure Handling
A new
TunnelFailedevent has been added to the TunnelHandler.Dynamic tunnels:
Automatically trigger renegotiation when a connection goes down (only affected players).
Static tunnels:
Still to come...
Showing the negotiation in the lobby, and the negotiation status panel (available for all players).

Showing a change to the game creation window and a game's ping:

New settings:
