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 itch.io
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:
- waypoint editor https://www.youtube.com/watch?v=MXCZ-n5VyJc
- improved behavior https://www.youtube.com/watch?v=6BrZryMz-ac
- multiple agents https://www.youtube.com/watch?v=qzkOslgzuzo
- sensor toolkit :30 https://www.youtube.com/watch?v=37z6hTHuJRI
- follow player breadcrumbs https://www.youtube.com/watch?v=cyvdAYOxnqg