Guard AI

Developed an AI framework to be used for a stealth-based game by Worldgame Entertainment Ltd, a company based out in the UK. It has functionality for guards to travel along predetermined paths, random paths, and stay stationary at a position. The guards themselves patrol an area, investigate suspicious activity, and become alert if they spot the player. You can take a look at the end result below:

So I feel there is still a lot of improvement that could be done for this. I had to complete this in two weeks time, figuring out how to make the AI meet the desired requirements specified by Worldgame Entertaimment Ltd. The AI was not too hard to grasp how it could be created, although it gave a bunch of headaches along the way since I couldn’t do it using separate behavior trees to control the behavior of guards depending on what state they are in – i.e. Normal, Suspicious, or Alert. I ended up using just one behavior tree to control the entire behavior of the character for transitioning from each state since I encountered too many problems with trying to use multiple behavior trees. So in case you want to see what the behavior tree looks like altogether, well here it is:

This is the root node selector.
bandicam 2015-02-27 20-25-12-511

This is the normal state used by guards.
bandicam 2015-02-27 20-25-39-141

This is the suspicious state.
bandicam 2015-02-27 20-25-56-778

This is the top portion of the alert state.
bandicam 2015-02-27 20-26-21-192

This is the bottom portion of the alert state.
bandicam 2015-02-27 20-26-36-368

As you can see, it looks really messy having all these trees together in a single file, so that is why I tried to have separate behavior trees for each state.

In terms of improvements, there is still some buggy behavior I have noticed that happens occasionally; the animations for transitioning from shooting to walking with the pistol do not occur properly sometimes when the guard runs too far from their guard position. I am not able to reproduce the behavior consistently when playtesting it, so I am at  loss for how to fix that for now. In the future, I probably might add a centralized AI system that all the guards use to get information from; this would be useful for features such as having all the AI guards nearby the player to become alert if one of the guards have sighted them. Additionally, it would be nice to figure out how to make it so that guards do not always run in a straight line to the player, but instead utilize strafing – like how guards would actually strafe around a corner with their gun if they just spotted something suspicious.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s