Multiplayer is desynchronized immediately from the start
Opened this issue · 5 comments
Multiplayer modes don't seem to work: starting a two player Harkonnen vs Atreides game:
results in an immediately desynchronized game starting state. The game host (player 1 / clb) sees seems themselves as Harkonnen:
However the remote player sees themselves as Atreides, but on their screen, they are located in the identical location as player 1, and from their point of view, all the units belong to Atreides and not to Harkonnen:
Both players can issue order to these units as if they were their own. The previous orders are forgotten, so the players can essentially fight over commanding the units.
Repeating a game start multiple times with predetermined houses Harkonnen vs Atreides, I do always get both houses starting at bottom right at the same spawn position with desync units.
If instead I choose Random starting houses, I do get a starting configuration where the two players do hold their own houses:
game host is randomized to be Fremen:
whereas remote peer sees themselves as being Ordos:
However looking at the enemy camp on both computers, the players are again desynchronized: game host misthinks that the enemy is instead Harkonnen:
and the remote player misinterprets that the game host would be Atreides instead of Fremen:
so the house identities seem to be independently randomized by the host and the peer, or something along to that effect.
Attempting to play the game in this desynchronized colors state quickly causes the game to desynchronize even more: in the scenario the host player got two reinforcements units:
However peeking at the same base at the remote peer, they have now desynchronized and do not observe those two reinforcement units to exist at all:
Attempting to do a combat between the two houses results in very desynchronized situation, where the movement of some units does replicate, but combat and destroying other units does not.
Was wondering whether this might be a recent regression from all the changes that went in (especially #31), so tried an earlier commit tag latest-x64
:
Revision: 561a9507e5ba6a95ebd48c40702c027d097d0d6f
Author: Henric Jungheim <software@henric.org>
Date: 04/06/2022 14.34.46
Message:
Set the right MSVC options for each build type.
----
Modified: cmake/setup/msvc-setup.cmake
which predates that change. Though the issue does persist there as well.
Tried also an earlier tag v0.96.4-0.1.4
, but that did unfortunately not build well on Windows (complained something about soxr.lib not found), so was unable to go farther in time to test for regressions.
The issue does NOT reproduce on the Sourceforge latest installation zip (dunelegacy-0.97.0alpha-windows10-x64.zip
) from https://sourceforge.net/projects/dunelegacy/ , but there 1v1 map North & South does start up correctly synchronized.
This could easily have broken years ago.
My first guess would be that the random number generator state isn't being shared properly.
Take a look at the log messages that look like so:
INFO : Created seed for "Default": 389b011c011d6e0a-5418f99f21c35bfd-5e9cebac3ea45860-d1953205b320382f-6d6fa30d0bdb2668-d483374a129442f5-ee6832ae365d711c-170a533cc5be6cb8
INFO : Setting RandomFactory seed to 389b011c011d6e0a-5418f99f21c35bfd-5e9cebac3ea45860-d1953205b320382f-6d6fa30d0bdb2668-d483374a129442f5-ee6832ae365d711c-170a533cc5be6cb8
INFO : Created state for "ADLPlayer": 76affffc89bf7f97-6889f7cc77b84ae5-72a183e3ed94bf22-83c8b20f70c3533b-6f9d4ae8ddaf05ac (from 389b011c011d6e0a-5418f99f21c35bfd-5e9cebac3ea45860-d1953205b320382f-6d6fa30d0bdb2668-d483374a129442f5-ee6832ae365d711c-170a533cc5be6cb8)
Most should match between participants in the same game ("UI" should not, since that random number generator is local).