RPG AI

Inspired by Atlus’ Persona series, I delved into techniques for automating NPCs allied with the player.  By utilizing a goal-based architecture, the agents achieved some emergent behavior and survived battles where the odds were stacked against them.


 

The NPCs rank the actions available to them through goals bound at runtime.  With tuned functions, the actions are ranked by generating a discontent rating for each action, taking into consideration all of the goals.  The agents aim to minimize their discontent and choose the best action available given their current state.

The enemies acted randomly and only one of the “players” had healing skills.  Even without explicit communication, the agents worked together to survive the encounter.  When the party was not in danger, the healer switched between attacking and healing!  For more details about the implementation and strategies, please read this.