Facepunch / sbox-issues

175 stars 12 forks source link

Client-Owned Rigidbodies Freeze upon a Player Leaving #6119

Closed agincel closed 2 months ago

agincel commented 3 months ago

Describe the bug

I've got a marble game - the Network Helper spawns a networked prefab for each client, and that client contains a Rigidbody sphere that is the marble they control.

If several players are in the game, and one leaves, something very strange happens. From each client's perspective, the other marbles seem to freeze in place. Sync variables still update, RPCs still fire, and the clients are all still connected, but no matter what I seem to do the rigidbodies are just permanently stuck.

I've tried a bunch of manual things like forcing a Rigidbody.Network.Refresh() from each owner upon a disconnection, at each round restart, and even just "do it every 30 seconds" but nothing seems to fix this state once it has started, except for quitting and rejoining. However, because quitting causes the problem to happen for everyone else, once someone leaves an instance is basically screwed until everyone leaves.

To Reproduce

  1. Play https://sbox.game/waveparadigm/marble_racer with at least 3 people.
  2. Have one person leave.
  3. Observe that for the remaining two players, their marbles (generally, it usually happens but isn't a 100% repro :/) are frozen with respect to each other.
  4. Note that in the log there are Log.Infos reporting that each client is manually invoking a Network Refresh (and also trying to clear then unclear Interpolation, just for fun), and the issue still persists.
  5. If the third player rejoins, both marbles will be fine on their client. Additionally, them joining/leaving occasionally causes single-moment updates to propagate where the frozen marbles will update their positions a single time.

Expected behavior

Players joining/leaving a lobby should not break rigidbody replication.

Media/Files

https://github.com/user-attachments/assets/e4f8d84e-c269-487f-af58-d78170a5946c

Additional context

No response

agincel commented 3 months ago

(In the attached video, note that this only happened on one client and not both, as one had joined after the first player left and the other had not)

agincel commented 3 months ago

01:03:44 Generic Skipping message from Nimbus, deserialize error (Failed to read Sandbox.BytePack+Identifier)! 01:03:44 Generic Got packed null message from Nimbus! 01:03:44 GameMenu Enable interpolation refres. 01:03:45 Generic Skipping message from Nimbus, deserialize error (Failed to read Sandbox.BytePack+Identifier)! 01:03:45 Generic Got packed null message from Nimbus! 01:03:48 Generic Skipping message from Nimbus, deserialize error (Failed to read Sandbox.BytePack+Identifier)! 01:03:48 Generic Got packed null message from Nimbus!

Last time this issue happened to me in the editor, the log saw a bunch of these for one of the players who became permanently frozen.

kurozael commented 3 months ago

I think this is resolved?