You may have seen my earlier blog post about a 4-player coop game I’m working on inside of Unreal Engine 4. It had the first iteration on ranged combat AI and they proved to be a formidable enemy. The problem was they got stale pretty quick, with simplistic and predictable behaviors. The new AI improvements are a first step at addressing this issue.

New AI Behaviors

Along with the concept of multiple teams, the bots now do some bookkeeping on their most threatening enemy (“aggro”) which is based on distance to an enemy (if within the boundary of ears/visions), the amount of damage taken from an enemy and if the other bot is seen or heard through weapon fire or footsteps. Meaning that whenever a bot is attacked by a (melee) bot that is running up close, a spike in aggro makes him the most threatening, telling the bot to pick him as the new target instead of the current enemy far away.

The next step is to start digging into EQS (Environment Query System) to improve both pathing and decision-making when picking a good destination to attack or defend a player or location. As of right now the bots pick a reachable position within a radius of the current enemy. Using EQS you can figure out if a node in the world has line of sight to the enemy or if it’s partial/full cover etc. giving the AI a better understanding of the environment and therefore making them a more interesting opponent.

Stresstesting AI

With all the recent changes to AI, and all the firepower that’s available it was time for a stress test to see how it performs and deals with large number of AI agents. An open map with 80+ bots carrying assault rifles, rocket launchers, explosive slug grenades and sniper rifles – the end result is a party. (please mind your sound level)

Demorecording

Since around Unreal Engine 4.6 you can record your gameplay and play it back from any angle, much like the Halo-series and Call of Duty: Black Ops. The only requirement is for your game to be networked (single player games would need to enable replication too for this to function)

I’ve starting to work on some spectator and playback functionality to review/debug AI behavior and to make footage capture a lot easier. This works too for playtest sessions, allowing me to review a playtest session and see how both players and bots performed! Below is the first result of a freezeframe flythrough of the AI stresstest session.

If you’re interesting in creating a third person game in C++ or to get started with AI, check out my open-source C++ Survival Game project over at GitHub!

References