Replies: 3 comments 11 replies
-
Hi Aljoscha, We actually have started developing the mod with similar idea - make simulations run the same on different machines and sync user input afterward.
Of course there are options how to mitigate issues mentioned above but entire approach seems to be too fragile. I've a feeling that it is either working ideally (better than almost any other multiplayer approach) or falling apart due to minor differences (skipped event/several milliseconds difference/etc). So we have pivoted to an approach which requires a lot of work from developers but seems to be more tolerant to small differences: sync the most important things manually. Also don't take my word as is and feel free to contribute to mod and try your approach (or some parts of it) out.
If this is case - I would be happy to have your idea in the mod. Best regards, Vladimir. |
Beta Was this translation helpful? Give feedback.
-
So I ended up exchanging all Steamworks related parts with Valve's GameNetworkingSockets to be able to host and join independently from steam. I then used Sandboxie plus to run Steam (in offline mode) and ONI twice on the same machine. I ran some simple tests by comparing the log output of There are (mostly) no differences with respect to different hashes for the simulation. And because the metric compares hashes I cannot make a statement about the magnitude of the error. I guess I'll try to attempt to load the actual simulation state from a savegame and run simulations for a whole world in a controlled/isolated environment with the pinned random seed to see if there are any differences that were not present in my previous toy examples. Maybe I can figure out some more sources of indeterminism. |
Beta Was this translation helpful? Give feedback.
-
Is this feasible to do cross-platform? I'm worried if this might break compatibility with the native Linux version, and I don't have experience with native patching to know. |
Beta Was this translation helpful? Give feedback.
-
Okay so I played around with
SimDLL
a little (i.e. I wrote a small C++ program that loads SimDLL initializes it, parses the elements from the game's YAML files, generates a simple grid and runs the simulation for 10 iterations) and found out that there is a single random seed that is initialized once with the current time stamp. As we have the debug symbols (PDBs) for the DLL it was fairly easy to determine that there is a globalgSimData
where this is stored as a member calledrandomSeed
.So I attempted to locate that seed and set it to a fixed value. The result is that multiple instances of the simulation ran exactly the same and gave the same results. At least for the simple simulations I ran so far.
Have you considered to do something like that for this mod? Theoretically one could ensure that the simulation on all clients gets the same random seed as the server. Then all communication between the game and the simulation could be intercepted, so that everything that controls the simulation would be redirected through the server and the server broadcasts all simulation related messages to all clients. That way the simulations would (theoretically) run exactly the same on all ONI instances 🤔
Beta Was this translation helpful? Give feedback.
All reactions