399 Commits over 1,341 Days - 0.01cph!
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.
Fixed query mode Sync vars
Fix error in OnChangePropertySet if the new value is null
[Hide] IsValid on Resource so that it doesn't show Is Valid tickbox in inspector for game resources
Fix Close On Launch not being saved properly in Startup Window (Fixes Facepunch/sbox-issues#5718)
Fix logs being cleared too late when Clear Console On Play is checked (Fixes Facepunch/sbox-issues#6103)
Use safe scale in Transform.ToLocal and Transform.PointToLocal so that it cannot produce NaN or infinity values. This fixes a bug where a child of a parent with a scale of 0,0,0 cannot set position programatically without the position being infinity. It should also fix any other issues with NaN values where ToLocal is concerned (such as GameTransform) in cases where any component of scale was 0.
Don't invoke change callback when loading or deserializing (Fixes Facepunch/sbox-issues#6406)
Make sure CodeGen is using global:: for everything - add a unit test to confirm
Put LONG obsolete method back again so tests pass because someone is still using it (grr)
Restore functionality to clear interpolation over the network with new system
Re-instate these long-obsolete methods for now because something is still using one of them :(
Ensure last update is sent properly when ownership changes (Fixes Facepunch/sbox-issues#6394)
Move ChangeAttribute back to Sandbox.System but put the callback in Sandbox.Game so we don't break anything.
Upgrade ChangeAttribute to support any property not just for [ConVar], so it now works with [Sync], too. Move ChangeAttribute to Sandbox.Game so it can use TypeLibrary for CodeGenerator wrapped property stuff. Resolves Facepunch/sbox-issues#6386
More accurately synchronize Time.Now between clients. Fixes Facepunch/sbox-issues#6326 (at least with the repro they attached.)
Fixed Sync attribute / CodeGenerator wrapped properties ignoring existing modifiers (Fixes Facepunch/sbox-issues#5867)
Delta Snapshot Slots (#1660)
Only run logic in SceneNetworkSystem.OnBecameHost if scene is valid - we could just be in a lobby/party but not in-game
If GameObject isn't valid when trying to call an RPC, call the method anyway but only if we can determine that we have permission to do so - this way we can ensure RPC methods are still not called when they shouldn't be for any given user. (Fixes Facepunch/sbox-issues#6270)
Fixed an issue where if you're Small Fish and disconnect yourself from a created lobby immediately by calling GameNetworkSystem.Disconnect in OnLoad, a TCP socket would remain open preventing you from starting a lobby again. This is because Disconnect is called before the asynchronous method CreateLobbyAsync has finished, so it goes and adds/creates new sockets that never get closed.
Idea for custom writing / reading data to snapshot per component (if it overrides those methods)
Some docs
Explicit ISnapshotWriter interface
Read snapshot immediately - no need for this prop
Dispose ByteStream properly
Rename to INetworkSnapshot
Component.INetworkSnapshot - improve some docs
Fix deserializing across network when GameObject reference on a property doesn't exist on the receiving end
Better warning messages on unknown component / gameobject for RPC - try to log the RPC method name, and if unknown component the GameObject name
Don't need to use the RPC filter here this should fix Tony's issue - doing a check inside the RPC callback anyway
Fix parent setting, flush for appropriate game object only, ++
Add undo support / unsaved changes to advanced network settings
Clearer logic for these flags
Only log this message if networking debug is on
Re-enable Nagle by default, Protocol++
Component RPCs sent Id instead of type name string allowing RPCs from multiple components of the same type. Protocol++
Make sure we do include reliable transform update when changing ownership
Squashed commit of the following:
commit 76f039bef3ee819f4b5e0b34179223405196d5bd
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 15:50:41 2024 +0100
Cleanup
commit 7559957d809b94986d20f93f417f69194138782a
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 15:43:55 2024 +0100
Some logs
commit ed9cb58705a97c3889d8d7a4ef97d8895b93dc98
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 15:04:35 2024 +0100
Remove debug log
commit 91c006383091050f87ac0a75b70df02e9ac17498
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 14:54:41 2024 +0100
Remove debugging - fix spike when flushing pending updates
commit a681e665208d87bc99c82ffb9865abc24365caa5
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 14:43:32 2024 +0100
Fix flags
commit 5eee6683b66a3b38390605a1f7ba72aaf51cc68a
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 14:34:28 2024 +0100
More debug
commit f35802593b1e9af772bf91a3eb451cb6c1c6dc3a
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 14:30:52 2024 +0100
Debugging
commit 42e0e1d3d06f4cce830c530e7b2e3943b94921e4
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 12:52:35 2024 +0100
++
commit d2402c9253ef520bdea0b141a393d0baa72a8d82
Author: kurozael <kurozael@gmail.com>
Date: Tue Aug 6 12:46:25 2024 +0100
Initial commit
Actually log the result code from SendMessageToUser so can debug issues here
NetworkSpawnRemote after all NWOs from snapshot deserialized but before callback batch to ensure references exist ( Fixes Facepunch/sbox-issues#6086 )
Add global:: to generated code for attributes with CodeGenerator ( Fixes Facepunch/sbox-issues#6055 )
Branch for experimenting and fucking around with networking w/ diagnostics
Test trying to reduce packet sizes a lot
Only do parent rpc if we're network root
Change order here
Go back to reliable test
Test
Reduce initial size
Test unreliable again
Unreliable transform updates test
Prevent calling Msg_ClearInterpolation for ourselves
Fix
drop older updates
Fix
Remove this log
When flushing pending updates before RPC calls - send reliable transform update
Move net stats drawing out into system
Only flush pending updates on reliable RPCs
Some docs
Don't call set parent if we called the rpc
Call these flags Transmission maybe
Some refactor, try to branch out with convar where possible
Make internal for now
Remove net_experiment convar
Network protocol++
Send if unreliable anyway - should be acceptable it'll either drop or not