438 Commits over 1,371 Days - 0.01cph!
SendRateMin/SendRateMax tweaks
Tweak default encryption settings
Tweak delta snapshot send mode
This should have same treatment as SteamLobbySocket to be thread safe
Fixed NRE in code upgrader for HostSync in scenario where no sibling Sync is found
Only add query flag is property was set to true - otherwise remove the query flag
Obsolete HostSync, add SyncFlag, add code upgrade / fix (#1729)
Fix Send Buffer Buildup and Unreleased Message Bug (#1727)
Fixed backward compat for Authority attribute when specifying NetPermission. Ensure networking is cleaned up after game leave so any last-chance RPCs can be sent.
Actually include stats from direct connection / dedicated server with net_debug on
Added Connection.GetStats support / implementation for non-lobby Steam connections. Can view net stats for connection to dedicated server or clients connected to dedicated server as well
Cluster Delta Snapshots - Improvements to Bandwidth, Max Snapshot Size (#1717)
Resolves issues with Steam networking choking.
Some safety in Connection.All (don't add any null values to output list)
Fix Owner/Host mode RPCs not sending to target. Fix issue w/ Rider intellinse when typing Rpc. in attribute
Don't need to update editor compiler if not running in the editor. Dedicated Server won't try to compile editor stuff
Fixed loading game from .sbproj with Dedicated Server that has libraries. Iterate any libraries in the project and add them as projects before compilation
PartyRoom uses SteamId. ConnectionInfoManager ensures we write party id as SteamId. Fixes being unable to join a game. Protocol++
Store last connection string globally for reconnect. Allows you to reconnect to your last server even when disconnected. Fix a bug where host changed may be called when not appropriate, such as an initial connection.
Fixed reconnect command
Set _ownerid before lobby owner transfer as well and pre-empt owner data change
Make sure go.Network returns network root network accessor like it did before (Fixes Facepunch/sbox-issues#7044)
Just return out if we're headless when shutting down user cursors instead of assert - fixes dedicated server not starting
Better handling for root network accessor
Fix network scene load race condition. Fix spamming Join Game trying to connect to a lobby after we're already in a game
Squashed commit of the following:
commit 8b28be7427ce545fc522cc32ba26825de66ec7db
Author: kurozael <kurozael@gmail.com>
Date: Mon Nov 25 11:51:06 2024 +0000
Make it easier for those who don't know the command line options to spawn their local instances in windowed mode ( https://files.facepunch.com/conna/1b2511b1/sbox-dev_sxEprjThtS.png )
commit 9429d94c3816fea2e354a24d33e89d632ff933cd
Author: kurozael <kurozael@gmail.com>
Date: Sun Nov 24 22:12:15 2024 +0000
Some exceptions to help diagnose issue
commit 7622f5f50e31b05c03bbaad55d0f5c8dac446c3d
Author: kurozael <kurozael@gmail.com>
Date: Wed Nov 20 15:26:19 2024 +0000
More cleanup, early out if disbaned or toxic
commit 0b484581c951969daed0cde3e51775ed0a0a4517
Author: kurozael <kurozael@gmail.com>
Date: Wed Nov 20 15:19:43 2024 +0000
Some cleanup
commit b76f3fa7dfa6b973d31424e79ca777652cd2e207
Author: kurozael <kurozael@gmail.com>
Date: Wed Nov 20 15:00:34 2024 +0000
More fixes
commit ff4ad7dfc4ec25125a1753aaf6a3470a3c0ce043
Author: kurozael <kurozael@gmail.com>
Date: Wed Nov 20 14:02:58 2024 +0000
Unique handshake id tests - if we restart a handshake its possible two could be running in parallel, this'll stop that
commit 8d7a08cff2c9641a3c96f5a777f89dbea5c1ba1f
Author: kurozael <kurozael@gmail.com>
Date: Wed Nov 20 13:32:08 2024 +0000
Testing with handshake process fixes if host changes during handshakes...
commit 301685cf930858a1074d3b3add085c52379f4664
Author: kurozael <kurozael@gmail.com>
Date: Wed Nov 20 12:49:27 2024 +0000
First fix map override task when using launcharguments.map
Fixed .config files not being added to appropriate string table for clients to receive changes
Simplify networking options in header bar in editor - drop down options in Network for Simulate Lag, Lobby Privacy
Auto Switch to Best Host Candidate (#1705)
Previously anyone could be assigned as a host when the host leaves. Now we'll score lobby members by their average ping and average connection quality to all other peers and use that score to determine who to give the host to.
When a host leaves, we'll try to find a good candidate and set the owner immediately first, but if that fails, it'll happen the next time someone is automatically assigned to be the host.
Previously, a connecting client could be assigned the host, but this is no longer the case as clients must be fully connected to be considered as a candidate.
In addition, we'll periodically attempt to find and change to the best host candidate. This particular behavior can be disabled per project or per lobby.
Set same tags for dedicated servers as lobbies for consistency. Fixed case when connection doesn't close properly.
Instead of the host crashing and disconnecting when a connecting user tries to send handshake messages with the wrong state, log it to console and kick them with a debug reason
Try to create lobby socket - if it errors and returns null, back out of creating the lobby
Make sure we clear removed and changed lists when resetting a string table
Make sure we disconnect properly if failing to create a Steam Lobby
AcceptConnection and Kick Support (#1698)
* Added INetworkListener.AcceptConnection( Connection, ref string reason ) and Connection.Kick( string reason )
* Added the kick command (can only be used by the host.)
Lobby Config / Friends Only Lobbies (#1696)
* Can optionally pass LobbyConfig to CreateLobby. Right now only contains LobbyPrivacy. Add LobbyPrivacy.FriendsOnly.
* Separate overload as not to mess with any existing game packages
* Make old CreateLobby method obsolete. Add LobbyConfig.MaxPlayers (defaults to package config.) Add LobbyConfig.Name (defaults to hostname for Dedicated Servers, or the owner's Steam Name for P2P)
* Fix lobby config max players
On Dedicated Server you can pass a path to a .sbproj with +game to load a local project. Hotloading works as usual for connected clients.
Keep the accumulator. Fix the issue properly.
Revert to old fixed update logic. It appears the root issue was synchronized server time causing more fixed updates than it should due to Time.Now changing. This resolves the issue I was trying to solve initially, and also fixes Facepunch/sbox-issues#6906
Resolve Fixed Update Issues
Resolves issue where Fixed Update would be called more times than it should be. Fixes issues such as in Marble Racer where if you had 500fps you'd move much faster than other players.
Update documentation for methods in INetworkListener to indicate that they're only called for the host.
Add net_fakelag ConVar. It's working for both Steam Networking Sockets and TCP / local instance. Can also be changed in the editor like this https://files.facepunch.com/conna/1b1211b1/sbox-dev_jpOfxVrwEr.mp4
Also commit this important file
Some changes to time sync. Seems to fix Facepunch/sbox-issues#6865 locally. Needs re-test.
Use AppIsDedicatedServer() to determine if should print warning log in texturebase. Don't run Panel.TickInternal if we're a dedicated server - makes no sense for Panels to even exist.
Make dedicated server console window title s&box Dedicated Server
We can omit this warning too if we're a dedicated server
Add +hostname support for dedicated servers. For now, just so we have a way of seeing them, bundle dedicated servers in with other lobbies when querying lobbies so they show in the lobby list for a game.
Dedicated Server Querying and Session Authentication (#1690)
* Authentication and encryption can now be enabled (by default)
* Session authentication is added for authentication tickets - this is what makes the player count go up on a server or down when they leave
* Dedicated servers use a Fake IP and can be connected to either by their Fake IP or by their associated Steam Id
* Dedicated servers can be queried from the master server using the GameSocketShare mode and so can now be fetched in-game for displaying in some UI later (Steam Server Browser does not display them due to using Fake IP)
* Added Rich Presence support for players who are connected to a dedicated server (and other players can join the game)
* Fixed some issues with headless mode such as when things were attempting to use ISteamFriends or some texture methods
* Stale connections are properly disposed of and cleaned up within a network system where in some cases before they were not
* Ensure that we disconnect from the network system when closing the game/app, this makes sure that the Steam Game Server is properly shut down
* Fixed / implemented Steam Game Server callbacks
* Moved Steam Network Sockets configuration to C# and set them in the right place now
* Ensure that we disallow a player to connect to a dedicated server if there are no player slots remaining
Don't try add menu project if we're headless
If we're headless, we should shut down SteamGameServer when disconnecting from network system
Pass actual version into SteamGameServer init for version. Test server list cmd
Update Dedicated Server bootstrap logs
Dedicated Server (#1679)
* Initial branch commit for dedi server message routing
* Try to synchronize Connection State through ConnectionInfo where possible
* Use Connection.All for filtered broadcasts so that will use ConnectionInfo if exists
* TargetedMessage support for byte[] array for already packed messages, and pass in NetTransmission flags for routing as well
* For now, one idea is to override SendRawMessage on MockConnection - for these type of Connection we can route through the host
* Store Connection internal state if ConnectionInfo doesn't exist then we can just use that
* Better synchronization of Connection State - now working as it was before, but should also synchronize other clients properly when on a dedicated server
* For filtered connection list / broadcast - if we're the host then use the connections we have, otherwise we should use Connection.All
* Include Connection with available connections when broadcasting - as Dedicated Server won't be included in Connection.All (maybe it should, or maybe people should just use Connection.Host)
* Serialize TargetMessage flags as byte
* system must be set to SendMessage to a Connection. Fix an issue with SenderId when receiving a TargetedMessage - this can't be local, so try to find the connection but if we can't find it just use the source.
* Test logs
* Some cleanup - fix issue where system isn't initialized so can't serialize. Could be wrong here, but only one system can be active so just use that.
* Remove this log
* Remove unusued code
* Add NetTransmission flag support when using SendMessage via Steam Sockets
* Don't forget to add arg to header
* Clearer docs here, only log warning if networking debug is enabled here
* Some tidy up here
* Reset local connection state to Unconnected when closing network system - some debug log for other machine
* Close these connections
* Remove this log
* Add Dedicated Server page to Project Config with its own option for a Startup Scene. When loading a game, if we're headless, use that if its set instead of the usual one.
* Don't call INetworkListener.OnActive for dedicated server, similarly don't call OnDisconnected. OnConnected will never get called anyway because it doesn't go through the handshake.
* This bit isn't needed actually
* Test boot back to main menu
* Properly get when disconnected
* Use CollectionExtensions properly
* Fix test, re-add system member
* Fix this state
---------
Co-authored-by: Garry Newman <garrynewman@users.noreply.github.com>
Fix exec command not working with spaces in dir for these csproj files
Run-DedicatedServer will load garry.scenemap instead of empty map / minimal for Walker
Added interp_debug ConVar and simple representation using sphere gizmos (white is the current interpolated position, cyan is the target position)
Added Show Interpolation Debug options to debugging menu and Game Debug context menus. Fixed toggle not working for Show Physics Debug in Debug menu (use ConsoleSystem.GetValueInt)
Prevent processing any snapshot information from an old owner. Ensure interpolation clear flag is sent when dropping ownership and interpolation is cleared when ownership is changed at all. This resolves a lot of issues in Walker when picking up / dropping / throwing objects.