Procedural Evolution of Behavior Trees in Unreal Engine 5
BGEN is a thesis project exploring the intersection of Evolutionary Computation and Game AI. The goal is to develop a system that autonomously evolves Behavior Trees (BT) for enemy agents within Unreal Engine 5.
Unlike traditional AI design, where logic is hand-crafted by designers, BGEN uses a Genetic Algorithm (GA) to generate, mutate, and select behavior structures based on simulation performance. This approach aims to create unpredictable, adaptive, and increasingly challenging enemy agents without manual intervention.
The system architecture is currently functional with the following modules implemented:
Implemented the "God Object" that controls population lifecycles, manages time dilation for accelerated training, and tracks generation metadata.
Engineered a C++ system (CustomBehaviourTree) to instantiate UBehaviorTree assets at runtime, allowing for dynamic injection of Nodes and Decorators.
Developed operational genetic operators including Subtree Swap (Crossover) and Parameter Perturbation (Mutation) to evolve agent logic.
Created a telemetry system that tracks agent metrics (Damage Dealt, Survival Time, Movement Efficiency) to calculate fitness scores for selection.
Weekly breakdown of system architecture and implementation (Oct - Dec 2025).
Initial feasibility testing. Configured UE5 to run in Headless Mode to minimize GPU overhead. Stress-tested simulation speed (Time Dilation) to ensure generations could evolve rapidly without rendering frames.
Developed the pipeline for saving generated Behavior Trees to disk. Verified that runtime-generated `UBehaviorTree` assets could be serialized and reloaded in future sessions without data loss.
Deep dive into UE5's visual graph system. Encountered significant challenges deciphering the undocumented internal structure of Behavior Tree graphs. Spent weeks reverse-engineering how visual nodes are linked and stored to understand the underlying mechanics.
Created the central manager class responsible for spawning agents, tracking round time, and resetting the arena state based on the previous performance benchmarks.
Setup the base AIController and Blackboard components. Created BT task nodes (Attack, Find player, Move to player) that the AI will eventually choose between.
Successfully instantiated a UBehaviorTree from scratch using C++ without the editor. Created the `CustomBehaviourTree` class.
Wrote the core C++ structs for the Genetic Programming. Defined the structure and implemented the Mutation logic to modify the trees.
Implemented the scoring system. Validated that agents who survived longer and dealt damage received higher fitness.
Writing neccessary papers and preparing presentation.
The research and methodology for this project are grounded in the following academic papers: