Stuck units causes CPU overload in MP/SP, performance issue

:arrow_forward: GAME INFORMATION

  • BUILD #: 101.101.43210.0
  • PLATFORM: Steam
  • OS: Windows 10
    i7 6700k@4.8GHz, 64GB RAM@2166Mhz, GTX1080, drivers up to date

:arrow_forward: ISSUE EXPERIENCED

Short version: stuck units (human OR AI) lead to CPU overload and thus to “lag” or "stuttering"

In games where everything was running very smoothly first for one or two hours, I have been running into sudden and continuous catastrophic lag or stuttering in MP with friends in private matches as well as in SP. Ressource manager showed clearly the CPU being the bottleneck and having an i7 6700k @4.8Ghz single core speed, this made me wonder.

The next texts are the clues, how I came to the conclusion above. Always remeber it was a gigantic map with 6-8 player, late game with units near to maxed out, everything running fast and smoothly, then rather suddendly, huge lag:

Most frequent I got this kind of lag in maps with water, but rarely on maps without water at all, too. Killling units made it somewhat better but most of the times the lag carried on till the near end of a game, where the bases were destroyed. Sometimes it went back to smooth and normal without anything happening, but then most of the time just for short periods. In many cases it became a fast/slow/fast/slow-thing. But in many cases I stopped the game and started a new one, because it was unplayable slow.
I started to notice, that killing many ships in a “highland”-map with one narrow but long and branched river made it a lot better than killing many land units, which was the first clue to pathfinding.
The next clue were “Yucatan”-maps with some small areas of water, where the AI started to build fleets (50 and more ships). Killing those landlocked ships speed up the game immensly.
A third clue were when I myself had a lot of ships in a small river, far too many to have them sail parallel. Giving all ships the order to shoot at a unit, which only the first row of ships can reach rapidly slowed the game. The ships in the second row and beyond tried to get close enough but there was no way past, the units were stuck in eachother. After the unit was killed and every ship moved again, the game speed up again.
The last clue was a pure land map (“dark forest”), where the same thing happend when too many land units tried to reach a castle. With every position around the castle occupied the game speed dropped.

Now to what convinced me: A save game of a game I abandoned last week, because it was unplayable slow. Since then I tried every tip to speed up my system for AoE (vsync and everything). I loaded it today and knew there were many stuck ships in a narrow river at the enemy base. Destroying those ships (which was a pain to do, because of the game going so slowly) speed the game up from unplayable to without any lag at all even when setting game speed to very fast. I attached the savegames (“12” is the save game from last week, “STUCK-UNITS” is close before I killed the last stuck ships, “STUCK_UNITS_UNSTUCK” is after killing the last stuck ships, already going very fast. “STUCK_UNITS_UNSTUCK2” ist five minutes later with the AI already replaced all destroyed units but still everything is going very smoothly)

My conclusion is that units with no way to go get many “turns” to see if it is possible to move again thus clogging up the turns. Many stuck units multiply this problem.

This problem is not limited to SP or MP games with AI components. Human controlled units can get stuck in astonishly many cases, too, with similar results.

This is quite often a game breaker for my friends and myself. I can imagine, that it is as well for many other people who are wondering about “performance issues”. Please look into it! Maybe it is possible to reduce the frequency units look for a new way when stuck or make them give up completly or for 30 seconds when ten tries didn’t work?

This happend with the current build as well as the old one(s).

I’m sorry for any mistakes I made in the text.

:arrow_forward: FREQUENCY OF ISSUE

  • 50% of the time / matches I play (FREQUENTLY)

:arrow_forward: REPRODUCTION STEPS

  1. get (many) units stuck (in a narrow place) with no way to go (not even backwards)
  2. experience lag
  3. kill units
  4. experience smooth gameplay

Alternatively: load the savegames I provided

:arrow_forward: GAME FILES

onedrive link to savegames!Ap3lOksE8xV0zVYlTyTXpIQsYK67?e=9l1AEb

:arrow_forward: IMAGE & ATTACHMENTS



6700k at 4.8ghz is plenty for 300 to 350 pop but unsure about 500.

multiple issues could be causing this and just 1 of them present, you will have massive lag.of these are known but not addressed.

  1. 1 player with lower end CPU spec
  2. multiplayer online vs AI via server (UK west, US east etc) are way worse than single player
  3. server sometimes just crap out and introduce lag in multiplayer games. even when nobody is lagging and all units died off the map, lag remains.
  4. AI pathing trying to find/get to units cause lag. even with 4.8ghz a 200 vs 200 unit fight will cause massive lag.

thanks for your answer.

I have no problems with big fights or in the end game with thousands of units, there is no “lag” induced by the number of units, as described above.

To your points:

  1. happens in SP, too.
  2. can explain MP issue, but not SP.
  3. can explain MP issue, but not SP.
  4. like I said, big fights are no problem. I had many games with 8 players, maxed out units and no lag. Please load the attached savegame to see if with a “better” CPU there is no problem.

Killing the stuck units resolved the problem and the game continoued to run smoothly even after the AI had rebuild most units.

It is important to add, that this problem seems just to happen when the unit is completley stuck, so no way to go at all. So narrow ways between houses in a dense city or units massing through a destroyed wall don’t produce this lag.
My guess: units with no way to move at all go significant faster through the pathfinding algorithm and asking much more often for a new way to go. Units with still a small area to move, even backwards take at least a second or a half until they ask for a new path again. This is if pathfinding is always started when a unit “hits an obstacle”. Another point may be units not being considerd “fixed” obstacles, so pathfinding trying to go through the units again and again, hitting the obstacle immediately thus starting the pathfinding again and again.

Occasions where units get stuck, explaining this happening even in the mid game, when it just happens often enough:

  1. citizens chopping wood and getting stuck between other citizens and trees (quite common). Can reach quite fast a significant number of stuck units with many players.
  2. trading vehicles blocking each other
  3. citizens hunting and getting stuck between dead animals/alive animals and other citizens.
  4. … most likely there are more, but I can’t think of more atm

it seems your experience dont line up with my experience and we may as well test this out to correct our experiences. though I’d trust my own and very confident about it but always open to learn new info.

to your points thats to my points

  1. I am talking about multiplayer, not sp
  2. I am talking about multiplayer compared to sp
  3. I am talking about muitplayer, not sp
  4. something we can easily test which I am fairly confident about, as I have done 4 separate tests with 4 different individual with decent computer specs. so I do question about max out units and no lag, especially when its 500.

to point 3, killing stuck units does not resolve anything, this is in multiplayer and likely related to server.’

for your 2nd post about stucked unit, it is closely related to the 200 vs 200 battle and lag (point 4). I have made a thread about it and this is the thing we can test out.