My Take on Monster AI (Part 3 of 5)

Started by
1 comment, last by phi6 10 years, 10 months ago

Interactive demos for all parts are at the usual place:

http://tinykeep.com/ai


Part 3: Hungry Skeletons

YouTube Video:

[video]http://www.youtube.com/watch?feature=player_embedded&v=cwRo_kM19Ek[/video]

Today I'm going to talk about some behaviours that are specific to the Skeleton monster. The idea is that while Skeletons are not chasing or pursuing the player, they are always hungry and will seek out corpses to consume. Eating helps the Skeleton regain lost health, and also if left long enough, consumed corpses turn into more undead Skeletons! We build upon all of the behaviours discussed in the previous articles to do this.

The procedure is as follows:

1. The Skeleton is in non-alert mode (character is not in line of sight, and there are no detected breadcrumbs) and so it proceeds to patrolling the waypoints using simple A* pathfinding as before. If while in patrol mode the Skeleton detects a corpse it will set the corpse as its destination and proceed to run directly to it using the Seek Steering Behaviour.

2. If a player is detected, the Skeleton will switch out of this mode and chase the player instead in full alert mode. Skeletons ALWAYS prioritise the player over eating corpses.

3. When the Skeleton reaches the corpse, it will begin eating it. The eaten variable for this corpse increments every frame. While eating, the Skeleton's field of view is reduced to 45 degrees instead of 90, this is to give the impression that the Skeletons are busy eating to notice much else. Also, it is still in non-alert mode and will not smell any breadcrumbs. This opens up gameplay opportunities such as sneaking around a group of Skeletons who are busy munching!

4. When the eaten variable exceeds a certain amount (ie. 200) the corpse is completely consumed. At this point some corpses (such as Orc corpses) turn into more Skeletons! This has the effect of a large cluster of corpses quickly propagating into multiple Skeletons, so the player has to make sure this doesn't happen!

5. At that's it, nice and simple behaviour made possible by combining and tweaking the previous behaviours in a certain way. This is the beauty of behaviour trees, it is quick and easy to create new meta-behaviours by combining the building blocks of the previous ones.

Read more about the benefits of Behaviour Trees at AiGameDev:

http://aigamedev.com/open/article/bt-overview/


The Next Few Days

As some of you may already know - my game TinyKeep is on Kickstarter and there are currently only 7 days left of funding to go! If you enjoy reading these kinds of technical articles, please consider pledging so I can continue active development of the game. Currently I have accrued almost half the amount I need, but as Kickstarter is all or nothing I need to make the full £22k or I lose all my pledges so far. If I get funded, I plan to keep on releasing articles on all aspects of the game's development, including AI but also game mechanics, procedural generation, multiplayer networking, 3D graphics & animation, performance optimization, workflow - and everything in between! So please help if you can!

Have a look at our project for more information:

TinyKeep - A 3D Multiplayer Dungeon Crawler for Windows/Mac
http://www.kickstarter.com/projects/phidinh/tinykeep

TinyKeep - A 3D Multiplayer Dungeon Crawler with focus on intelligent monster AI

Currently Kickstarting: http://www.kickstarter.com/projects/phidinh/tinykeep

http://tinykeep.com

Advertisement

Really great work so far.

Perhaps you should add a "sound" aspect to this system. Every action (such as taking a step or attacking) should emit a sound that can be heard by enemies, who will then become aware of the player's position even if they can't see the player. The sounds of actions could vary in the distance they travel - quiet actions such as slowly walking would emit very little sound, while the sounds while fighting in combat would travel quite far. Just a thought on how to make the enemies more intelligent while introducing more stealth mechanics.

That sounds like a really good idea, thanks!

TinyKeep - A 3D Multiplayer Dungeon Crawler with focus on intelligent monster AI

Currently Kickstarting: http://www.kickstarter.com/projects/phidinh/tinykeep

http://tinykeep.com

This topic is closed to new replies.

Advertisement