Source 2 networking

So - what’s the story with the networking layer?
I was wondering, is networking left up to Garry to implement or did Valve actually have something in place? To my knowledge only multiplayer Source 2 game is Dota 2, so not much is actually known about the s2 networking layer.

Yeah it has networking built in


I’ll direct rest of the thread to Source 2 General Question Thread since it seems to be better oriented for this sorta thing :slight_smile:

1 Like

I’m not sure my question is good for general topic, probably this thread is closer to it.
How about low level networking API, for example manage initial connection of players, will it be possible via C# based SBox API? This will be very useful for creating custom load-balancing (multiple servers with single lobby, or single point of connection for storing gamemode state when servers got crashed).
In gmod this is not trivial task required detouring and a lot of pain, where each update is a huge risk of breaking stuff.

We’d have to talk about specific needs

Balancing actually not a single use case. For example drop players before they will be processed to a server.
I don’t know about difference between gmod code logic and Source 2, but in gmod for above needs I have to detour CBaseServer::ConnectClient. Such API is not exposed to Lua in gmod, so will be nice to see something in sbox.

Should we be allowing players to join a server just to have the server immediately drop them though?

Ban system? That will be a nice idea to just not show server where you banned (in public server case), but it looks more complicated. Early drop is fine here, after player got verified through steam we can identify him.

Another case is to load player custom data (custom gamemode permissions, like admin systems) before actual spawning, but it’s related to old ConnectClient and events, which is probably already doable with existing API.

In case if dynamic map loading for client will be possible, that an idea to join in some sort of lobby server and be processed to specific map (private space for e.g.).
But my main idea was to have a dedicated server, which will manage player connections and redirect them within internal network to another game server instance once it got crashed or experience performance issues (within same gamemode running).

Depends of how many players will be supported in SBox for single server instance, it might be useful for making huge game worlds splitting them to multiple instances without forcing players to do manual reconnect. Like each sbox server will be responsible for different parts of it with single point of entry for target player.

1 Like

I can definitely give access to the connection routine so you can have the player wait at the loading screen with a status message while you prepare their spawn on the server.

I have a bit of a problem with other systems where you join a server then it redirects you to another server. I feel that these are problems we should be solving for everyone instead of putting the burdon on developers. You should really be able to create a 1v1 chess gamemode and have matchmaking just work, or a pubg type gamemode and have matchmaking just work.


I think in this case it’d be great to be able to make the servers not announce themselves to the master list and also have to mark servers that redirect to other servers as a matchmaking server.


The whole lobby concept for matchmaking is neat as it allows you to be in the game while you wait.

The alternative is the more traditional just stare at some UI and wait without being immersed and you’ll join the server when ready.

Can’t we support both? A developer ultimately has a choice to figure out which model works better for them.


A queue system would be a nice feature, but I’m assuming we could make our own if we have access to the connection routine?

I agree, and I would like if it was something like this:

  1. You select the gamemode.
  2. You press “Find match”.
  3. A prompt makes you choose which matchmaking service you want to use: here different servers that have a ranking/matchmaking system would pop up. Imagine a competitive shooter, there could be several separate matchmaking services kind of like CSGO with ESEA, Faceit and such, each one with separate rank systems meaning they would be their own ecosystem with different rules, ranks, etc.
  4. And finally you play.