You creep up to the enemy fortress stealthily, eliminating guards on the way with well placed silenced headshots. Just as the front gate comes into view, a sentry spots you and sounds the alarm. The entire fortress lights up and you run for a vantage point as hordes of enemy soldiers stream out and stand in the open, waiting for you. At first you gain the upperhand by skillfully headshotting dozens of them, but your ammo starts to dwindle as they quickly replace their casualties with even more soldiers rushing out of the fortress. You pull out your machine gun and charge for the gate while mowing down whatever gets in your way. During this massacre you stop to reload behind a pile of sandbags. Okay, good to go - you jump out to finish them off - but to your surprise every soldier has turned around, running back inside the fortress. What happened??
What's wrong with modern FPS AI??
In most shooters these days, enemy movement and spawning is completely controlled by triggers, so enemies are unable to take cover or maneouvre intelligently. They just spawn and move to a scripted position. If they live long enough, they move to the next scripted position when the player reaches the next trigger. The problem with this is that it cripples even the best AI and it's a an extremely tedious job for level designers to script and test every possible position enemies should move to in response to every possible position the player can take.
(Here's a youtube video illustrating that problem in Battlefield 4's campaign. The level designers didn't anticipate the player would rush with a shotgun, so they didn't script the soldiers to take cover or retreat properly - notice how awkwardly they move, and "take cover" behind objects the wrong way. This is a serious flaw with the way most games rely on scripting over AI. I don't mean to take cheap shots at BF4, I'm actually a huge fan of the series. )
Okay great, how will your game deal with this?
As a 1 man team doing both programming and level design, it would also be completely unfeasible for me to even attempt to script AI this way (for example, the player enters this room, these bad guys should flank here, these bad guys take cover here - it would take months to script each gunfight). So the solution is to create a very flexible and autonomous enemy AI that doesn't need hand holding and micromanagement, while responding to the player's actions in a believable way.
In this encounter, the enemies try to defend this "building" from the player - falling back, taking cover and flanking when appropriate. There is 0 scripting - I just set the zones for the AI to try to defend, and they'll do their best following a lot of AI decisions. This is actually very difficult for AI to do (since it's such an abstract task - usually game AI just has simple scripts like move to this position, look at this position etc) and outside of milsim games I've actually never seen a system like this before.
The truth is, even in the demo from last February, there was no scripting whatsoever (triggers were only used to spawn AI), so everything you saw there was purely AI. Even now there exists no system to force the AI to do anything, and I don't plan to implement one because it isn't necessary.
Here's a stress test, where a ton of AI assault/defend (right side defend, left side assault - the black spheres are defend zones, red spheres are assault zones). No scripting or triggers - the AI tries to assault/defend their zones, but retreat, take cover, flank etc when they deem necessary.
This is some cool tech, but what does this mean to me, the player?
There's three main benefits I can think of:
- Encounters are more open and dynamic, since AI will always react dynamically to whatever you do, and environments can be any size and your enemies will behave intelligently with it
- This game will be finished in a realistic time frame, not requiring months to script every battle
- No weird AI bugs/stupid behavior where enemies take cover facing the wrong way, charge your position in a straight line etc
Here's some examples of me just playing through the same test map with the same AI. Notice how the AI reacts against me - falling back when I'm aggressive, but trying to counterattack when I'm being passive.
Also... Stun animations!
Enemies have a chance of being "stunned" by damage, and with melee and explosions it's 100%. There was no animation for this before so enemies would just stupidly stand in place while they were "stunned". Now it's obvious with an animation, and playtesters are always happy to finish off stunned enemies :)
Coming up next...
As you probably know, "Trepang2" was a temporary placeholder name. A proper name and logo have been decided on and are in the works, so look out for the next time! Also perhaps some details on the story and setting ;)