Facepunch / sbox-issues

175 stars 12 forks source link

Hotload breaks games that use Network #4066

Closed PolSpock closed 1 year ago

PolSpock commented 1 year ago

Describe the bug

Hi,

Since a recent update on 27 September 2023 at 10A.M CEST, hotloading a game will create S&box craziness behaviour

It's problematic for developing game

To Reproduce

I've been able to bring you an easy way to reproduce : 1) Download & mount sbox-gunfight https://github.com/Facepunch/sbox-gunfight/ 2) Start "FFA - Small Town" image 3) Spawn bots to start game 4) Hotload the game (by editing a file) 5) The game starts to be crazy + if you try to restart FFA - Small Town you cannot play anymore with this spamming console error :

Could not proxy var 196636 as it does not exist in the network table
   at Sandbox.Internal.VarClass`1.Read(NetRead reader)
   at Sandbox.Internal.Var.Read()
   at Sandbox.NetworkTable.ReadAll(PredictionDataStore prediction)
   at Sandbox.Entity.UpdateFromNetwork()
   at Sandbox.Entity.PredictionStore(Int32 slot, Int32 command_num, Boolean network, Boolean variables)
   at Managed.SourceClient.Exports.Sandbox_Entity_PredictionStore(UInt32 self, Int32 slot, Int32 command, Int32 network, Int32 notnetworked)
   at NativeEngine.EngineGlobal.SourceEngineFrame(CMaterialSystem2AppSystemDict appDict, Double currentTime, Double previousTime)
   at Sandbox.EngineLoop.RunFrame(CMaterialSystem2AppSystemDict appDict, Boolean& wantsQuit)
   at Sandbox.SourceEngineApp.RunFrame() in C:\build\_work\sbox\sbox\engine\Launcher\SourceEngineApp.cs:line 46
   at Sandbox.SourceEngineApp.RunLoop() in C:\build\_work\sbox\sbox\engine\Launcher\SourceEngineApp.cs:line 37
   at Sandbox.Program.LaunchGame() in C:\build\_work\sbox\sbox\engine\Launcher\Launcher.cs:line 108
   at Sandbox.Program.Main() in C:\build\_work\sbox\sbox\engine\Launcher\Launcher.cs:line 58

The sandbox game doesn't have this issue, so i conclude that network replication on hotload is currently broken

Expected behavior

Hotload must not breaking game

Media/Files

No response

Additional context

No response

Metapyziks commented 1 year ago

There were some hotload fixes in the last day or so, can you still reproduce this issue on staging?

PolSpock commented 1 year ago

I just switched on the staging branch and validated files integrity image

And still have the same issue https://github.com/sboxgame/issues/assets/5229571/1974494c-3ab1-4600-9e0f-ccb0ddc85254

Metapyziks commented 1 year ago

I'll see if I can figure out why it's working on my end then.

PolSpock commented 1 year ago

I've just have :

1) Desinstalled my s&box, deleting my sbox folder in Steam\steamapps\common Then reinstalled s&box, removed my -allowlocalhttp -multiple_tools_instances startup command, switching to staging branch Then launched the S&box for init files. Then closing the game.

2) Downloaded sbox-gunfight-main, placed the folder in Steam\steamapps\common\sbox\addons Then launched S&box and mounted sbox-gunfight

3) Then restarted S&box in order to correctly load all assets mounted from the added game. Launched sbox-gunfight game, launched FFA - Small Town configuration.

4) Hotloaded GunfightGame.cs file with a simple CTRL + S without modification with Visual Studio Community Once again the sbox-gunfight game started to be crazy with spamming Prediction errors each tick :

 06:05:58  Client [Facepunch.Gunfight.PlayerController] Prediction Error Facepunch.Gunfight.PlayerController.CurrentEyeHeight (3.7333336 (predicted: 64) [tick:4998]
 06:05:58  Client [Facepunch.Gunfight.PlayerController] Prediction Error Facepunch.Gunfight.PlayerController.JumpWinding (True (predicted: False) [tick:4999]
 06:05:58  Client [Facepunch.Gunfight.PlayerController] Prediction Error Facepunch.Gunfight.PlayerController.TimeSinceJumped (169.06668 (predicted: 0) [tick:4999]

5) Restarted the game with the blue button image

6) To be saddened that the issue persists image

Metapyziks commented 1 year ago

I'm getting it now after a full rebuild, not sure what was going on there. Thanks for the repro steps!

Metapyziks commented 1 year ago

Should be fixed in staging after this builds, please let me know if it's still an issue.

PolSpock commented 1 year ago

it's perfect! thx! Any idea when the staging branch is merged to the main branch ?

Metapyziks commented 1 year ago

Updated the default branch for you now.

MrBrax commented 1 year ago

This started happening to me again, extreme spam with tens of thousands of could not proxy var logging and concommands that can't be overwritten.

Also complete breakage of networking systems and lag after multiple reloads. HUD duplicating over itself. Game menu completely breaking and becoming transparent.

PolSpock commented 1 year ago

This started happening to me again, extreme spam with tens of thousands of could not proxy var logging and concommands that can't be overwritten.

Also complete breakage of networking systems and lag after multiple reloads. HUD duplicating over itself. Game menu completely breaking and becoming transparent.

I'm on the 'no beta' branch and i haven't had any problems since the fix update Are you using Networable IDictionary which uses BaseNetworkable values? Because I have already made an issue about it https://github.com/sboxgame/issues/issues/2194

I will update this issue in a few days cause is still frustrating for me

EDIT: oh no you are right, I've just got the same issue as you explained i will find a way to reproduce it easily...

MrBrax commented 1 year ago

Thanks, thought i was going crazy because nobody else was reporting on it.