“AI” Part One

One of my internal, early milestones in AoT is to have an automatic simulation on the world map where 2 AI factions go about their business of expanding their empire and try to conquer the world. It’s going to be overworld only. The reason for that is to figure out what kind of resources make sense in the world, how to place adventure locations, and the general functionality and growth opportunities for cities. It’s like a simplistic AI-driven fantasy Civilization game. The overworld gameplay is turn-based. So, given the above, I need some AI fit for a turn-based game, fit for both dungeoneering, overworld movement, faction/city handling logic.

I want to evaluate a few approaches for AI (I’m not a gameplay/AI programmer by trade) so I need a testbed for this. I imagine in the end it’s going to be a hybrid approach. So, part one in AI land is … LumberWolf!

Actors:

  • Lumberjack: Chops wood and brings them to the shop. When he sees the wolf, he drops any wood being carried and runs for shelter.
  • Wolf: Wanders all time. When he sees the lumberjack, chases him; if he reaches the lumberjack, he starts biting. Stays away from the shelter.
  • Tree: Can be harvested for wood. Contains 4 wood units.
  • Wood pile: A wood unit. Carried by the lumberjack.
  • Hut: A place to drop off wood
  • Shelter: Safe space for the lumberjack

The current AI controller is implemented as simple if/then/else statements (e.g. if wolf nearby, drop wood, etc). It’s pretty dumb. It’s a mix of conditions, which are evaluated instantly, and timed entity commands, which are scheduled normally in the game turn manager and will take some time.

Writing the if/then/else statements is simple but oh my, for any non-trivial behavior the bugs come creeping in immediately, as the order/structure of conditions and actions is very brittle.

I want to evaluate the following approaches: Finite State Machines, Goal Oriented Action Planning, Utility Systems and Behavior Trees, as these look like they’re the most prominent practical ones for games.  As additional fluff, the testbed will incorporate FoV and proper movement costs (can’t go through trees)

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.