Chronicles Enemy Behavior Difficulties

I know I want to implement a fairly simple FSM graph for NPC AI but I'm running into a few issues with the implementation. You want to very simply say things such as “If you can reach the player to use a specific ability on them within X turns, try to do that.”

You want to be able to define these rules-based behavior states in assets and not in code because that's how we're doing things.


Here are the constraints:

  1. Abilities are lists of actions that may request 0-N targets or perform 0-N actions on the target results. These are defined in assets and are completely arbitrary. (You could have a single ability that uses dependent multi-stage targeting that heals, pushes, or damages completely arbitrary sets of actors)
  2. Determining the “Result” of an ability is thus done by executing the actions onto a copy of the game state to simulate it.
  3. Because of these two things it's very hard to reference a specific target request or specific action from within an ability because the it's generally taken as whole.
  4. If I wanted part of the behavior graph to say something like “move into range to use the blink arrow ability on an enemy” that sounds simple but blink arrow actually takes two different targets, the second being the teleport position adjacent to the first target, thus how does the behavior script know what “Use on an enemy” means??

There is a concept of result cache which is data collected during the virtual execution of the ability for drawing UI, so hypothetically you could build a graph of potential movement squares with all the different decisions in a given ability and then dyjsktra's it searching for a path that satisfies a declared set of end-goals “target enemy is damaged” or “target enemy is closer to you than they started”

The issue with this is that hypothetically you would be copying the entire game state in every node of a giant combinatorial explosive behavior graph, which will probably go nuclear and die for performance. But maybe it's worth trying to see!

#gamedev #chron4

| 🌐 | 🙋‍ | @britown@blog.brianna.town