• Register
Post news RSS TinyKeep's AI System (Part 3 of 5)

Learn how Hungry Skeletons consume corpses to raise more companions of the undead.

Posted by on

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.

This demo and all previous ones can be found at the usual place on the website:

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: Aigamedev.com

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!


Tajin - - 98 comments

That actually sounds more like you're describing zombies.

I've never heard of Skeletons eating anything. Sure, they might chew a bit, but everything they eat will inevitably fall out.

Just saying that you might want to reconsider this, as it sounds a bit weird.

Reply Good karma Bad karma+1 vote
PetertheHe - - 33 comments

+1 on that!

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.