1 of 22

BURSTED BEHAVIOR TREES FOR UNITY

2 of 22

Behavior Trees

Short introduction

2

3 of 22

Behavior trees

  • D. Isla (2005)
  • From the root

to leaves

  • Extended features
    • Black Board
    • Visual editor
    • Parametrized nodes

3

4 of 22

TECHNICAL BACKGROUND

Unity, Job System and Burst Compiler

4

5 of 22

UNITY

  • C# scripting
  • Single-threaded game logic
  • DOTS - answer to performance problems

5

6 of 22

6

7 of 22

JOB SYSTEM

  • Thread-safe
    • Executes a copy
  • Native containers
  • Supports BURST
  • Execution on worker threads

7

8 of 22

BURST COMPILER

  • Produces highly optimized native code
  • Code restrictions
    • No managed objects => no inheritance
    • No dynamic allocations during the execution
    • Still in development
  • Unmanaged environment
    • No garbage collection

8

9 of 22

T4 Text Templates

  • Generates text files
  • Text blocks and Control blocks
  • Integrated in Visual Studio

9

10 of 22

ARCHITECTURE

10

11 of 22

Solve hard stuff earlier

Editor-time

  • Tree design
  • Initialization code generating

Initialization

  • Memory allocation�(1 call)
  • Tree constructing

Execution

  • Tree evaluation

11

12 of 22

Architecture overview

12

13 of 22

Bursted Behaviour Trees

  • 1 job per tree instance
  • Lightweighted runtime
    • Fast setup & execution
    • No reflection, no allocation during execution
  • Sensors, Managed sensors, BlackBoard, Input arguments
  • Code generators
    • Node generator - user describes node and fills events
    • Node editor generator - generates node class for editor
    • Tree generator - generates fast tree initialization

13

14 of 22

Add node

  1. Describe node
  2. Generate partial struct
  3. Fill events

14

15 of 22

Editor

  • Based on xNode

15

16 of 22

PERFORMANCE

Bursted Behavior Trees vs Panda Behaviour vs Behavior Designer

16

17 of 22

Competitors

Panda Behaviour

  • Free
  • File format (paid interactive inspector)

Behavior Designer

  • Premium
  • Visual editor

17

18 of 22

Test case

  • Focused on the tree payload
  • Easy to scale

18

19 of 22

Results

19

20 of 22

Features

Bursted Behavior Trees vs Panda Behaviour vs Behavior Designer

20

21 of 22

21

BBT

Panda Behaviour

Behavior Designer

Custom node

any

leaves

leaves

Visual editor

yes

no

yes

Black Board

yes

no

yes

Node parameters

any

constant

constant, BB value

22 of 22

Thanks!

ANY QUESTIONS?

22

GAMEDEV�.CUNI.CZ