HeadlinesBriefing favicon HeadlinesBriefing.com

Elden Ring's Low-Tech AI: FROMSOFTWARE's Goal Stack System

Hacker News •
×

FROMSOFTWARE's AI in Elden Ring relies on a surprisingly simple yet effective system built with Havok Script, a Lua-based game language. Rather than complex machine learning, the developers implemented a stack-based Goal architecture that functions as a Pushdown Automaton, allowing NPCs to execute layered behaviors through nested sub-goals.

Each AI actor maintains a stack of Goals, where the topmost goal executes per frame. Goals can push sub-goals onto the stack, which unwind when they succeed or fail. For instance, a boss might push a sequence of attack animations; if one fails, the stack resets to the parent goal, enabling dynamic response to combat outcomes. This modular approach lets developers compose intricate NPC behaviors from simple building blocks.

The system's core is the "activate" function, which randomly selects actions using weighted probabilities based on factors like enemy distance and animation cooldowns. Interrupts provide another layer, allowing immediate reactions to events like taking damage or receiving status effects. When triggered, interrupts can clear the current stack and force a new behavior, such as a fire effect prompting an instant attack response.

This low-tech approach explains the Soulsborne series' notorious NPC complexity without requiring advanced AI frameworks. The Goal stack system demonstrates how elegant simplicity can outperform black-box solutions, offering developers full control and predictable behavior in high-stakes encounters.