interesting savegame to debug

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
Post Reply
Magista
Posts: 3
Joined: 07 Mar 2018, 18:26

interesting savegame to debug

Post by Magista » 07 Mar 2018, 18:33

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
Leader
Dr.MonaLisa
Posts: 7037
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: interesting savegame to debug

Post by Leader » 07 Mar 2018, 22:08

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)?

Magista
Posts: 3
Joined: 07 Mar 2018, 18:26

Re: interesting savegame to debug

Post by Magista » 08 Mar 2018, 13:26

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
Leader
Dr.MonaLisa
Posts: 7037
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: interesting savegame to debug

Post by Leader » 08 Mar 2018, 13:52

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.

User avatar
Leader
Dr.MonaLisa
Posts: 7037
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: interesting savegame to debug

Post by Leader » 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?

Magista
Posts: 3
Joined: 07 Mar 2018, 18:26

Re: interesting savegame to debug

Post by Magista » 20 Mar 2018, 13:16

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 !

Post Reply