Deaod / UTComp

A mutator for UT2004 featuring warmup, brightskins, hitsounds, and various other features.
GNU General Public License v3.0
19 stars 12 forks source link

fix issue with netcode breaking in second round in ONS and AS gametypes #10

Closed zenakuten closed 10 months ago

zenakuten commented 10 months ago

In Assault and Onslaught game modes, during the second round transition the game types call RoundHasEnded() for all controllers. This includes the Timestamp_Controller. This causes the netcode to break in second round. The RoundHasEnded() calls Pawn.Unpossessed() and the controller Destroy()s itself. This results in the Timestamp_Pawn running on the client to become detached and Tick() stops happening. When that happens the Timestamp is no longer updated and the NewNet weapons cannot find the correct collision copy due to bad timestamp.

For whatever reason (engine bug in native ControllerList?) RoundHasEnded() cannot be overridden in Timestamp_Controller. The overridden function is never called. The base method is always called. So to fix this we:

  1. Add a function on clients 'ClientResetNetcode' which deletes the existing Timestamp_Pawn.
  2. Add a Reset() function to MutUTComp which is called when resetting the level without restarting. This function calls ClientResetNetcode for all clients, and then deletes the server side Timestamp_Pawn and Timestamp_Controller.
  3. Finally, we add bstasis=false flag to Timestamp_Pawn so that tick() still gets called when the new timestamp_pawn gets replicated. This does not seem to be needed for the bNetInitial replication of Timestamp_Pawn, but subsequent replications do need it or Tick is not called on clients.
Deaod commented 10 months ago

Thank you very much.