Rubber Ducky


A recipe that requires 1 of all craftable items in the game. As everyone knows, rubber duckies are notoriously hard to produce. How many RDPM can you sustain?

Content
5 months ago
1.1
668

b Descync when player joins after

5 months ago

We've encountered desync issue when player joins the server after sweatshop was built and animation for new duck is finished.

Steps to reproduce:
1. Start multiplayer game.
2. Build ducky sweatshop.
3. Join with 2nd player (or leave and rejoin if it's headless server).
4. Craft the duck and wait for animation to finish.

I've recorded video on new map with minimal set of mods. I've used Editor Extensions to quickly build the duck (aggregate chest + super fast inserter).
https://www.youtube.com/watch?v=0iXKbmXncFE

5 months ago

I guess I've never finished the title and made a typo. Classic me!
Should be: "Desync when player joins after sweatshop was built"

Save file: https://downloads.koziolek.biz/factorio-minimal-rubber-ducky-desync.zip

5 months ago

It would seem like red-wizard-utilities.lua:93 modified the file scope variable whenever a sweatshop is build. Which will have happened for people on the server but not for those that joined after the fact. So whenever onTick modified the machines inventory it will cause a desync, since the code will have run for those people present on the server before the sweatshop was built, but not for those that were not present (as onTick is pretty much a no-op for them).

Afterwards the game state is different for the players and they get thrown out.

5 months ago

Thanks for the tip of what's happening. I don't play multiplayer, so haven't run into this. I'll see if I can find a solution.

5 months ago

Using file scope local variables (that are not based on global shared game state) and basing decisions on them will cause desyncs.
Refer to https://wiki.factorio.com/Tutorial:Modding_tutorial/Gangsir#Multiplayer_and_desyncs and https://lua-api.factorio.com/latest/auxiliary/global.html
Anything that decides future game state needs to be stored in global or be backed by global.

You either want to make sure that you find every sweatshop on initialize, and then keep it up to date with the events, or simply store the things you need to base decisions on inside the global table.

[deleted message]
5 months ago

Yeah, I've got that data moved to global, just need to test, so trying to get a second install set up.

5 months ago

Ok, I think I have this fixed in the latest version. Let me know if you continue having any issues.

5 months ago

Fyi, if you want to test things quickly, turning Rubber Ducky Debug on in the startup settings will make the ducky take only 6 ingredients (3 parts of 2 each).

5 months ago

Works perfectly on test save. Thanks guys!

New response