RTree is an on-device collaborative planning system for Unreal Engine 5. Players task NPCs with a goal, after which the NPC generates a plan composed of developer-defined actions to complete the goal. RTree does not replace existing game AI systems, but allows NPCs to respond to player requests by creating plans where each step could consist of an action or the initiation of an existing game AI system.
With RTree, a player could tell their companion: "I'm going to sneak into the rival gang's hideout. I need you to recruit 3 mercenaries and at exactly 11 pm, attack the main entrance as a distraction so I can free the prisoners." RTree decomposes this into executable game actions:
```
GoTo(Location::EnemyHideout, 23:00)
Spawn(Allies::Mercenaries, 3)
EngageNearbyEnemies()
└ BehaviorTree_AttackNearby()
```
In the above example, each action is a UE5 Gameplay Ability which implements the RTree interface. The model is then presented with these abilities as possible steps to take in pursuit of completing the user request. RTree runs 100% on-device and its reasoning system is model-agnostic, meaning developers can drop in any llama.cpp-compatible model from Hugging Face (bartowski/Qwen2.5-7B-Instruct-GGUF is included as the default model).