Tuesday, March 25, 2014

Artificial Intelligence

A short post about animal AI.  I started out using a basic, distance based, system with the animal intelligence.  As the game has progressed, this is no longer acceptable for the difficulty of a hunt that I want to see.  Therefore, I have been writing a more advanced AI system for the stag and much of it will be transferred to the wolves later on.

What I have so far.  The stag tracks it's distance to the player all over the map.  Once within a certain range his "senses" kick in.  Listening for gunfire kicks in first.  If you shoot a wolf, within ear shot of a stag, he will flee.  The stag now has a vision cone of about 120 degrees.  He has a visual distance sensor associated with his FOV and if he sees you within this range, he will flee.  He also has a basic hearing distance which will cause him to flee if you enter it in any direction. When he flees, he will choose a random waypoint on the map and take off toward it in a full sprint.  He will sprint for a random amount of seconds before he feels safe enough to continue his patrol.  He will sprint far enough to remove him from immediate danger.

Already, he feels less stupid.  Next on the list is to have him pick an appropriate waypoint that leads him in a direction away from the player.  As it is now he will sometimes pick a waypoint on a path toward the player and run in that direction.

It's been fun and interesting to see his basic intelligence become more advanced and believable.  This may be good material for a video soon....

No comments:

Post a Comment