BGEN

Procedural Evolution of Behavior Trees in Unreal Engine 5

Presentation View Source Code Read Thesis

Project Description

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.

Current Progress

The system architecture is currently functional with the following modules implemented:

🧬 Genetic Simulation Manager

Implemented the "God Object" that controls population lifecycles, manages time dilation for accelerated training, and tracks generation metadata.

🌳 Dynamic BT Construction

Engineered a C++ system (CustomBehaviourTree) to instantiate UBehaviorTree assets at runtime, allowing for dynamic injection of Nodes and Decorators.

⚔️ Mutation Pipeline

Developed operational genetic operators including Subtree Swap (Crossover) and Parameter Perturbation (Mutation) to evolve agent logic.

📊 Fitness Evaluation

Created a telemetry system that tracks agent metrics (Damage Dealt, Survival Time, Movement Efficiency) to calculate fitness scores for selection.

Development Log

Weekly breakdown of system architecture and implementation (Oct - Dec 2025).

Oct Week 1
Headless Mode & Sim Speed

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.

Oct Week 2
Asset Persistence System

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.

Oct Week 3 - 4
Visual Graph Generation & Structure

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.

Nov Week 1
Simulation Manager ("God Object")

Created the central manager class responsible for spawning agents, tracking round time, and resetting the arena state based on the previous performance benchmarks.

Nov Week 2
Agent "Brain" Setup

Setup the base AIController and Blackboard components. Created BT task nodes (Attack, Find player, Move to player) that the AI will eventually choose between.

Nov Week 3
Dynamic BT Construction

Successfully instantiated a UBehaviorTree from scratch using C++ without the editor. Created the `CustomBehaviourTree` class.

Nov Week 4
Genetic Operators (C++)

Wrote the core C++ structs for the Genetic Programming. Defined the structure and implemented the Mutation logic to modify the trees.

Dec Week 1
Fitness Evaluation

Implemented the scoring system. Validated that agents who survived longer and dealt damage received higher fitness.

Dec Week 2 (Current)
Preparing for Project Seminar

Writing neccessary papers and preparing presentation.

Thesis References

The research and methodology for this project are grounded in the following academic papers:

Built With