Skip to main content

AI State Machine Framework

This week I worked on beginning to implement the Ant AI. Last week I laid out a basic flowchart for the AI that I used when implementing it this week. I set up an interface for the AI states so that our state machine can easily handle different behaviors without needing to hard code many of them in. This makes it a very flexible solution and could be used for other projects in the future (in fact I already found a use for the state machine in implementing AI on another project).

I set up the core state machine as well which essentially just handles changing between states and telling the current state to run it's update code each frame. It also holds onto any data that multiple states might need, such as the ant game object itself. This helped compartmentalize various pieces of functionality which is always a plus.


I spent the rest of the class going over this framework with other programmers on the team. A lot of them are still a little bit unsure on how to implement things in this style, but I spent some time helping them begin to work with it as well. There were one or two small tweaks that needed to be made to the framework as we went along which is to be expected. This framework should allow us to easily manage the behavior of our ants and eventually spiders in the game.

Comments