AI Toolkit — Give a brain to your NPCs, a header-only C++ library

David Delassus
9 min readJan 9, 2024

Second edition of me battling my procrastination. This time, it is a project I made 1 or 2 years ago that I decided to publish. I was planning the AI for my 4X strategy game Warmonger Dynasty in C++, and I wanted a set of tools to help me implement it.

This is how AI Toolkit was born:

It provides 4 modules:

  • Finite State Machines: a nice abstraction of state management, useful for animations, or scripted actions
  • Behavior Trees: an extension of state machines which allows you to compose a decision tree where each node implement part of the desired complex behavior
  • Utility AI: to determine the best action to perform in a specific situation
  • Goal Oriented Action Planning: to find a sequence of actions capable of achieving a specific goal from a given situation

The combination of those tools enables the implementation of complex AIs without necessarily needing machine learning.