67. The Sims シリーズのAIの作り方
人をダイナミクス(力学系、動的な数値の仕組み )として動かす。
世界を動かす PeerAI(=キャラクターAI) を構築。
Sub
Peer
Meta
Meta
Peer
Sub
[原則] 周囲の対象に対する、あらゆる可能な行動から、
ムード(幸せ) 係数を最大化する行動を選択する。
Sims (not under direct player control) choose what to do by selecting, from all of the
possible behaviors in all of the objects, the behavior that maximizes their current happiness.
Will Wright, AI: A Design Perspective (AIIDE 2005)
http://www.aaai.org/Papers/AIIDE/2005/AIIDE05-041.ppt
Kenneth Forbus, Will Wright, “Some notes on programming objects in The Sims – Example”
http://www.qrg.cs.northwestern.edu/papers/Files/Programming_Objects_in_The_Sims.pdf
68. The Sims における「モチーフ・エンジン」
Ken Forbus, “Simulation and Modeling: Under the hood of The Sims” (NorthWerstern University)
http://www.cs.northwestern.edu/%7Eforbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/frame.htm
Data
- Needs
- Personality
- Skills
- Relationships Sloppy - Neat
Shy - Outgoing
Serious - Playful
Lazy - Active
Mean - Nice
Physical
- Hunger
- Comfort
- Hygiene
- Bladder
Mental
- Energy
- Fun
- Social
- Room
Motive Engine
Cooking
Mechanical
Logic
Body
Etc.
AIの人格モデル
87. 全体の流れ
Beats システム
Michael Mateas and Andrew Stern
Façade: An Experiment in Building a Fully-Realized Interactive Drama
Game Developers Conference, Game Design track, March 2003
88. ドラマ・ジェネレーター 「Facade」
sequential behavior AnswerTheDoor()
{
WME w;
with (success test f w = (KnockWME) g )
wait;
act sigh();
subgoal OpenDoor();
subgoal GreetGuest();
mental act f deleteWME(w); }
sequential behavior OpenDoor() {
precondition {
(KnockWME doorID :: door)
(PosWME spriteID == door pos :: doorPos)
(PosWME spriteID == me pos :: myPos)
(Util.computeDistance(doorPos, myPos) > 100)
}
speci¯city 2;
// Too far to walk, yell for knocker to come in
subgoal
YellAndWaitForGuestToEnter(doorID);
}
sequential behavior OpenDoor() {
precondition { (KnockWME doorID :: door) }
speci¯city 1;
// Default behavior - walk to door and
open }
振る舞い
ゴール
振る舞い
ゴール
振る舞い
ゴール行動
振る舞い
ゴール行動 行動
条件判定
条件判定
ゴールシステム
" Michael Mateas and Andrew Stern A Behavior Language for Story-based Believable Agents", appeared in Artificial Intelligence and Interactive Entertainment,
AAAI symposium, March 2002
89. ドラマ・ジェネレーター 「Facade」
Interactive Story
協調の仕方
ゴール
Member:
Trips ,Grace
Mission
酒を進める
( Tripsの役割
Grace の役割))
The wogglesのAI
でも使われた方法
Trip Grace
ゴールが2人のエージェントに打診
Trips はこのミッションの役割を
受けられる状態にあるか?
Graceはこのミッションの役割を
受けられる状態にあるか?
サブゴール サブゴール
両方が Yes なら
Michael Mateas and Andrew Stern A Behavior Language: Joint Action and Behavioral Idioms
90. ドラマ・ジェネレーター 「Facade」
Interactive Story
協調の仕方
joint sequential behavior OfferDrink() {
team Grace, Trip;
// The steps of Grace’s and Trip’s OfferDrink()
// behaviors differ.
}
joint sequential behavior OfferDrink() {
team Trip, Grace;
// wait for Trip to say first line
with (success_test { OfferDrinkMemory
(CompletedGoalWME name == iInitialDrinkOffer
status == SUCCEEDED)})
wait;
subgoal iLookAtPlayerAndWait(0.5);
// react to Martini suggestion
with (synchronize) subgoal jSuggestMartini();
with (synchronize) subgoal
jFancyCocktailShakers();
}
joint sequential behavior
OfferDrink() {
team Trip, Grace;
with (post-to OfferDrinkMemory)
// Individual behavior for initial
offer
subgoal iInitialDrinkOffer();
subgoal
iLookAtPlayerAndWait(0.5);
with (synchronize) subgoal
jSuggestMartini();
// react to Grace’s line about fancy
shakers
with (synchronize) subgoal
jFancyCocktailShakers();
}
GraceTrip
(At the beginning of the behavior, Trip starts walking
to the bar. If he gets to the bar before the end of the
behavior, he stands behind it while delivering lines.)
Trip: A beer? Glass of wine? (Grace smiles at
player. Short pause)
Trip: You know I make a mean martini. (Grace
glances at Trip with slight frown partway into line.
At the end of line, rolls her eyes at the ceiling.)
Grace: (shaking her head, smiling) Tch, Trip just
bought these fancy new cocktail shakers. He’s
always looking for a chance to show them off. (If
Trip is still walking to the bar, he stops at “shakers”.
At “shakers” Trip looks at Grace and frowns slightly.
At the end of the line he looks back at player and
smiles. If he was still on the way to the bar, he
resumes walking to the bar).
ドラマ生成
" Michael Mateas and Andrew Stern A Behavior Language for Story-based Believable Agents", appeared in Artificial Intelligence and Interactive Entertainment, AAAI symposium, March 2002
109. メタAI Left 4 Dead の事例
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and
Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
今回は Left 4 Dead の事例を見てみる。
111. メタAI(=AI Director)によるユーザーのリラックス度に応じた敵出現度
ユーザーの緊張度
実際の敵出現数
計算によって
求められた
理想的な敵出現数
Build Up …プレイヤーの緊張度が目標値を超えるまで
敵を出現させ続ける。
Sustain Peak … 緊張度のピークを3-5秒維持するために、
敵の数を維持する。
Peak Fade … 敵の数を最小限へ減少していく。
Relax … プレイヤーたちが安全な領域へ行くまで、30-45秒間、
敵の出現を最小限に維持する。
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
より具体的なアルゴリズム
113. メタAIが作用を行う領域
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
メタAIが作用(敵の生成・
消滅)を行う領域を、
AAS(= Active Area Set) と
言う。
114. メタAIが作用を行う領域
(AAS=Active Area Set)
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
115. メタAIが作用を行う領域
(AAS=Active Area Set)
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
116. 安全な領域までの道のり(Flow Distance)
メタAIはプレイヤー群の経路を
トレースし予測する。
- どこへ来るか
- どこが背面になるか
- どこに向かうか
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
119. 敵出現領域
背後 前方
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
前方と背後のプレイヤー群から見えてない部屋に、
モンスターを発生させる。
120. モンスター・アイテム出現頻度
敵の種類、アイテムの種類ごとに出現頻度が違うが、頻度に応じて発生させる。
高頻度
低頻度
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
Wanderers (高頻度)
Mobs(中頻度)
Special Infected (中頻度)
Bosses (低頻度)
Weapon Caches (低頻度)
Scavenge Items (中頻度)
121. ボス出現アルゴリズム
(1) N体を予想される逃走経路上に配置
(2) 3つの出現イベントパターン
(何もいない、を含む)
(例) Tank, Witch, 何もいない
(3) 同じパターンのくり返しは禁止
(例) Witch, 何もいない、Witch はOK。
Witch, Witch はだめ。
何もいない
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
Tank Witch Witch Tank Witch Tank
122. 具体的なアルゴリズム
(1) 各エリアに、出現数 N を決定する
(2) 出現数Nは予想される逃走経路の長さと
要求される密度によって計算される。
(3) あるエリアがAAS の中に入るとクリー
チャーがN体生成される。
(4) そのエリアがAAS の外に出ると生成が中
止され、クリーチャーは消滅される。
(5) Nはそのエリアがプレイヤーから見えてい
る場合、或いは、プレイヤーがリラックス
モードの場合には、強制的に0になる。
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html