Sven Co-op

Sven Co-op

457 ratings
Creating a game for your friends without ANY port forwarding or firewall configuration at all
By Adambean and 5 collaborators
Learn more about how to create a private game for your friends quickly and easily. This requires no port forwarding, no special router configuration, no firewall rules, and no other networking tosh you don't care about.

This goes over the new "NAT punch-through" feature release in version 5.19 of Sven Co-op, on 1st April 2019, and answers most frequently asked questions about it.
3
16
   
Award
Favorite
Favorited
Unfavorite
tl;dr version
  1. One person creates a game as the host via the "Create Game" option in the main menu.
  2. The host takes note of their steam ID (e.g. STEAM_0:1:12345678) then shares it with their friends. -- If that's you use https://steamid.io/ to help you find it if you can't see it printed in your game's console.
  3. Their friends join the host's game by inserting the following into their console:
    connect STEAM_0:1:12345678
    Obviously replace STEAM_0:1:12345678 for the host's real steam ID. No quotes should be typed around it.
  4. Profit.
Introduction
Hello everyone,

As of version 5.19 released on 1st April 2019 (no this isn't a joke) Sven Co-op can now host games using Steam's NAT punch-through service. (This has also been called "peer-to-peer" or "direct client-to-client".)

What this means is anyone, including you, can quickly create a game from the main menu, and have your friends join it without you having to configure port forwarding on routers, firewall rules, VPN (Hamachi, etc), or any other networking nonsense unfamiliar to the average user.

You can direct your thanks at our engine programmer GeckonCZ for implementing this feature.
How does this work?
When you create a listen server, which is done by starting a game via the "Create Game" option in the main menu, Sven Co-op will utilise Steam's NAT punch-through service to ensure a connection between a listen server and any connecting player can be made even through barriers such as firewalls and NAT configurations. Special network configurations to open inbound routes to people hosting listen servers will no longer be required.

This solves a common problem whereby home users cannot make their game connectable to players across the world, in particular to play with friends.

This should also eliminate the need for anyone to squat on public servers, whereby a (usually small) group of friends take over a public game server by vote-kicking anyone else that happens to join it so the group can continue to play on their own. This has been a big problem lately, and we hope this feature addresses this problem. -- We understand that groups of friends often like to play uninterrupted, so please spread the word about this feature!
Creating a game
This is enabled as standard providing that LAN mode is switched off. Anyone that knows your Steam ID can connect to your game as soon as you start one and are playing in a map. If you don't want this feature you have to explicitly turn it off by launching Sven Co-op with parameter "-nop2p".

Once you start your game it would be useful if you grab a copy of your Steam ID so you can hand it out to your friends. They will need to know this so they can join your game. You can see this using the "status" command in your console, or look for the line saying:

Initializing IP networking Local IP address: 192.168.56.1, SV port: 27015, CL port: 27005 Initializing Steam P2P networking Local SteamID: STEAM_0:1:12345678

Bare in mind that UDP/IP connectivity is still enabled as before, so if this always worked for you previously anyone can join still your game as it will appear in the server browser. Therefore you must still set a join password to keep your game truly private.

If you're playing over a LAN only you will not need this feature and can switch on LAN mode (CVAR "sv_lan" = 1) via the create game options form prior to starting.
Joining a friend's game
As these games do not appear in the server browser (even in the "Friends" tab) you first must know the Steam ID of the player hosting the game.

To find this out for someone in your Steam friends simply visit https://steamid.io/ and copy in the full URL to their profile, for example "https://steamcommunity.com/id/AdamR/". You can then copy the entry marked "steamID" of which will start with "STEAM_......", for example "STEAM_0:1:12345678".

Once you have found the Steam ID you can join their game using the "connect" command in the Sven Co-op console, for example:

connect STEAM_0:1:12345678

Other format of Steam IDs such as "steamID3" and "steamID64" will not work. Do not put quotes around the Steam ID.
FAQ
Is this true peer-to-peer?

Yes and no.

The initial connection is formed by using Steam's NAT punch-through service, which works by treating both host and joining players as two equal peers. Steam's service then tries to negotiate a way for these two players to form a direct UDP/IP connection. However if no direct route can be established Steam will use it's own relay servers to bridge the two players together.

However once the initial connection is established there is still a classic client-server relationship between the joined players and host player. Individually connected players will not have any direct communication with anyone apart from the host player, so if the host player closes their game, leaves it, or loses Internet connectivity it will drop for all joined players too. (There is no host swapping/migration.)

You can find more information about the technical workings of this here:

https://partner.steamgames.com/doc/features/multiplayer/networking
https://en.wikipedia.org/wiki/UDP_hole_punching



Is this slower / more laggy than a direct connection?

In principal when Steam's relay servers are used there would almost always would have a slight performance hit because of the additional routing/hops needed to bridge two player connections together. That being said Steam's NAT punch-through service and relay servers are generally accepted to perform very well and reliably, so there should be no appreciable quality loss with player connections. (Particularly as Sven Co-op is not competitive.) More benchmarking would be required to answer this question with certainty when Steam's relay servers are necessary.

This would not apply if the NAT punch-through service was able to form a direct connection between two players. Performance wise this would work just as well as a classic direct UDP/IP connection.



Does this keep my public IP address secret?

No.

If Steam's relay servers are used then your IP address wouldn't be immediately visible once the connection is established, but because NAT punch-through tries to form a direct connection before falling back to use relay servers this involves exposing what your public IP address is.

There is no option of which can force you to use relay servers only, and attempting to do this yourself by hindering NAT punch-through's direct connectivity won't help.

This applies to both the host player and joining players.



Can I ban players from joining?

Yes.

Just like before you can use the "banid" command to ban a Steam ID, for example "banid 0 STEAM_0:1:12345678".



Do we still need a VPN solution such as Hamachi?

No. The point of this is no special case networking by the user is required at all. Using a VPN solution will likely degrade performance vs a direct connection.

Using this connection feature will also be faster than a VPN solution such as Hamachi because the connections are as direct as can be. When falling back to Steam's relay servers is absolutely necessary it should be noted that these are purpose-built for linking up players using a game application rather than general purpose networking.



Does RCON work?

No.

RCON still depends on UDP/IP being directly connectable.

This is less likely to be needed as a real player will always be running the game.



Does this work with dedicated servers?

No.

Dedicated servers do not bind to any Steam account so there would be no way to associate a Steam ID with them. If this were possible it would also require you to have a separate Steam account, as the same Steam account can't be signed in AND actively using a Steam service (playing/hosting a game, using SteamCmd, etc) in two instances at the same time.

Direct UDP/IP is still required.
< >
65 Comments
Walter Mar 2 @ 4:34pm 
just click on your profile and click view my profile and click edit profile
Hail To The Sid Jan 28 @ 2:11pm 
you could just use the password thing when making a server
Spaghetti Jan 20 @ 8:49pm 
How do i find server ip

Raptor Gaming Official Jan 14 @ 11:24pm 
HELP HOW DO I LEARN SERVER IP
PMurple Oct 15, 2020 @ 11:00am 
You can invite your friends via discord too, thats how i play with my friends its pretty easy to do
MarviN Aug 31, 2020 @ 2:36pm 
My friend can't type or send messages in the chat. Is this normal?
Adambean  [author] Aug 24, 2020 @ 7:26am 
Yes you can use plug-ins on listen servers too. The installation instructions would be almost identical to doing the same on dedicated servers. One exception would be the "-dll" launch option if you're using Metamod -- that needs to go in your game's launch options via Properties in Steam.
atomicneutrino Aug 23, 2020 @ 2:35pm 
Is it possible to implement plugins, like EXP systems, buymenus, custom weapons?
I want to play with my friends with plugins.
P.S I'm not going to be suprised if I need to have a dedicated server.
the one and only burgeridiot Jun 18, 2020 @ 3:26pm 
my friend cant connect it says bad server connection