halo 3 objective trees: a declarative approach to multiagent coordination damián isla bungie...
TRANSCRIPT
![Page 1: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/1.jpg)
Halo 3 Objective Trees:
A Declarative Approach to Multiagent Coordination
Damián IslaBungie Studios
![Page 2: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/2.jpg)
Expectation Management
• Objective Trees are a scripting method
• The Declarative Approach is an authoring paradigm
![Page 3: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/3.jpg)
Agenda
• Encounter Design• Halo 2: Imperative Method• Halo 3: Declarative Method• Results and Conclusions
![Page 4: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/4.jpg)
Encounter Design
![Page 5: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/5.jpg)
![Page 6: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/6.jpg)
Encounter Design
• Encounters are Multiagent Systems– lots of guys– lots of things to do
• Encounters are Puzzles• Encounters are Dynamic
– they collapse in interesting and fun ways
Encounters reflect– the strategic intelligence of the characters– the “story” of the encounter
![Page 7: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/7.jpg)
Encounter Design
AI acts smart within the confines of the plan provided by the designer
Designer provides the strategic intelligence
![Page 8: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/8.jpg)
Player Approach
![Page 9: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/9.jpg)
Player Approach
![Page 10: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/10.jpg)
“Task”
![Page 11: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/11.jpg)
Task
The Mission Designers’ language for telling the AI what to do
• Territory• Behavior
– aggressiveness– rules of engagement– inhibitions
Encounter logic =
The transitioning of AI squads from one task to another
![Page 12: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/12.jpg)
![Page 13: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/13.jpg)
![Page 14: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/14.jpg)
![Page 15: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/15.jpg)
![Page 16: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/16.jpg)
The Control Stack
SquadSquad
TaskTask
Encounter Encounter LogicLogic
AI engineers, AI designers
Mission designers
IndividualIndividual
![Page 17: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/17.jpg)
Halo 2: The Imperative Method
![Page 18: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/18.jpg)
The Imperative Method
< 75% alive?
< 25% alive?
Give the designers an FSM construction tool
![Page 19: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/19.jpg)
Problems with the Imperative Method
![Page 20: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/20.jpg)
Problems with the Imperative Method
Explicit transitions n2 complexity
Generator 2Generator 3
Generator 1
![Page 21: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/21.jpg)
Halo 3: The Declarative Method
![Page 22: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/22.jpg)
But first, here’s a refresher
![Page 23: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/23.jpg)
Imperativeconst char *lol_search(const char *buff, long len) {
for (short i= 0; i < len-2; i++) {
if (buff[i]==‘L’ && buff[i+1]=‘O’) {
short i2=i+2;
while (i2<len-1 && buff[i2]=‘O’) {
i2++;
}
if (buff[i2]==‘L’) {
return &buff[i]; // yes!!!}
}}return NULL;
}
![Page 24: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/24.jpg)
Declarative
LO+L
![Page 25: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/25.jpg)
The Declarative Method
For us:
Enumerate “tasks that need doing” in the environment
Let the system figure out who should perform them
![Page 26: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/26.jpg)
The Declarative Method
Similar to “affordances”
![Page 27: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/27.jpg)
The Declarative MethodTasks have structure
• Relative priorities– “The most important thing
is to guard the door, but if you can, also guard the hallway”
• Are made up of sub-tasks– “Guarding the hallway
means guarding the front, the middle and the rear of the hallway.”
• Finite capacity– “Guarding the rear of the
hallway is a three-man job”
![Page 28: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/28.jpg)
Behavior Trees
(Handling Complexity in the Halo 2 AI, GDC 2005)
Takeaways:1. Prioritized-list decision
scheme2. Behaviors are self-describing
We are not making a single choice.
We are finding a distribution across all choices.
melee
shoot
grenade
uncover
pursue
cover
sleep
fight
search
hide
idle
root
![Page 29: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/29.jpg)
Task Trees?
Generator 2Generator 3
Generator 1
![Page 30: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/30.jpg)
Task Trees?
24 guys24 guys
root fallback
forward
laststand
fallback
forward
laststand
fallback
forward
laststand
generator 2
generator 3
generator 1
88
88
88
88
00
00
88
00
00
88
00
00
![Page 31: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/31.jpg)
Halo 3 AI Objective Trees
The structure:• A Tree of Prioritized Tasks• Tasks are self-describing
– priority– activation script-fragments– capacities
The Algorithm:• Pour squads in at the top• Allow them to filter down to the
most important tasks to be filling RIGHT NOW
Basically, it’s a plinko machine.
![Page 32: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/32.jpg)
The Dynamic Plinko Machine
• Tasks turn themselves on and off
• Squads pulled UP, on activation of a higher-priority task
• Squads pushed DOWN, on deactivation of the task they’re in
![Page 33: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/33.jpg)
g3 laststand
3 GeneratorsRevisited
g1_group g1 alive max 10
root
g1 forward >75%
g1 fallback >50%
g2_group g2 alive max 10
g2 fallback >50%
g2 forward >75%
g3_group g3 alive max10
g3 fallback >50%
g3 forward >75%
g1 laststand
g2 laststand
root
g1 laststand
g2 laststand
g3 forward >75%
g3 laststand
![Page 34: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/34.jpg)
priority
task name
condition
other stuff
runtime feedback
![Page 35: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/35.jpg)
The Algorithm
![Page 36: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/36.jpg)
The Algorithm• Consider a subtree fragment• Determine which children are
active– Squads in inactive tasks assigned
back up to parent
• Consider top priority group• Collect squads to attempt to
distribute– Squads currently in parent– Squads in lower-priority tasks
• Distribute Squads• Recurse for children in top
priority-group• Iterate to next “priority group”
![Page 37: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/37.jpg)
Squad Distribution
Formally, we have• set S of n squads• set T of m tasks
Now, find a mapping
Such that:1.Task-Capacity Constraints are respected2.Cost function H(F) is minimized
![Page 38: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/38.jpg)
Squad Distribution
1. Respect Task-Capacity Constraints
# guys assigned to task t ≤ capacity(t)
(BTW, this is called bin-packing. And it’s NP-Hard.)
55 8811
1212 1515 88
![Page 39: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/39.jpg)
Squad Distribution
2. Minimize cost function H(F)
![Page 40: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/40.jpg)
Squad Distribution
2. Minimize cost function H(F)
• H(F) gives us a basis for choosing one distribution over another
• H(F) allows us to weigh competing concerns
![Page 41: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/41.jpg)
Squad Distribution
2. Minimize cost function H(F)
A class of cost functions:
We use
![Page 42: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/42.jpg)
A Greedy Approach
while (S is not empty)
find pair (s,t) that give the minimum H(s,t) for all S x T (where adding s to t would not exceed t’s capacity)
if (s,t)assign(s, t)capacity(t) = capacity(t) - size(s)S = S – s
else end
![Page 43: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/43.jpg)
Refinements
![Page 44: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/44.jpg)
Filters
Particular tasks only available to particular kinds of guys
E.g.– Must be of character type X– Must be in vehicles– Must NOT be in vehicles– Snipers
“Filters”• Specify occupation conditions (as opposed to
activation conditions)• “Trivially” implemented as an inf return value
from H(s, t)• Helpful for the “spice”
![Page 45: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/45.jpg)
Further Task Refinements
Activation• Latch on• Latch off / exhaustion
Exhaustion• Death count• Living count
Assignment• One-time assignment
![Page 46: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/46.jpg)
Case Studies
![Page 47: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/47.jpg)
Case Study #1:
Leadership
Want to have leaders and followers
• Brute and three grunts• Brute Chieftan and brute
pack
Gameplay• Leaders provide structure
to encounter• Leader death “breaks”
followers
![Page 48: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/48.jpg)
Case Study #1: Leadership
Two Parts:
1. Leadership-based filters– Core task: “leader” filter– Peripheral tasks: “NO leader” filter
2. Task “broken” state– Task does not allow redistribution in or
out while broken– NPCs have “broken” behaviors
![Page 49: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/49.jpg)
Case Study #2: Player pickup
Vehicle encounters are not fun without a vehicle
Gameplay• When the player needs a vehicle, allies go pick
him up
![Page 50: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/50.jpg)
Case Study #2: Player pickup
Implementation: one dedicated player-pickup task per encounter
Three parts:1. vehicle filter2. player_needs_vehicle() script
function3. driver player_pickup behavior
And that’s it!
![Page 51: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/51.jpg)
Summaries
![Page 52: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/52.jpg)
Badness Summary
• Requires designer training
• Sometimes awkward relationship between scripting system and Objectives
• Tying together allied and enemy “fronts” was complicated.
• The squad wasn’t always the best level at which to do the bucketing– e.g. give a guy a sniper rifle ... shouldn’t he then
be allowed to occupy a “sniper” task?
![Page 53: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/53.jpg)
Production Summary• The Goal: provide a powerful tool for designers to
control strategy-level decision-making for a large group of characters
• Flexible enough to incorporate plenty of designer-requested features / modifications
• Great for Prototyping– became much more complicated as we neared shippable
encounter state
• One-stop-shop for encounter construction
• Design of the system driven from the UI outwards
![Page 54: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/54.jpg)
Technique Summary
Declarative authoring– less direct control– less flexibility– more concise representation– greater manageability– better game
![Page 55: Halo 3 Objective Trees: A Declarative Approach to Multiagent Coordination Damián Isla Bungie Studios](https://reader033.vdocument.in/reader033/viewer/2022061306/55147891550346b0158b53dc/html5/thumbnails/55.jpg)
is hiring!
Artists, engineers, designers …
… and an AI Lead :’(
(Visit www.bungie.net/jobs for all available positions.)