• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] The AI lag

Status
Not open for further replies.
Level 15
Joined
Sep 6, 2015
Messages
576
I have a problem with the AI in my map cos the game starts lagging heavily after some time playing it and it seems to only happen when there is AI. I have no idea what's causing the lag, it might be the large amount of units created by the AI, but other maps also have tons of units and they don't lag. If it's some error with Blizzard's core scripting or engine and if it's happening on all the similar maps out there, or if the map is just requiring better computer configurations and it isn't caused by some error in the AI, then I'm afraid there is nothing I can do about it, except maybe reduce the number of units created making the map easier and less interesting. Although I strongly believe it's something that can be fixed and is caused by some sneaky AI editor bug which causes lag.
Here's the map I'm talking about:
http://www.hiveworkshop.com/forums/maps-564/deforestation-v6-2-a-270058/
Here's the unprotected version of the map, if someone wants to check the actual AI setup:
http://www.mediafire.com/download/6ugrhjq09e3tr1d/%288%29DeforestationREAL.w3x
 
Please tell us more.

1. Is there triggers in the map that fire periodically?
2. Is the AI purely scripted in AI editor?
3. How many units do you mean when you say "a lot"? More than 100?

AI made with AI Editor should not lag at all. Too many units or even doodads on a map will cause lag though. The most likely culprit though is a leak. If your triggers leak and a AI unit is using the trigger, it may seem like the AI causes lag when in fact it is actually a trigger. But, without more information I can't be sure and I don't have time to download your map and look through it. Ok, maybe I do have time, but I'm not going to do that. Sorry.
 
Level 15
Joined
Sep 6, 2015
Messages
576
1. Most of the map's triggers can happen only once, but there are also such triggers - the one that triggers to respawn the map boss's creep camp with other effects added to it, there are also triggers for caves that teleports, and triggers linked to certain abilities, but the AI very rarely activates those triggers, and those triggers aren't being activated too frequently even when players are playing.
2. Yes.
3. The AI can amass more than 100 units (buildings included) since there can be up to 7 AI players, and even one AI player can amount a large amount of units, but I think it's not 100, and also the number of trees on the map is at the limit for them, but doodads would lag the game from the very beginning and they are not connected to any triggers, but it might be that enormous amount of units + trees + rainy weather causes lags.

Leaks in triggering would cause lag even when there is no AI, if I'm not mistaken, so that leads me to a conclusion that it isn't the problem, since lags seem to only happen when there is AI. I have seen the lag happen with only 3 AI players.
 
The leaks would cause more lag is the AI used triggers like respawn, cave or teleport. The doodad amount can't help, but that's not it either if it is just when you use AI.

One thing I am sure that does not cause lag is AI script. You can play 1 v. 11 and get no lag, in the normal game. And the way AI works is a long series of if/then commands. They are also leakless. Maybe you should post the map to the pastebin and I (or someone smarter) can have a look at it.
 
Level 15
Joined
Sep 6, 2015
Messages
576
One AI can reach up to 96 units, or very rarely it might reach 101 units (buildings included) and there can be 7 AI. It is actually made to reach 106 units but I haven't implemented the triggers needed for it to reach 106 units yet (custom abilities needed for it). I don't know if there is some limit as to how many processes/units/data can the game support.
I think that the AI doesn't use the triggers when the lag occurs, it occurs after some time, probably when it reaches a certain number of units or when it attacks with them and gets stuck or some AI error occurs. Here's the unprotected map in the pastebin: http://www.hiveworkshop.com/forums/pastebin.php?id=6y8q9r
*I actually found 2 empty fields in the AI building queue, because that building got deleted in the object data, and I fixed it in the pastebin version of the map, so the lag might be gone now, although I have to test it yet.
 
Level 15
Joined
Sep 6, 2015
Messages
576
I've been looking for some info about leaks and I've found out that it seems that my map has leaks in some triggers because they contain:
"Unit Group - Pick all units of type <UnitType> and do Action(s)."
But, unfortunately, it seems that that type of leak cannot be prevented and I have no idea what trigger command can replace that one in my map.
 
Level 15
Joined
Sep 6, 2015
Messages
576
The AI does use zeppelins on this map, but not all the time and sometimes it gets stuck in the woods when attacking normally or returning home from zeppelins. Yes, that might be the remaining problem, but then I would have to transform the whole map and it will lose a lot of its unique mechanics and tactics, and that's not an option. The multiplayer is the main thing on this map, anyway - the AI was added later. What I might do, however, is to leave this map as it is and incorporate the custom race from it into one of the Blizzard's melee maps and upload it separately.
 
Status
Not open for further replies.
Top