Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bioferite harvesters cause desync #447

Closed
twothe opened this issue Apr 20, 2024 · 7 comments · May be fixed by #489
Closed

Bioferite harvesters cause desync #447

twothe opened this issue Apr 20, 2024 · 7 comments · May be fixed by #489

Comments

@twothe
Copy link

twothe commented Apr 20, 2024

If Bioferite Harvesters are full, they will cause a desync when trying to give a job to clear it. This can be avoided by disabling automatic extracting and by emptying them manually.

@DwlufveX
Copy link

Yes, I'm also having this issue, in the case of having Bioferite Harvesters in both worlds, the time starts to be out of sync, tried turning off auto-harvesting, but it still doesn't work, please fix it in time!thanks!

@SokyranTheDragon
Copy link
Member

Any more info? I've just tried it myself and it seemed to work fine on my end.

@Spodi
Copy link

Spodi commented Apr 23, 2024

I suspect the the holding plattform / harvester too. Current save desyncs as soon as I join. Here are the last few log sadly I wasn't host, but maybe it helps too.
Desync-253.zip
Desync-252.zip
Desync-255.zip
Desync-254.zip

@twothe
Copy link
Author

twothe commented Apr 23, 2024

Any more info? I've just tried it myself and it seemed to work fine on my end.

I am not perfectly sure, but it feels like it needs a few more holding cells + harvester. We didn't initially have an issue, however later when we had like 10 entities captured it was a guaranteed desync every single time.

I attached the save, maybe it helps.
Mit Lama.zip

@DwlufveX
Copy link

As the host, I have encountered some issues in version 1.5, such as capturing invisible creatures. The capture is normal only when the host is present. However, when there is both a host and a client in the server, the capture becomes desynchronized. I have not yet tried to determine if this issue is caused by other mods, and I will provide further updates after investigation. Regarding the harvester issue, I have tried using only the multiplayer mod. Everything was normal before building the harvester, but desynchronization issues occurred during harvesting once it was constructed. Currently, I have started a new save and am conducting tests. If I encounter the issue again, I will provide the save file and logs. Thank you.

@twothe
Copy link
Author

twothe commented Apr 24, 2024

I have the same 100% desync on capture issue, however I think it is helpful for the devs if there is one issue per issue. Otherwise they have to search through all the issues to find them.

@DwlufveX
Copy link

Yes, you're right. We should open another issue to discuss this problem, thank you for the suggestion. Also, I'm glad to know someone else has encountered the same issue.

SokyranTheDragon added a commit to SokyranTheDragon/Multiplayer that referenced this issue Jul 6, 2024
The method calls random whenever the mote is null or destroyed. There may be situations where the mote ends up being created late or destroyed for some players, but not the others. This is guaranteed to happen when playing with multiple maps, and seems like it may happen when the game is not paused when someone is joining.

Since the desync happens due to RNG call to randomize the mote position, this change should fix it by pushing/popping the RNG state before/after the method is called.
MatanRad added a commit to MatanRad/Rimworld-Multiplayer that referenced this issue Jul 10, 2024
Fix desyncs due to CompCableConnection motes, fixes rwmt#447
SokyranTheDragon added a commit to SokyranTheDragon/Multiplayer that referenced this issue Jul 29, 2024
This should fix rwmt#447, rendering rwmt#481 unnecessary. I've decided to still leave that code as an extra safety precaution, but it should be now safe to revert those changes.

First, FixNullMotes patch was moved from generic "Patches" to "Determinism", as the patch itself changes some non-deterministic behavior.

As fot the changes, this should fix issues with Bioferrite Harvester and Electroharvester cables not creating motes after switching maps.

The current `FixNullMotes` patch would create a single mote per mote's `ThingDef.thingClass` and then reuse it. It ensured that the call to `MoteMaker.MakeStaticMote` never produced null, however the mote itself was more of a dummy mote (not initialized with any data).

This caused issue with the cables that would periodically attempt to spawn motes. If the mote would not be possible to spawn (drawn off-screen/on a different map), the MP patch would return the cached mote. The cable connection comp would then keep that mote forever, as it can only discard it if the mote is null or destroyed (which would never happen with the dummy note). Because of this, our dummy mote never ended up being discarded by the comp making the cable never draw another mote.

This PR ensures this doesn't happen by reworking "FixNullMotes" to actually spawn the motes, rather than returning a dummy mote. This is done by:
- Setting `makeOffscreen` to true in a prefix, skipping current map check
- Adding `& false` to `MoteCounter.Saturated` calls, allowing to spawn motes even if the mote counter is saturated
The check for off-screen motes was left as-is, as that one should be deterministic and safe.

Additional change call `Initialize` for both `Building_BioferriteHarvester` and `Building_Electroharvester`. Without it, the cables for those 2 aren't created after loading into the game (they're only created when rendered or a connection is added/removed). Since the cables aren't created the motes can't be created either, causing a discrepancy between players (unless they all had the cables created at the same time).

A final note on the original patch - it seems that it was made to fix desyncs caused by motes spawned by `CompAbilityEffect_Waterskip` (and potentially other issues at the time, but I can't find any mention of those). However, this specific issue seems to no longer be relevant as the waterskip now uses flecks rather than motes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants