3 hour game design challenge

Hello reader!

I was pretty burned out on SimpleSteer lately so I had an idea to make things a little more interesting. I had this concept in my head of a 3D point and click adventure game. Well not really the whole game, just a bit of the basic mechanics of it. So one day I got back from playing football (the European version) and after dinner and all I had still 3 hours left till midnight.

I started scribbling down some design document. It actually took quite some time even though the final version isn’t too long. The really short of it is this:

  • player moves around in a 3D environment
  • camera moves on a predefined spline to follow the player like on a rail
  • player can interact with objects and NPCs
  • movement goal and interaction target is chosen by mouse clicks

The most important thing I wanted to make was the camera movement. I knew I was going to use iTween, which is a wonderful tool for Unity and is free. I had not used it for quite some time so I had to refresh my iTwen skills a bit. I watched some videos, browsed the documentation, and bought the example pack, which is a great way to support this free project a bit.

The other thing I had to do was to create a FSM like behaviour for the player character. Finite state machines are used for AI a lot. It’s basically a list of states an agent can be in. Each state contains different behaviour and the agent can transition from one to another based on events in the game and such. You can use it for a lot of stuff like player input for example. You could create different states based on whether the player is in a dialogue, or in a parkour section of the game.

I tried doing this with Behave. I created different sub-trees for the states and had Decorators decide which state sub-tree should be ticked. When a behaviour tree is the best option, this method could be used to simulate FSM like behaviour if needed, but otherwise it’s kind of silly to use something to simulate a FSM instead of using a FSM.

So I looked around for existing FSM implementations, both free and paid, and I did find a gem. It’s the Lost Zombie Studios Finite State Machine. Before I came back to Unity I have been learning a bit of UDK, and I really missed the built-in FSM of UnrealScript. This pretty much gives back that feel, though it’s designed so that each state is a separate class, which results in very clean and readable code imo. I made a tiny little change to be able to perform actions based on the previous and next states when transitioning, but otherwise I found it to be perfect.

I pretty much managed to do everything within the 3 hour time limit, probably with the help of the latest Justice album, which is pretty much 46 minutes of montage music. However I have been refining it a bit since then. I will upload it with the design document later.

It was a lot of fun and also a good way to see SimpleSteer in a different environment and I made some major changes. I think I’ll just put it up as it is with a warning that it’s uncommented and undocumented, and catch up with documentation over time.



Tags: , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: