Fix CommonSense meditation desync: host-authoritative sync#562
Fix CommonSense meditation desync: host-authoritative sync#562sviyh wants to merge 1 commit intorwmt:masterfrom
Conversation
Instead of disabling the meditation economy feature entirely in MP, replace it with a host-authoritative version. The host evaluates the joy/psyfocus thresholds and syncs the EndJobWith decision to all clients via RegisterSyncMethod, ensuring deterministic execution. The original postfix checked joy.CurLevel >= 0.98f directly on each client, but floating point drift caused divergent job endings that cascaded into full desyncs through PickUpAndHaul job creation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d0c9195 to
fa43e72
Compare
|
Some issues:
|
|
It might be. I'll dig a bit more. Somehow it fixed my problem. The code overall made sense to me but it might be due to the lack of understanding of the codebase on my side. |
|
Desync-1177.zip |
You don't know that. You're just guessing from the logs. For all you know, it could have been the Pickup And Haul call that caused the desync. But it doesn't appear in the client traces since it didn't trigger anything that tracing keeps track of. Or perhaps something else happened beforehand that desynced (but isn't tracked), and this is the first place that the tracing realized that something has happened. And as @Zetrith pointed out, this is not how synced methods work. You prevent execution for non-host, and the synced method won't get synced since it happens during simulation. So it'll only get called for the host. |
|
Oh, I see that the fix doesn't make any sense now - so I took it down. I am investigating if that was the growth moment that triggered while the pawn is in outpost from vanilla outposts expanded. Thanks to both for explaining and pointing out interface syncing specifics |
Summary
JobDriver_MeditationTick_CommonSensePatchpostfix evaluatingjoy.CurLevel >= 0.98fdifferently on host vs client due to floating point driftEndJobWithdecision to all clients viaRegisterSyncMethodJobDriver_Meditate.MeditationTickruns only on the hostRoot cause
Observed in desync log (map 19): CommonSense ended a reign/meditation job on the host (joy hit 0.98), triggering PickUpAndHaul's
CheckIfPawnShouldUnloadInventorywhich created a new job and consumed extra RNG state. The client's joy was slightly below threshold, so the job continued — permanent RNG divergence from that tick forward.Test plan
🤖 Generated with Claude Code