interesting savegame to debug

Modding, Map Editor, IES Scripting and Other Questions
Post Reply
Magista
Posts: 3
Joined: 07 Mar 2018, 18:26

interesting savegame to debug

Post by Magista »

I wanted to share this EE2X savegame with you. It is super laggy and will crash after some seconds for unknown reasons. Maybe someone can debug it or it will help for the next unoffial update to improve.

Link: http://www.mediafire.com/file/p03wvrbh1 ... econds.sav

User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: interesting savegame to debug

Post by Dr.MonaLisa »

Hello Magista.
Thanks for your save.

I checked the file. The performance looks "normal" for EE2; AOS. You can read more about the lags problem at: https://www.ee2.eu/help/#lags

The game seems to hang when AI player "Pericles" reaches epoch 10. However, I did several tests to see if that's the case. I switched to the AI player and cancelled epoch-up process. The game still hanged. I also attached a debugger to see where game "loops", and I found out that it's close address 51360972.
The problem seems to be:

Code: Select all

CALL DWORD PTR DS:[<&api-ms-win-core-synch-l1-2-1.WaitForMultipleObjects>]
A function that waits for some other thread to finish.
Detecting what exactly is the problem would be extremely hard, so I'm unable to fix it :(
I did tests to see if it could be related to the last UP1.5 updates, but the problem seems to be present even on a version from 2016.

For me it seems like a very rare problem.
Could you please tell me if it ever happened to you in a different game, on a different map (not from this save)?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Magista
Posts: 3
Joined: 07 Mar 2018, 18:26

Re: interesting savegame to debug

Post by Magista »

Hello Leader,

the problem never happened before if I remember correctly.

For the lag problem in general: Wouldn't it be possible for you to finally tackle the AI lag problem by doing some reverse engineering with IDA or x32dbg to change the AI refresh ticker rate and also replace the bad waypoint finding algorithm with a more efficient one like dijkstra's shortest path algorithm ?

By the way, thank you for your invalueable efforts !
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: interesting savegame to debug

Post by Dr.MonaLisa »

Replacing "waypoint finding algorithm" sounds impossible. I had problems changing 1 button behavior, and this is something advanced that would require years of work and much more advanced assembly knowledge.

AI problems are not something that is really worth focusing. I understand that there are many players who like this mode, but... I personally almost never play against AIs. I like to improve things that I personally use, and since I only play Multiplayer, any work that is AI-related makes me tired.

I'm not saying that I didn't try to do something with this problem. I tested a lot of game saves trying to detect those periodical hangs (every 30 secs or so).
I even extracted a list of AI configurable values:

Code: Select all

//g_strategicAIAttackArmyBattalionUpdatePeriod=1
//g_AIAttackRallyFrac=0.5
//g_AIAttackNewTargetRange=16
//g_AIAttackMoveBuffer=16
//g_AIAttackEnemyClusterDist=6
//s_AIAttackRecalcEnemyPeriod=12
//s_AIAttackAllowExcessiveWarnings=0
//g_AIBattalionAttackBaseUpdatePeriod=0.5
//g_AISiegeRallyDist=12
//g_AISiegeDefenseUpdateTime=20
//g_AISiegeRallyFrac=0.5
//g_AISiegeTowerRange=2
//s_AISiegeTooFarFactor=1
//g_AISiegeNewTargetRange=24
//g_AISiegeCapturers=2
//s_AISiegeLowArtillery=2
//g_AISiegeTargetPathDistTooFar=96
//s_AISiegeMinCapturers=5
//s_AISiegeImpatientTime=60
//g_AIBattalionCaptureTerritoryUpdatePeriod=0.5
//g_strategicAIDefendBaseBattalionUpdatePeriod=2
//g_AIDefendBaseBadTargetMultiplier=2
//s_AIDefendBaseImpatientTime=60
//s_AIDefendBaseTooFarRallyMult=3
//g_strategicAIExploreBattalionUpdatePeriod=1
//g_AIKamikazeUpdatePeriod=0.5
//g_AIKamikazeNewTargetRange=16
//g_AIKamikazeRallyFrac=0.9
//g_AIKamikazeRallyDist=8
//g_strategicAIPatrolBattalionUpdatePeriod=1
//g_strategicAIShoreBombardBattalionUpdatePeriod=1
//s_AIBombardNewTargetRange=1
//s_AIBombardRallyDist=8
//s_AIBombardRallyFrac=0.5
//g_strategicAIStartCityBattalionUpdatePeriod=0.5
//g_AIBattalionTakeHotspotUpdatePeriod=1
//g_AIHotspotNewTargetRange=10
//s_AITradeUpdatePeriod=5
//s_AITradeMinThreshold=200
//s_AITradeMaxThreshold=500
//s_AITradeDiffRatio=15
//s_AITradeMaxTradeInHundreds=10
//s_AITradeAlliedBoost=2500
//s_unitAIVisibilityUpdatePeriod=1.5
//s_unitAIVisibilityUpdatePeriod_Fast=0.5
//s_AIDiplomacyProposalRememberTime=30
//s_AIDiplomacyBrokenTreatyRememberTime=120
//s_AIDiplomacyInterProposalTime=300
//s_AIDiplomacyProposalUpdateTime=60
//s_AIDiplomacySurrenderCheckTime=60
//s_AIDiplomacySurrenderRejectedCheckTime=300
//s_AIDiplomacyLosingAllyBoost=10
//s_AIDiplomacyLosingStrength=0.75
//s_AIDiplomacyAllyPreferredStrength=0.3
//s_AIDiplomacyCloseStrengthAllyBoost=8
//s_AIDiplomacyReallyStrongStrength=2.1
//s_AIDiplomacyReallyStrongBoost=6
//s_AIDiplomacyTraitorFactor=6
//s_AIDiplomacyHumanHasTooManyFriends=4
//s_AIDiplomacyTributeBoost=0.01
//s_AIDiplomacyUnitTributeBoost=0.1
//s_AIDiplomacyAllyThreshold=5
//s_AIDiplomacyMinBribeAmt=100
//s_AIDiplomacyBetrayalFrac=0.6
//s_AIDiplomacyTimedAllianceMin=5
//s_AIDiplomacyTimedAllianceMax=30
//s_AIDiplomacyResourceTariffFactorMin=5
//s_AIDiplomacyResourceTariffFactorMax=15
//s_AIDiplomacyResourceTariffMax=75
//s_AIAlwaysAcceptsDiplomacy=0
//s_AIGatherUpdateResourceInterval=5
//s_AIGatherUpdateDistributionInterval=10
//s_AIGatherTechGarrisonFrac=0.5
//s_WallEdgeStateUpdateInterval=15
//s_wallRadius=20
//s_AIWallBuildThreatThreshold=15
//s_AIWallBuildAdjacentStartedBoost=1.5
//s_AIWallMinGateRadius=2.7
//s_AIWallMoveForAutogateDistSq=9
//s_AIWallSplitEdgesWhileRoading=0
//s_AIWallMaxSplitCallDepth=5
//s_AIBridgesAttackCloseDistSq=225
//s_AIBridgesUpdateInterval=60
//s_AIBridgesTargetUpdateInterval=240
//s_AIBuildHintCoastsPerUpdate=100
//s_AIBuildManagerUpdateInterval=1
//s_AIBuildManagerNoUnitUpdateTime=60
//s_AIRoadsUpdateInterval=180
//s_AIRoadsForceUpdateInterval=420
//s_UnitPlacementConstantValidityUpdate=1
However, changing any of them didn't really change performance. It might be something much more hardcoded.
Anyway, if you would like to try it, you can edit file: "myconfig_sim_EE2X.cfg" from your EE2 folder, and then try adding and modifying values mentioned above, for example:

Code: Select all

//g_AIKamikazeUpdatePeriod=0.5
to

Code: Select all

g_AIKamikazeUpdatePeriod=2
I doubt any changes would help, since it's just a code optimization problem.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: interesting savegame to debug

Post by Dr.MonaLisa »

Hello Magista.
I have received another report from an EE2: AOS player, who experiences the same hanging issues.

Could you please tell me if you played more games and if this thing happened again?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Magista
Posts: 3
Joined: 07 Mar 2018, 18:26

Re: interesting savegame to debug

Post by Magista »

Leader wrote: 15 Mar 2018, 17:34 Hello Magista.
I have received another report from an EE2: AOS player, who experiences the same hanging issues.

Could you please tell me if you played more games and if this thing happened again?
This thing did not happen yet again. I will post here if I encounter it again. Thanks for your hard work !
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: interesting savegame to debug

Post by Dr.MonaLisa »

Hi.

Just to update this topic. This problem has most likely been fixed in Unofficial Patch 1.5 updates in September / October 2019:

https://ee2.eu/patch/changes/#157019
— Fixed game freezes/hangs:
* Symptoms: The game was frozen, image didn't change, mouse pointer didn't work, but sounds still played. In case when Task Manager was not open in the "Always on top" mode - users were forced to restart computer in order to kill the game process.
* Cause: Unknown function in game process loops forever when a float variable is greater than "5.5".
* Fix: Unofficial Patch 1.5 detects the freeze, overwrites the float to "5.5" and displays a debug message on the chat in game. This message will be removed in further releases of the patch, when reliability of the fix is fully tested.
* This bug was not caused by any of the previous UP1.5 updates. It was also present on the official version of the game and occurred randomly. Due to increased population / resources / map size possibilities in UP1.5 it could be experienced more often.
https://ee2.eu/patch/changes/#157020
— Improved the fixes for game freezes/hangs:
* Those freezes were most likely caused by game sounds, which in case of long loading time caused the function to hang completely.
* The new fix doesn't use the float comparation, instead it checks for the address changes during the 2 seconds timeout (based on the system time). It helps to prevent execution of the fix when not needed.
https://ee2.eu/patch/changes/#157022
— Improved the fixes for game freezes/hangs:
* Fixed "Out of Sync" in Multiplayer games, due to Anti-freeze unnecessary activated. It's because in rare cases 3-steps freeze verification was triggered (address, value, time) at a different loop, even after the problematic function passed. I added an extra variables reset function, when the loop passess, to make sure it never happens in the future. Thanks for the report and providing test files to players "skoot" and "lonewolf".
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Post Reply

Return to “Questions”