Ribbon Maze

by H8UL

The maze itself is destined to be automated.

Overhaul
4 years ago
0.16 - 0.17
55

b Desync issues

5 years ago
(updated 5 years ago)

Dear HBUL,
I am experiencing desync issues in multiplayer with 17.0 experimental version.
We have narrowed down it to the ribbon Maze.
We have further narrowed it down to maze generation. We believe the maze might be generated non-deterministically on my machine and machine of my friend as we are playing multiplayer and that creates a desync.
The reasons
1) We first experience desyncs strongly at the start of a new game. After struggling for 15 minutes of the game, everything seems to stabilize and we could play for hours in our small area.
2) Once we started exploring further north, this time 5 hours into the game we experienced desync again. We could reproducibly get desync by going north. And we could avoid it by staying south.
3) We have ended up revealing the map in 1500 tiles around us with console commands. That removed desync issues.
4) Once we save the game on different machines and run it independently on two servers we seem to be getting differences in the map.

Please let us know how else we can help you help us with this issue.
We absolutely love your mod and Thank You for making it.
We will be so happy if we could leave the maze mysterious and not explored by not revealing it in advance to avoid the issue.
Best wishes.

5 years ago

What operating system do you use (Windows, Linux)?

And what operating system does your friend use?

5 years ago

I use Mac OS and he uses Windows.

5 years ago

This report is very, very useful -- thank you.

Another desync report here suggests that the maze generation has become os-dependent in 0.17: https://github.com/h8ul-modder/factorio-ribbon-maze/issues/38

This is likely to be down to the mathematical operations in the lua implementation on the various platforms.

The reason I implemented a new deterministic random number generator is (ironically) to allow the map seed to generate both the maze and other elements with a proper seed space, while avoiding desync issues.

However this relies on the lua implementations performing 32-bit operations the same on all platforms. They really ought to, because bit operations are well defined, but this is what you get when a scripting language chooses to treat all numbers as floating point: basic operations become more difficult to get right.

I have two ways to go.

1) Admit defeat and migrate to the factorio core's provided random number generator: https://lua-api.factorio.com/latest/LuaRandomGenerator.html -- it should work but would possibly lose seed space. I could ask the devs to explain why this random number generator gives the same numbers for similar seeds.

2) Figure out how lua has come to diverge, see if it can be worked around, and if not get the factorio devs involved. If it's a fundamental problem with lua I have to do 1 anyway: use Factorio's random number generator.

Here is a report I believe is related where maths in lua differs in non-portable ways: https://forums.factorio.com/viewtopic.php?t=62674

I need to do a bit more thinking and investigating, but I believe we are close to understanding the problem.

5 years ago

Thank you so much H8UL,
Thank you for being so quick and helpful.
The low level reconciliation of different lua implementations sounds hard.
What is loosing seed space? Why is it bad?
Best wishes,

4 years ago

This is believed to be fixed in 0.7.4 :)

To explain the seed space... Best way to think of to explain it: the game map seed is just one number, but all the possible maps are "more" and use more numbers.... And I need to be able to do more to generate all the different things in the maze.

New response