AI state machine w/ waypoints

After seeing the most recent asset drop from Quaternius I decided to make a little game with it while on holiday. Well, I quickly realized I would need AI code for the enemy characters, so I whipped up a little demo of an AI character controlled with a state machine and waypoints.

I then decided to open-source the project since it’s good for learning some basic AI and a great starting point for building more elaborate characters. I also uploaded a WebGL build that’s playable on

It didn’t take me long to program this (about two days) because I’ve known for years how to implement something like this, although this is actually the first time I’ve built an AI character with a state machine. Somewhat surprisingly, I’ve never had to do this before ¯\_(ツ)_/¯

There were a couple resources I referred to, to help refresh my memory of how to implement this stuff. For example, look at this state machine video from 18:40. Meanwhile, here’s a pathfinding tutorial I wrote a while ago.

later improvements I might do:

Leave a Reply

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

You are commenting using your 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