Ai freezes whole map

About the causes of freezes due to AI created in the AI Editor

Do you think freezes can be caused by a discrepancy between the food information in the AI editor and the actual food?
I've noticed that freezes definitely occur when the bot tries to buy something that's unavailable. Apparently, it spams the purchase non-stop, and that causes freezes.

I created a bot without heroes. Heroes are purchased via triggers. But I set the bot's food limit so that there is always enough food. However, it still freezes.

It seems to me that hero trained through triggers order causes a freeze. But what's the reason? Maybe someone knows. Then I can fix the root cause.

If you make it worse and also script the purchase of UNITS via triggers, the game outright crashes after 5 minutes. And the freezes become unbearable.

How did I check that the freezes are because of the bot? Simple. Just launched a match without the bot.

By the way, the freezes appear during the bot's control phase. Could it be related to the fact that there is a hero in its attack group that it didn't hire? Or does it have too many units in its squad that need to be selected? That seems logical overall. The more such trigger-bought units it has, the worse the freeze.

How to optimize the AI?

Why does the bot freeze the entire map when trying to control units that didn't hire?
 
There are quite a few reasons AI might cause your game's performance to become unstable. The most obvious one happened if you're trying to implement this on the island-based maps. You'll want to layout your map so that the AI can place down buildings or find their victims and expansions more easily. Both starting location and the expansion spaces must be wider, and, if you are trying to separate between all expansion sites and all other player's starting locations within island, you have to place a significantly sized land bridges between them. And don't place too much obstacles (like trees) within key areas as it may causes pathfinding loop issue.
 
There are quite a few reasons AI might cause your game's performance to become unstable. The most obvious one happened if you're trying to implement this on the island-based maps. You'll want to layout your map so that the AI can place down buildings or find their victims and expansions more easily. Both starting location and the expansion spaces must be wider, and, if you are trying to separate between all expansion sites and all other player's starting locations within island, you have to place a significantly sized land bridges between them. And don't place too much obstacles (like trees) within key areas as it may causes pathfinding loop issue.
Is it possible to make these loop not to often to avoid freezes?

I save my maps through WarTransfer tool. It uses MPQ viewer to transfer in-map files and .j file editing. Is it reason? Because my maps didn't saved just normal way?

But you know, I test my map on the smallest map in the Warcraft, for 4 players. It is very simple and straight map. And it's still freezing! And I noticed that the more troops trained from triggers, than more freezes we can see. It happens after finishing training.
 
Is it possible to make these loop not to often to avoid freezes?
Unfortunately, it's a bit complicated steps. And I don't have a good experience when it comes to map scripting.

As I mentioned previously, intermittent freezes/stutters in-game is somewhat related to the AI's pathfinding loop. You can try restructuring your map layout so that there's no some kind of obstacles (trees or water) separating between key areas (start location and expansion sites), placing a bridge if you want to make both start location and expansion sites being separated within waters. Otherwise, try disabling parts of scripts/triggers (trigger comments are useless and might crash your WE in 1.31, if I'm not mistaken), re-import and then test until stutter goes away.

The pathfinding loop issue is a big shame since the AI does use Zeppelins at some point in melee game in order to allow their units to reach the other side of map, and there's also Way Gates in some melee maps (like Plaguelands).
 
Back
Top