Behaviour / AI rambling

Enemy behaviour in my current (as yet unnamed) game hasn't come on very far - just a single enemy with a traditional hard-coded finite state machine (done the old-school way, with a big switch statement). Which was initially fine as it let me get some of the more important low-level details into place, but now I'm looking at adding more enemies it's not looking so hot so something more elaborate is called for.

Ai Game Dev has been in my bookmarks for a while now, and provides a lot of interesting reading. The approach F.E.A.R. takes towards it's AI is particularly interesting and probably something which would work well, but is a little beyond me at the moment. Instead what's caught my eye is behaviour trees. In particular it seems to solve a problem that I've been having - how to write specific modules of behaviour (like a specific enemy attack) in a way that they can be reused and rearranged rather than having an explicit "next" behaviour.

I'm not sure I entirely understand how it's all going to fit together with some of the higher level gameplay interactions, but it's a promising direction. I think I shall leave my current FSM enemy as it is and code up the next enemy as a behaviour tree (or possibly do the same one again) and see what the resulting code is like.

Since I havn't really done a scrolling beat-em-up before, I'm expecting to take a few wrong turns with the AI before I find something that works. If anyone has any experience to share then feel free to leave a comment.

Tags: , ,

4 Responses to “Behaviour / AI rambling”

  1. alexjc Says:

    Hey,

    Thanks for the compliments :-)

    Did you also check out the post on Popular Approaches to Behavior Tree Design? It links to my GDC talk also, which I think is a good overview of the technique.

    Let me know if you have any other questions!

    Alex
    AiGameDev.com

  2. JC Says:

    Yeah, I’ve been going through pretty much everything on behaviour trees on your site, it’s very comprehensive – particularly the videos. Thanks a lot!

  3. Game AI Roundup Week #28 2008: 13 Stories, 1 Video, 1 Quote, 1 Event — AiGameDev.com Says:

    [...] Behaviour / AI Rambling [...]

  4. Paul Tozour Says:

    My approach to this can be summed up in the post here — it was essentially a weighted distribution system (i.e. calculate weights for different actions and pick one based on weights), but it lived inside an HFSM.

    http://aigamedev.com/forums/showpost.php?p=3236&postcount=5

Leave a Reply