I have probably mentioned this recent hiccup to you by now; I’ve been trying to work on the defence segment of Y4 and have been beset by some most curious unit AI behaviour.
Naturally, trying to deal with the problem has got me in a bit of a whirl.
Walk This Way
Attack-move has been the staple of AoS and hero defence and pretty much all spawn-driven map types since the dawn of time. It allows you to give units the broad desire to reach a location, while stopping along the way to engage hostile units like your player hero or allied defensive structures. Perfect. Wonderful, even.
There is one common AI failure related to spawned units, in that after a set amount of time they suddenly desire to break off all activity and walk back to the point at which they entered the world. There are known solutions to this — either keep issuing the order again, or increase the return time gameplay constant to Stupidly Long.
As you can tell by the fact that I cite known solutions, that wasn’t my problem.
Ignorance is Bliss
My problem was that, for some bizarre and still unexplained reason, my spawned drones didn’t stop to engage buildings. Since the whole point of the segment is to defend a building, I’m sure you can understand this being a bit of a concern.
I canvassed a good number of people and went through all the usual procedures — was the order being issued wrong, was the building not a valid target for the unit, was the unit dodgy, was the building dodgy, was there an alliance problem… Everything checked out.
During my testing I discovered this array of bizarre things:
- Even footmen wouldn’t attack any buildings.
- Even making the building a turret that attacked didn’t provoke a response.
- If the building was placed far enough from the map centre, passing enemies would engage it.
- If I spawned the units on top of the building and never issued an attack-move, they would engage it.
That’s a really strange collection of circumstances.
Find Another Landing Zone
As with the solution to a recent (and equally bizarre and impossible) problem in my real job, the solution is just to side-step the problem entirely and make sure the dud code is not being executed. If I spawn the units under any player rather than Neutral Hostile, their behaviour once again returns to normal.
I know that NH has always been associated with some bizarre AI anomalies at the best of times, but I’ve never come across anything like this. I can only surmise that I have somehow, via some initialisation trigger or gameplay constant modification or combination thereof, managed to break the unit Neutral Hostile AI target detection for a portion of the map. Sounds impossible, but that’s the only explanation.
I like to use Neutral Hostile because of the pre-selection functionality. When you mouse-over a player unit, you see its health and the name of the owning player. When you mouse-over a Neutral Hostile unit, you see its name and its level. Since all enemies are “Rogue Drones” of various kinds, I naturally prefer them to have their unit name than some nebulous title like “Rogue Drones”.
But, since Neutral Hostile keeps giving me lemon-lime, I must use another player.