Before I crack on to Part 2 (Retreat and defense) I would like to quickly cover the minor improvements we made since Part 1 of this AI series. Thanks to community feedback we've added a few more features, removed others and hopefully will have created more realistic behaviour.
In short, the changes are:
1. If the Skeleton loses sight (raycasting towards hero) and smell (raycasting towards dropped breadcrumbs), he will still continue to head towards the location where the hero was last detected and investigate further.
2. If the Skeleton still cannot find the hero, it will make a best guess where it thinks he has gone and will set a patrol route to the nearest waypoint. Given these changes, we've removed the alert level as we've found this feature has become redundant and offers no extra intelligence. The "smell trails" have been reduced to balance the extra added behaviour - this also seems to help limit cheating in the AI.
Ok, let's bring on the fun stuff!
AI Explained - Part 2 of 5: Retreating and Defense, featuring TinyKeep's Fire Imp Monster!
Fire Imps (and other monsters marked with the "Shy" personality flag) will run away from the player if he gets too close. Put him in this level of distress for too long, and he'll breathe fire on you.
The interactive demo is here on the TinyKeep website along with all of the previous demos:
As with all of these AI behaviours, what you see on the video and demo are the default settings for each of the personality flags (Aggressive, Cautious, Shy, Lumbering etc...). However we've designed our AI editor to be a lot more flexible than that - so our game designer Ben can choose from a multitude of variables to customize his monsters:
- Enable/disable line of sight (blind monsters)
- Smell/sound sensitivity (monsters with amazing sense of smell)
- Roaming speed, chasing speed, fleeing speed
- Enable/disable wall avoidance (in case some monsters can walk through walls!)
- Distance threshold before alerted
- Require line of sight before alerted
- ...and many more!
We know that this will give us the ability to create really unique and varied monsters, and part of the fun of the game is figuring out the behaviours of each one.
Hope you enjoyed the post, and let us know if you have any questions about the AI!
Interesting. Have you considered adding flocking behaviour to the fire imps so that a group which are friends will tend to flee in a similar direction? Or would this make catching them too hard if they are all breathing fire?