EvolvingBehavior

Image showing several zombie robots chasing and reaching for another robot.

Summary

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

Research Topics

Non-Player Character Behavior | Behavior Trees | Genetic Programming | Mixed-Initiative Content Creation | PCG

Contributors

Erica Kleinman | Sabbir Ahmad | Muhammad Ali | Jim Howe | Luis Soto | Sarthak Shrivastava
Zheng Fang | Alex Grundwerg | Isha Srivastava | Stacy Marsella | Magy Seif El-Nasr

Description

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.

Status

In Progress

References

Isla, Damian. 2005. “Handling Complexity in the Halo 2 AI.” In Game Developers Conference. Vol. 2005.
Koza, John R. 1989. “Hierarchical Genetic Algorithms Operating on Populations of Computer Programs.” In Proceedings of the 11th International Joint Conference on Artificial Intelligence - Volume 1, 768–774. IJCAI’89. San Francisco, CA, USA: Morgan Kaufmann Publishers Inc. http://dl.acm.org/citation.cfm?id=1623755.1623877.
Lim, Chong-U, Robin Baumgarten, and Simon Colton. 2010. “Evolving Behaviour Trees for the Commercial Game DEFCON.” In , 6024:100–110. Berlin, Heidelberg: Springer. https://doi.org/10.1007/978-3-642-12239-2_11.
Perez, Diego, Miguel Nicolau, Michael O’Neill, and Anthony Brabazon. 2011. “Evolving Behaviour Trees for the Mario AI Competition Using Grammatical Evolution.” In , 6624:123–32. Berlin, Heidelberg: Springer. https://doi.org/10.1007/978-3-642-20525-5_13.

Publications

Partlan, Nathan, Luis Soto, Jim Howe, Sarthak Shrivastava, Magy Seif El-Nasr, and Stacy Marsella. 2022. “EvolvingBehavior: Towards Co-Creative Evolution of Behavior Trees for Game NPCs.” In Foundations of Digital Games. ACM Press. https://doi.org/10.1145/3555858.3555896.
Partlan, Nathan, Erica Kleinman, Jim Howe, Sabbir Ahmad, Stacy Marsella, and Magy Seif El-Nasr. 2021. “Design-Driven Requirements for Computationally Co-Creative Game AI Design Tools.” In Foundations of Digital Games, 12. Montreal QC, Canada: ACM. http://arxiv.org/abs/2107.13738.
Partlan, Nathan, and Magy Seif El-Nasr. 2018. “Towards Generating AI for Generative Worlds: Evolving Behavior Trees in Unreal Engine 4.” SEEDS, December 19, 2018. http://www.procjam.com/seeds/issues/3/npc.txt.html.