Mirror battle map difference

Moderator: rbodleyscott

Post Reply
JonJonJon
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 31
Joined: Mon Oct 26, 2020 6:02 pm

Mirror battle map difference

Post by JonJonJon »

This is from a MP game that has just started. Global warming?

Image

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

Very strange. Never come across that one before. Thanks for the report - it's a first.

Custom battle mirror matches use a seed number that should result in the same map being generated for each of the paired battles.

Only the seed number is stored, not the actual map, so it could fail to generate identical maps if either of you has modded their main build, particularly the map generation scripts, but also any scripts that might access the random number function before map generation is complete.

Perhaps one of you has modded their main build? (Which, of course, we strongly recommend against, because it breaks MP)

If anyone sees anything like this again, please report it.
Richard Bodley Scott

Image
gfs26
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 242
Joined: Fri Nov 23, 2018 12:44 am

Re: Mirror battle map difference

Post by gfs26 »

In a recent mirrored game between me (gfs26) and Lennard, it also happened...
But i don't have any screenshot. the battle ended yesterday, so maybe you can get it from MP games database.
I never modded any file of Medieval 2 (and i think the same is true for my opponent)
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

gfs26 wrote: Wed Feb 24, 2021 11:04 am I never modded any file of Medieval 2 (and i think the same is true for my opponent)
Would you be kind enough to ask him? I don't want to go delving deep into the code until it is confirmed that your opponents had no mods in his main build.

Also, did either of the maps have a coast or impassable river?

Was the terrain set to Pot Luck?
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

rbodleyscott wrote: Wed Feb 24, 2021 9:58 am Perhaps one of you has modded their main build? (Which, of course, we strongly recommend against, because it breaks MP)
Please could you check with your opponent and confirm that neither of you has any mods in their main build. I don't want to spend a lot of time delving into the code (which has apparently worked fine up till now, and still continues to work fine 99% of the time) until it is 100% confirmed that this has occurred in a mirror match where neither player had any mods in their main build.

Note that, as I say, the challenge information just includes a seed number. The map for each game is generated from that seed number by the scripts on the system of the first player to play in each of the games. If anything in the build alters the sequence of calls to the RNG, the maps will come out different. This could be caused by any difference between the codebase on the two players' system. The most likely reason for this would be a modded main build, even if the mod has no obvious connection with map generation.
Richard Bodley Scott

Image
gfs26
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 242
Joined: Fri Nov 23, 2018 12:44 am

Re: Mirror battle map difference

Post by gfs26 »

I just modified (not sure if i restored the original) the little file with zoom level (allow extra zoom on units).. i don't think this can have any impact on the code... As for my opponent, actually i don't have any new game running, so i can't ask him.
Looking at the screenshot above, also in our battle there was alake only in one of the mirrored map... the type of terrain was similar, but not equal (hills, wooded land... apparently the same landscape, but not equal to a detailed analysys)
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

gfs26 wrote: Wed Feb 24, 2021 2:40 pm I just modified (not sure if i restored the original) the little file with zoom level (allow extra zoom on units).. i don't think this can have any impact on the code...
Correct
As for my opponent, actually i don't have any new game running, so i can't ask him.
Please could you send him a PM. I don't want to go down a rabbit hole here if the problem is due to a modded build.
Richard Bodley Scott

Image
Quivis
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 46
Joined: Tue Apr 21, 2020 8:37 am

Re: Mirror battle map difference

Post by Quivis »

I’m playing the game with the “global warming” with JonJonJon. No file was modified on my part, I didn’t even download the community content. I’ve also verified integrity of my files, and everything is in order (no file was downloaded). It’s also the first time it happened to me.

BTW: our map is North European Agricultural (not Pot Luck)
JonJonJon
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 31
Joined: Mon Oct 26, 2020 6:02 pm

Re: Mirror battle map difference

Post by JonJonJon »

Can confirm nothing modified here either.
gfs26
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 242
Joined: Fri Nov 23, 2018 12:44 am

Re: Mirror battle map difference

Post by gfs26 »

Unfortunately i don't have his email... so i must wait until he accepts the pending challenge..
But maybe he could read this post here and so he will answer you question.
Sorry if i can't do more
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

gfs26 wrote: Wed Feb 24, 2021 8:26 pm Unfortunately i don't have his email... so i must wait until he accepts the pending challenge..
But maybe he could read this post here and so he will answer you question.
Sorry if i can't do more
You can send him a PM on this system. See top right of screen.
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

JonJonJon wrote: Tue Feb 23, 2021 9:35 pm This is from a MP game that has just started. Global warming?

Image

Image
The maps appear to be identical except one has a river and one has a coast. The position of all other terrain features appears to be the same. So at least we know at what point the map generation diverged.

And I am fairly sure I now know the cause of the bug, and therefore should be able to fix it. Though the fix probably won't go live until the release of the 1st DLC.

In the meantime it is worth noting that there really isn't a great deal of practical difference between the two maps. Either way, the part of the map beyond the river or coastline is largely unusable, and apart from the exact position of that impassable boundary, the terrain is the same.

For those that are interested, it is due to a global variable (gNoCoast) that determines whether a coast is allowed or not. If it is set to 1, then if the random factor says that there should be a coast, a river is generated instead. Global variables are not automatically reset when you start a new battle, this one is not reset by the map generation script. Therefore if one of the players had played a game where the gNoCoast flag was set by a previous game during the current session, his system would generate the map with a river instead of a Coast.

So in this casue, the cause is not the RNG getting out of synch (and hence not due to different builds), but is due to what battles the players may have played before they started their instance (i.e. the one in which they are side A) of this mirror challenge.

It doesn't happen often because
i) It only happens if the random map generator wants to generate a coast, and the gNoCoast variable tells it not to.
ii) That will only happen if the player has played a previous battle in the same session where the gNoCoast flag was set. And that will only happen in a very limited range of scenarios. (Such as Quick Battles, and on the first turn of Steppe or Desert battles)
Richard Bodley Scott

Image
JonJonJon
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 31
Joined: Mon Oct 26, 2020 6:02 pm

Re: Mirror battle map difference

Post by JonJonJon »

Terrain elevations are exact, there are slight differences in single patches of rough ground and trees. Subtle enough for neither player to spot at first. It wasn't until I zoomed out and saw the sea that I went to double check. But yes - for all intents and purposes it's nigh-on identical.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

JonJonJon wrote: Thu Feb 25, 2021 11:58 am Terrain elevations are exact, there are slight differences in single patches of rough ground and trees. Subtle enough for neither player to spot at first. It wasn't until I zoomed out and saw the sea that I went to double check. But yes - for all intents and purposes it's nigh-on identical.
As far as I can see it is pretty much completely identical except where terrain has been overwritten by water, or where random cosmetic details (such as individual trees and field textures) are added at a later stage, after the RNG sequence has been desynched by drawing the river or coast.

That is what led me to find the (probable) cause of the bug.

So thanks for your initial report and for all of your helpful answers to my queries.

The fix will go into the next iteration of the DLC beta.
Richard Bodley Scott

Image
Quivis
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 46
Joined: Tue Apr 21, 2020 8:37 am

Re: Mirror battle map difference

Post by Quivis »

rbodleyscott wrote: Thu Feb 25, 2021 11:59 am
JonJonJon wrote: Thu Feb 25, 2021 11:58 am Terrain elevations are exact, there are slight differences in single patches of rough ground and trees. Subtle enough for neither player to spot at first. It wasn't until I zoomed out and saw the sea that I went to double check. But yes - for all intents and purposes it's nigh-on identical.
As far as I can see it is pretty much completely identical except where terrain has been overwritten by water, or where random cosmetic details (such as individual trees and field textures) are added at a later stage, after the RNG sequence has been desynched by drawing the river or coast.

That is what led me to find the (probable) cause of the bug.

So thanks for your initial report and for all of your helpful answers to my queries.

The fix will go into the next iteration of the DLC beta.
Rough ground and trees are a bit different in the upper left part of the screenshots (near the place where cavalry and light troops are on the first screenshot).
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Mirror battle map difference

Post by rbodleyscott »

Quivis wrote: Thu Feb 25, 2021 12:22 pm Rough ground and trees are a bit different in the upper left part of the screenshots (near the place where cavalry and light troops are on the first screenshot).
True. That is random hilltop rough ground, rather than base level rough ground generated in the original pass. That random hilltop stuff comes later in the map generation process, after the RNG had been desynched by the River/Coast dichotomy. (Any part of the map generation process that came after the decision to make a river instead of a coast would be dysynched and no longer mirror).

Anyway, I am satisfied that the cause of the bug has been identified, and the fix is in for the next beta iteration.
Richard Bodley Scott

Image
gfs26
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 242
Joined: Fri Nov 23, 2018 12:44 am

Re: Mirror battle map difference

Post by gfs26 »

email sent to Lennard.. not sure if he usually visit this forum... but also in our battle, as i see in the above screenshots, even if maps are different, the nature of the map itself is not totally changed... tactical key elements are similar.
Post Reply

Return to “Field of Glory II: Medieval Tech Support”