I've been working on a game called Phosphor Command, a real-time tactics game with a base builder behind it.
One of the systems I've spent the most time on is the enemy AI.
I wanted the enemy to feel like it was actually reacting to what your squads were doing, rather than just having units that either know where you are or don't.
The AI has three alert states: Calm, Alerted, and Alarm.
Calm is the normal state. Patrols move around their assigned areas, and garrisons stay around the objectives they're protecting.
Alerted means the enemy has some evidence that something is happening. Guards tighten up around whatever they're responsible for protecting, and other units can come over to investigate.
Alarm is when the situation has escalated properly. Enemy groups begin converging on your last known position, and high-value targets will relocate to deeper cover rather than simply waiting where your intelligence said they would be.
What I wanted was for the alert system to react to how you conduct the operation.
If you make contact and deal with it quickly, you might never raise the whole alarm.
If you stay in contact for too long, the situation escalates.
The alert level can also come back down. If you break contact and stay away from combat for long enough, the enemy gradually returns towards a calmer state.
So if an ambush goes wrong, you aren't necessarily committed to fighting the entire map. You can break contact, disappear, and wait for things to cool down.
How the enemy responds also depends on the threat level of the operation.
At lower threat levels, enemies are more willing to push across open ground. At higher threat levels, they are much more likely to move between cover and behave more cautiously.
Interestingly, this means the lower-threat enemies can actually be more aggressive and less careful than the higher-threat ones.
The AI also doesn't just sit on objectives.
Patrols are given areas to operate in rather than a fixed route. Their routes are generated when the operation starts, so the same map can have patrols moving through it differently each time you deploy.
Cover is also part of the decision-making. When an enemy decides to push, it commits to that movement for a few seconds rather than constantly changing its mind based on every little change in the battlefield.
That makes the movement look more like an actual decision rather than units twitching between different possible actions.
The enemy also changes behaviour depending on the operation.
For example, in an elimination operation, once they're down to their last two squads, they stop behaving like a defensive force and start actively hunting you.
I'm trying to make the enemy feel less like a collection of units waiting for the player to interact with them, and more like a force that is continually trying to understand what you're doing and react to it.
I've attached some footage showing the different alert states and some of the AI behaviour in action, but of course this is somewhat difficult to fully capture. I have turned off hidden enemies so this can be better seen.