Saturday, December 22, 2007

Behavior trees and a certain castaway

I've been playing with various AI problems for [many years now] and for anyone who has tried to do any form of AI, particularly with state machines and heirarchical state machines, you'll have felt that there was something missing.

I got to thinking about doing a small AI testbed for some stuff at work and that got me to thinking about maybe doing a small product in order to test out my AI code. Something casual but fun to create. Something that didnt take a huge amount of time or programming effort (or more importantly, money).

One of the games that really interests me AI wise, is the sims. I like the notion of virtual characters, ever since playing [little computer people] back on the C64.

Little Computer People
I was thinking of a game that I've played relatively recently called [virtual villagers] and thought about how I could maybe throw the two ideas together, but on a very small scale. Basically, how do I create a small scale "sim/god" game?

Virtual Villagers

Let's just backtrack a second actually. At a sort of tangent to this. I recently started thinking about what one would actually identify as a very "british" type of game? One of the things that strikes me, is that a lot of well known british games, particularly from companies like bullfrog, are god games! So I guess there is something in this sim/god thing that works for us brits.

Populous by bullfrog

Anyhow, back on track again. I was thinking, "what makes a nice scenario for testing a tiny god game?".

Well, as it happens, I already had one in the back of my mind. Created, as it happens, by none other than Jeff Tunnell! Yep, the very one that started!

Back in the heyday of Dynamix, Jeff and a few people had formed a small offshoot and one of the products they created was a nifty little screensaver called "Johnny Castaway". Here's a site dedicated to that little part-game experience.

It was a screensaver but with a very unusual take, because it actually worked more like a sims style experience. As you can tell from that website link, people really got into the whole "watching life" aspect of it. Which is great from an AI programmers point of view.

So I got to doing some research. Thinking about moving away from state machines into something a bit more designer friendly. So that my designer (me) could have more fun designing the game.

Anyway, after reading various gamasutra articles about the sims AI. I decided against doing the AI the way the sims did it. There are lots of reasons why, but mainly because I think the AI they designed is a bit too complex and a bit too single purpose for me. I want to be able to use this AI tech in other projects as well. Anyway, luck should have it, that after a bit of searching for "Sims AI", I came across my old mate Alex Champandard's page about Behavior Tree's over at and thought that might be a useful thing for me to try. If you need more convincing of that, here's Damian Isla from bungie talking about the use of Behavior Tree's in Halo 2

So what next? Well, I've already got a little island scene that Magnus made a while back. I already have an AI framework from a while back. Time to plug in a Behavior Tree implementation and see how it pans out.

The great part about doing a game like this, is that you can just slowly implement more fun features without any real purpose (other than entertainment). So it can have that great tradition of british comedy gaming in it. It doesnt hurt the britishness that the protagonist is in fact a bit hapless but never the less lovable.

So thats christmas done then! :)