Skip to content

Desync in JobDriver_ConstructFinishFrame (Rand.Value RNG divergence with Mech_Constructoid) #975

Description

@VanDarkh0lm3

Summary

A client desyncs with Wrong random state on map when a Mech_Constructoid (Biotech DLC) executes JobDriver_ConstructFinishFrame. The client desynced 3 times in a row on the same map within ~3000 ticks. Reproduced with 3 players, 2 maps, async time off.

Reproduce

  • 3 players, 2 maps, no async time, no multifaction
  • Have a Mech_Constructoid actively finishing construction frames
  • Client (not the Constructoid's owner) desyncs when the Constructoid's JobDriver_ConstructFinishFrame ticks

Cause

The first and only divergence point is a single Rand.Value call in JobDriver_ConstructFinishFrame.<MakeNewToils>b__1. All 40 context traces before it have identical hashes between local and host.

Call stack (trace 777, tick 3266138):

Rand.get_Value_Patch1
  -> JobDriver_ConstructFinishFrame.<>c__DisplayClass8_0.<MakeNewToils>b__1
    -> JobDriver.DriverTickInterval
      -> Pawn_JobTracker.JobTrackerTickInterval
        -> Pawn.TickInterval_Patch1
          -> Thing.DoTick
            -> TickList.Tick
              -> AsyncTimeComp.Tick

Measured

Local Host
Hash 1150931754 1150931751
Entity Mech_Constructoid502450 Mech_Constructoid502450
Faction 16 (Player5616) 16 (Player5616)
Tick 3266138 3266138

Hash differs by only 3, but the sync field diverges significantly (155900486523175166 vs 155900482228207870), indicating different RNG state at call time.

Present on 0.11.5+4a3be27-dirty. Game has third-party mods installed, but the offending call path (Rand.Value -> JobDriver_ConstructFinishFrame) uses only vanilla RimWorld + Multiplayer code.

Desync report: Desync-137.zip (attached to this issue in comments or available on request)

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions