9. 本日のコンテンツ(参考文献)
• FINAL FANTASY XV におけるキャラクターAIの意思決定システム
• FINAL FANTASY XV -EPISODE DUSCAE- のアニメーション ~接地
感向上のためのとりくみ~
SQUARE ENIX PUBLICATIONS
• http://www.jp.square-enix.com/tech/publications.html
14. 参考文献
GAME AI PRO 3 (2017/6) 世界中から集められた記事をもとに2年ごとに発行される
http://www.gameaipro.com/
15. 参考文献
Predictive Animation Control Using Simulations and Fitted Models.
Ingimar Hólm Guðmundsson, Skubch Hendrik, Fabien Gravot and Yoichiro Miyake
Ambient Interactions: Improving believability by leveraging Rule-based AI
Hendrik Skubch
Logging Visualization in FINAL FANTASY XV
Matthew W. Johnson, Fabien Gravot, Shintaro Minamino, Ingimar Gudmundsson,
Hendrik Skubch, and Miyake Youichiro
Guide to Effective Autogenerated Spatial Queries
Eric Johnson
A Character Decision-Making System for FINAL FANTASY XV by combining
Behavior Trees and State Machines
Youichiro Miyake, Youji Shirakami, Shimokawa Kazuya, Kousuke Namiki, Tomoki,
Komatsu, Tatsuhiro Joudan, Prasertvithyakarn Prasert, Takanori Yokoyama
30. 2 第一次AIブーム(1960年代)
もし A ならば B
もし B ならば C
よって、
もし A ならば C
シンボルによる人工知能
(記号主義)
ニューラルネットによる人工知能
(コネクショニズム)
推論ベース ニューラルネット
誕生
31. 3 第二次AIブーム(1980年代)
IF (A) then B
IF (C) then D
IF (E) then F
IF (G) then H
IF ( I ) then J
シンボルによる人工知能
(記号主義)
ニューラルネットによる人工知能
(コネクショニズム)
ルールベース
新しい学習法=
逆伝搬法
37. Deep Q-Learning
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves,
Ioannis Antonoglou, Daan Wierstra, Martin Riedmiller (DeepMind Technologies)
Playing Atari with Deep Reinforcement Learning
http://www.cs.toronto.edu/~vmnih/docs/dqn.pdf
画面を入力
操作はあらかじめ教える
スコアによる強化学習
39. 学習過程解析
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves,
Ioannis Antonoglou, Daan Wierstra, Martin Riedmiller (DeepMind Technologies)
Playing Atari with Deep Reinforcement Learning
http://www.cs.toronto.edu/~vmnih/docs/dqn.pdf
40. • Pπ ロールアウトポリシー(ロールアウトで討つ手を決める。
Pπ(a|s) sという状態でaを討つ確率)
• Pσ Supervised Learning Network プロの討つ手からその
手を討つ確率を決める。Pσ(a|s)sという状態でaを討つ確
率。
• Pρ 強化学習ネットワーク。Pρ(学習済み)に初期化。
• Vθ(s’) 局面の状態 S’ を見たときに、勝敗の確率を予測
する関数。つまり、勝つか、負けるかを返します。
Mastering the game of Go with deep neural networks and tree search
http://www.nature.com/nature/journal/v529/n7587/full/nature16961.html
https://deepmind.com/research/alphago/
117. メタ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 の事例を見てみる。
119. メタ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
より具体的なアルゴリズム
121. メタ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) と
言う。
122. メタ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
123. メタ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
124. 安全な領域までの道のり(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
127. 敵出現領域
背後 前方
Michael Booth, "The AI Systems of Left 4 Dead," Artificial Intelligence and Interactive Digital Entertainment Conference at Stanford.
http://www.valvesoftware.com/publications.html
前方と背後のプレイヤー群から見えてない部屋に、
モンスターを発生させる。
128. モンスター・アイテム出現頻度
敵の種類、アイテムの種類ごとに出現頻度が違うが、頻度に応じて発生させる。
高頻度
低頻度
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 (中頻度)
129. ボス出現アルゴリズム
(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
130. 具体的なアルゴリズム
(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
134. Procedural Generation in WarFrame
• Warframe ではダンジョンが自動生成される。
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
135. Black Combination in WarFrame
• ブロックを組み合わる
• 完全に零からの生成
ではない。
このような生成のことを
Semi-procedural と言う。
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
138. スタートポイント、出口、目的地の
自動生成
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
139. ヒートマップ(影響マップ)を用いて
ゲーム中にプレイヤーの周囲を自動解析
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
ヒートマップ(影響マップ)とは、対象(ここではプレイヤー)を中心に、位置に温度(影響度)を
与える方法です。距離に応じて減衰します。また時間が経つと、周囲に熱が拡散します。
142. アクティブ・エリアセット(Active Are Set)
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
アクティブ・エリアセットは、プレイヤーの周囲の領域で、
リアルタイムにメタAIがゲームを調整する領域
144. メタAI (AI Director,)による
動的ペース調整
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
145. メタAI(自動適応ペーシング)
メタAI (AI Director,)による
動的ペース調整
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
146. メタAIによる出会うモンスターの数の大域調整
Daniel Brewer, AI Postmortems: Assassin's Creed III, XCOM: Enemy Unknown, and Warframe (GDC2015)
http://www.gdcvault.com/play/1018223/AI-Postmortems-Assassin-s-Creed
プレイヤーのスタート地点から出口までの道のりで、
コンスタントにモンスターと出会うようにする。
182. IF ( 前置宣言文 ) then (後置宣言文)
ルールベース意思決定
Rule-based Decision Making
ルール
ここでは、この形式の制御文をルールと言う。
もちろん、IF ( … IF (.... IF… ) ) ) のような入れ子構造の制御文も
ルールベースと呼ぶが、
ルールベースと言えば、基本的には、ルールを1つの単位として、
意思決定を行う、という意味となる。
183. 推論エンジン
A B C D E
T F F F F
T T F F F
T T F T F
T T T T F
T T T T T
F T T T T
F F F T T
……………………………
……………………………
…………………
T: True F: False
ID 0 : IF A THEN B
ID 1 : IF A && D THEN C
ID 3 : IF C THEN E
ID 4 : IF B THEN D
ID .. :
ID 4 : IF E THEN ~A
ルール内の条件部がtrueの時、そのルールが発火する(fired)
すると言う。発火したルールの宣言文は true となり、またそれ
が別のルールを発火させる。
発火をくり返して、true/False
が変化して行く様子
184. ルール制御
ID 0 : IF …. THEN …
ID 1 : IF …. THEN …
ID 3 : IF …. THEN ….
ID 4 : IF …. THEN …
ID .. :
ID 4 : IF …. THEN …
Priority: 3
Priority: 1
Priority: 4
Priority: 5
Priority: 2
ルールに固定、あるいは変動プライオリティ(優先度)をつけて制御を行う。
あるいはランダムにルールをピックアップする場合もある。戦略思考、キャラク
ターの挙動などでよく使われる。
Priority: -
制御
ルール= IF ( 行動条件文 ) then (動作命令文)
185. (例) ルール制御
ID 0 : IF …. THEN …
ID 1 : IF …. THEN …
ID 3 : IF …. THEN ….
ID 4 : IF …. THEN …
ID .. :
ID 5 : IF …. THEN …
Priority: 3Priority: 1
Priority: 4
Priority: 5
Priority: 2
或いは、状況判断思考によってルールを振り分ける。
戦略思考、キャラクターの挙動などでよく使われる。
Priority: -
制御
思考
ルール= IF ( 行動条件文 ) then (動作命令文)
186. 応用可能性例
http://gomibako.symphonic-net.com/vote.cgi?genre=act_b&rating=9
ID 0 : IF (敵確認) THEN (逆方向)
ID 1 : IF (誰もいない) THEN (ランダムウォーク)
ID 2 : IF (フルーツ発見) THEN (フルーツゲット)
ID 3 : IF (パワー発見) THEN (パワーゲット)
ID 0 : IF (敵強い) THEN (サンダガ)
ID 1 : IF (自分弱い) THEN (弱い敵に攻撃)
ID 2 : IF (HP<20) THEN (ケアル)
ID 3 : IF (パワー発見) THEN (パワーゲット)
こうなっているというのではなく、こういうふうに応用できる例
パックマンなど
RPGなど
187. The Sims 3 における応用
街全体をソーシャルにシミュレーションして人との関係を楽しむゲーム。
たくさんのAIを「人間らしく」制御しなければならない。
特徴付けにプロダクションルールを採用。
Richard Evans, "Modeling Individual Personalities in The Sims 3", GDC 2011
http://www.gdcvault.com/play/1012450/Modeling-Individual-Personalities-in-The
205. F.E.A.R.におけるゴール指向プランニング
Genre:Horror FPS
Developer: Monolith Production
Publisher : SIERRA
Hardware: Windows
Year: 2004
Agent Architecture Considerations for Real-Time Planning in Games (AIIDE 2005)
http://web.media.mit.edu/~jorkin/AIIDE05_Orkin_Planning.ppt
210. シンボル
kTargetAtme = ture
この兵士Bは自分を狙っているkTargetIsDead = ture
この兵士Aは死んだ
kWeaponIsLoaded = false
私Cの武器は装填済みでない
Jeff Orkin, “3 States and a Plan: The AI of F.E.A.R.",
http://web.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.zip
251. Halo2: Orders & Styles
Order
Initial
If killed X enemies
If X dead
Order
fallback
Style A
Style C
Order
push
forward
Style B
Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
252. Halo2: Orders & Styles
Order
Initial
If killed X enemies
If X dead
Order
fallback
Style A
Style C
Order
push
forward
Style B
まず、マップを3つの領域に区別する。
「それぞれの領域=戦術ポイント・グループ」として定義する。
Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
253. Halo2: Orders & Styles
Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
254. Halo2: Orders & Styles
Order
Initial
If killed X enemies
If X dead
Order
fallback
Style A
Style C
Order
push
forward
Style B
次にそれぞれの領域にビヘイビア・ツリーを割り当てる。
これが、その領域でAIが取る意思決定モジュールとなる。
Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
255. Halo2: Orders & Styles
Order
Initial
If killed X enemies
If X dead
Order
fallback
Style A
Style C
Order
push
forward
Style B
Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
こういうチェックボックスのツールで
マスターのビヘイビアツリーをカスタマイズする。
それぞれの領域に割り当てられたビヘイビアツリーを
「スタイル」と言う。 Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
256. Halo2: Orders & Styles
Order
Initial
If killed X enemies
If X dead
Order
fallback
Style A
Style C
Order
push
forward
Style B
次にそれぞれの領域から領域の遷移条件を定義する。
つまり、これは「領域」をステートとするステートマシンとなる。
Handling Complexity in the Halo 2 AI, D. Isla, GDC 2005
http://naimadgames.com/publications.html
260. 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
261. オブジェクトに仕込むデータ構造
Data (Class, Sate)
Graphics (sprites, z-
buffers)Animations (skeletal)
Sound Effects
Code (Edith)
-Main (object thread)
-External 1
-External 2
-External 3
パラメーター
グラフィックス
アニメーション
サウンド
メインスレッド
いろいろなインタラクションの仕方
Ken Forbus, “Simulation and Modeling: Under the hood of The Sims” (NorthWerstern大学、講義資料) ※IEで見てください。
http://www.cs.northwestern.edu/%7Eforbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/frame.htm
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
262. 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の人格モデル
267. 限界効用逓減の法則
X_Hunger
W_Hunger(-80)
-80 60
W_Hunger(60)
Δ(-80 → 60)=W_Hunger(60)*(60) - W_Hunger(-80)*(-80)
Δ (60→90) =W_Hunger(90)*(90) - W_Hunger(60)*(60)
90
W_Hunger(90)
Δ(-80 → 60) is much larger than Δ(60→90)
ある程度満たされたものを満たすより、
満たされないものをある程度満たす方が大きな満足をもたらす
Utility for hunger
ビールは一杯目が一番おいしい
268. The Sims のAIの原理
三宅陽一郎、「Spore におけるゲームAI技術とプロシージャル」 (DiGRA Japan 第14回 月例研究
http://digrajapan.org/?wpdmact=process&did=Ni5ob3RsaW5r
Ken Forbus, “Simulation and Modeling: Under the hood of The Sims” (NorthWerstern大学、講義資料)
http://www.cs.northwestern.edu/%7Eforbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/frame.htm
Richard Evans, Modeling Individual Personalities in The Sims 3, GDC 2010
http://www.gdcvault.com/play/1012450/Modeling-Individual-Personalities-in-The
269. The Sims 3 では、多くのムードや欲求が準備される。
行動 対象
GDC09 資料 http://www.gdcvault.com/play/1452/(307)-Breaking-the-Cookie-Cutter
274. Warfarmeにおける壁面移動
Daniel Brewer, “The Living AI in Warframe’s Procedural Space Ships” (Game AI Conference 2014) ※登録が必要なサイトです
http://archives.nucl.ai/recording/the-living-ai-in-warframes-procedural-space-ships/
プレイヤー
AI
プレイヤーが「ジャンプ・壁面走り・ジャンプ」したデータから
学習して、AIがそのデータをもとに同じ動きをする。
ジャンプ 壁面走り
ジャンプ