Michal Baránek
Supervisor: Alexander Šimko
AI has been crucial since the earliest arcade systems. As games became
larger and more dynamic,
developers faced a new challenge.
The systems needed to be predictable, efficient, and understandable.
Behavior Trees (BTs) emerged as the dominant framework for scalable decision-making.
A hierarchical model representing AI logic as a directed tree of nodes, determining how an agent chooses actions.
An evolutionary computation technique that evolves computer programs, typically represented as tree structures.
The manual design of BTs for autonomous agents creates these complications:
UBehaviorTree node structures.
UBehaviorTree nodes in memory.
Uses -benchmark launch option.
Ensures Deterministic, Maximum-FPS simulation speed.
And many more planned.
Key milestones achieved in the prototype.
Function OnLevelReload(World):
TargetWorld = World
ActiveAgent = null
PreparePlayer()
RunEvolutionStep()
Function RunEvolutionStep():
CandidateTree = NewTree(BestTree) // Hill Climbing Logic
Mutate(CandidateTree)
// Spawn & Possess
SpawnPos = GetSpawnLocation()
Enemy = SpawnActor(EnemyClass, SpawnPos)
Controller = SpawnActor(AIClass, SpawnPos)
Controller.Possess(Enemy)
// Assign Tree & Track
BehaviourTree = TreeWrapper.AssignTree(CandidateTree)
Controller.AssignTree(BehaviourTree, BlackboardData)
ActiveAgent = {Enemy, TreeWrapper, Controller}
StartSimulation(30.0)
Function StartSimulation(Timeout):
UnpauseGame()
Wait(2.0) // Physics warmup
ActiveAgent.Controller.RunAssignedTree()
ActiveAgent.FitnessTracker.BeginTracking()
SetTimer(StopSimulation, Timeout)
Function StopSimulation():
PauseGame()
Fitness = ActiveAgent.FitnessTracker.CalculateFitness()
// Restart
GenerationCount++
OpenLevel(CurrentLevelName)
Quantifying speedup & visualizing intelligence.
By decoupling game logic from rendering framerate, we achieve massive time acceleration.
30 seconds of gameplay ≈ 1 second of compute.
[23.40.33:467]LogGeneticGeneration: Warmup Complete.
[23.40.34:477]LogGeneticGeneration: TIMEOUT! Simulation time limit reached.
Log snippet showing a full 30 second timeout simulating in 1 second.
[LogGeneticGeneration] --- STARTING WORKFLOW ---
[LogTemp] LoadBehaviorTree: Loaded BT_EnemyUnleashed
// INITIAL STRUCTURE
[LogTemp] Display: L-- Sequence
[LogTemp] Display: |-- CheckAreaForPlayer
[LogTemp] Display: |-- MoveToPlayer
[LogTemp] Display: L-- Attack
[LogGeneticGeneration] [Step 1] Loaded Original.
[LogTemp] Found 3 valid Task classes for mutation.
Hand-authored logic. Standard patrol behavior.
Structure: Check → Move → Attack
// MUTATION EVENT: INSERTION
[LogTemp] MutateTree: Inserted BTTask_Attack_C_1
[LogGeneticGeneration] [Step 2] Mutated (In-Memory)
[LogGeneticGeneration] [Step 3] Saved Gen1.uasset
// NEW STRUCTURE
[LogTemp] Display: L-- Sequence
[LogTemp] Display: |-- CheckAreaForPlayer
[LogTemp] Display: |-- MoveToPlayer
[LogTemp] Display: |-- Attack
[LogTemp] Display: L-- Attack
Change: Added second Attack node.
// MUTATION EVENT: REPLACEMENT
[LogTemp] MutateTree: Replaced CheckArea with MoveTo
[LogGeneticGeneration] [Step 5] Mutated (In-Memory)
[LogGeneticGeneration] [Step 6] Saved Gen2.uasset
// FINAL STRUCTURE
[LogTemp] Display: L-- Sequence
[LogTemp] Display: |-- MoveToPlayer
[LogTemp] Display: |-- MoveToPlayer
[LogTemp] Display: |-- Attack
[LogTemp] Display: L-- Attack
Change: Replaced CheckAreaForPlayer initial logic.
Foundational research validating the BGEN approach.
Schrum & Miikkulainen (2008)
1. Start with simple player behavior.
2. Identify promising bot individuals.
3. Increase player complexity.
4. Further evolve bots against new challenge.
Pereira et al. (2021)
Georgios N. Yannakakis
Too many or too few steps to kill the player is not optimal.
Higher standard deviation of steps taken to kill = more interesting.
Entropy of predator visits across regions (cells) of the world.