In this project, we are building a computational co-creativity tool and library for game NPC designers in Unreal Engine 4. Working with designer-driven initial trees and objectives, the library evolves and suggests new options for game agents. Learn more at: evolvingbehavior.npc.codes
We are developing a library and computational co-creativity (computer and human collaboration) tool for game NPC design in Unreal Engine 4. Starting with a hand-designed behavior tree, we evolve a set of new behavior trees that maximize a designer-defined set of objectives. By repeating this process over multiple generations and presenting the best resulting behavior trees to designers, the tool can find and suggest creative and novel behavior. In this way, we hope to spark designer creativity and broaden the capabilities of their NPCs in unforeseen situations.
One of my hopes with this project is to develop a counter to the current exploitative trends of so-called "large language models" (LLMs) and other large neural networks, by creating a tool with alternative techniques that use only designers' consensually-provided inputs, provide flexibility and control at all stages of the creative process, and produce output that is interpretable and iteratively editable. By involving designers in the process of design and evaluation of the tool, I hope to produce something that helps people make games, rather than displacing and hiding their work.
Behavior trees are an expressive and widely-used architecture for specifying game agent behavior (Isla 2005). They represent decision-making in a tree structure, with internal nodes ("composites" and "decorators") controlling the flow of decision-making and leaf nodes ("tasks") representing the actions required to execute the desired behavior. This tree can be thought of as a sort of "program" for the agent to follow.
Genetic programming, a form of evolutionary algorithm, is a technique for evolving programs, specified as trees, to maximize a specific objective (Koza 1989). It has usually been applied to "parse trees" for simple programming languages, but it is very naturally applicable to behavior trees. Some prior work has applied genetic algorithms to behavior in specific, simple games such as Mario (Perez et. al. 2011) and DEFCON (Lim et. al. 2010). By building a generic library for applying genetic programming to the built-in behavior trees in Unreal Engine 4, we can explore the general applicability of this technique. Because Unreal Engine 4 is popular for modern game development, we can also iterate on mixed-initiative tools to make the library more accessible and applicable for real game designers.
We tested the first version of the tool on an open-source third-person shooter, "Epic Survival Game," by Tom Looman. We intentionally disabled the zombie behavior trees in the game, preventing them from effectively patrolling the map, chasing, and attacking the player. Over a few generations, however, the evolved behavior trees regained these capabilities, quickly providing effective zombies that could be selected and further tweaked by a human designer.