New AI

22 Feb
February 22, 2013

 

TL;DR

These improvements will make YOUR experience with the combat more interesting. The AI react much better to you, to each other, and to communications, making for a more immersive experience.

Long Version

Some of the feedback I’ve received has been about the AI, and how it could be more interesting. That feedback was spot on. The old AI was some weird combination of state machines and goals as I was first learning how to write it. There was no sensory system or target prioritization outside of “choose the closest enemy that I am allowed to.” You saw this during head on passes between flights, where all members would prioritize the frontmost enemy. It looked pretty bad!

Well, that’s no more. The AI now use something called behavior trees and have proper sensory systems and target prioritization. They also have a variable called danger, which is just a number boiled down from people shooting in their direction, enemy proximity (and facing), and special cases like missile proximity. If a fighter is in danger long enough, they panic. They also understand how to use afterburners like you do.

Little actions are pretty trivial to add once you have the system up and running. One of my earlier tests was to see if I could get a pilot to kamikaze when he’s below 25% hull. It worked, and now I want to see if I can make a whole drone class that will do that. It remains to be seen how fun that really is, but I will try!

Here's a debug display of what the tree generally looks like.  Light green means running behaviors, dark green means successful behaviors, red means failure, and grey hasn't been checked.

Here’s a debug display of what the tree generally looks like. Light green means running behaviors, dark green means successful behaviors, red means failure, and grey means the node hasn’t been checked.

Chatty Pilots

I wrote a new combat dialogue system that handles variants a lot better, meaning that if possible it won’t repeat lines. There are also both local and global cooldowns for line types, letting me tune the chattiness. They also won’t talk over each other unless I specifically say it’s cool (like for a death scream).

I apologize that I only have one voice right now (mine), which makes it more confusing than it will be. Look for the subtitles (your flight is “ECHO”) and the HUD marker “(O)” to better see who’s speaking.

Hooked into the behavior tree, I can do all sorts of special case stuff. Like, when an AI evades, he will tell his flight members. But if he’s the only one left, he gets a little more aggressive and taunts the enemy (for example, “Come on you bastard!” is spoken around 0:59). He will also ask for help if he panics, and any squad member that can attack his aggressor will let him know to hang in there.

Other Stuff

If you want to read more about some of the AI techniques, check out the following links and read about it from people a million times smarter than I am, and a million times better at explaining it:

Sorry these are generally the same assets I’ve had for a while. I’ve been working on NEW units and weapons too, so expect those in an upcoming video. I am working toward a combat test using the Unity web-browser plugin that will probably be nothing more than a Firefight-style last stand mode where I keep spawning enemy fighters until you die. No date on that, but it’s squarely in my sights.

Thanks for watching!