• 沒有找到結果。

Digital games design-Game AI II

N/A
N/A
Protected

Academic year: 2021

Share "Digital games design-Game AI II"

Copied!
31
0
0

加載中.... (立即查看全文)

全文

(1)

數位遊戲設計

DIGITAL GAMES DESIGN

Week15 28/May/2008 Instructor: I-Hsien Ting

(2)

AI for Games Part II

Finite State Machine

Behavioral Cloning

Fuzzy Logic

Probability

(3)
(4)

Finite State Machine (有限狀

態機)

Intelligent Agents

(5)

Finite State Machine

Decopose an agent’s behavior into easily

manageable chunks (“states”)

Transitions between the states are activated

by environment or agent-internal events

(6)

Why FSM??

Quick and simple to implement

Easy to debug

Computationally efficient

Intuitive

(7)

Famous Example: Who’s Who of

FSMs

Pac-Man ghost

Evade and Chase states, Evade state same for all

ghosts, Chase state individual to each ghost

Quake

States include FindHealth, SeekCover, RunAway,

Weapons also are implemented as FSMs: Move, TouchObject, Die

FIFA

 Strike, Dribble, ChaseBall, MarkPlayer

Warcraft

(8)
(9)
(10)

FSM Implementation

(11)

FSM Implementation

Problems of quick and dirty approach

As more state are added, program becomes more

difficult to understand, and debug

Inflexible: difficult to extend beyond original

purpose

Not possible to treat entry into and exit out of

state in a structured manner (e.g. scream when starting an attach)

FSM tend to grow quickly and become too

(12)

FSM Example

Ants

http://im.nuk.edu.tw/~iting/course/im_game_200 8a/Ants.rar Food Die Go Home Thirsty 找到毒物 找到食物 找到水 找到毒物 找到毒物 找到巢穴

(13)
(14)

Behavioral Cloning

What’s it all about?

Reconstruction of skill from an operators’ control

(or action) traces by means of machine learning

Examples:

 Flying a plane

 Operating a crane

(15)
(16)

Behavioral Cloning

Why?

Control Skills are often acquired through

experience and are sub-cognitive

Thus, it is hard to reconstruct and implement in a

computer program

(17)

Behavior Cloning

Behavior Trace

Trace is set of examples of correct control decision Each example consists of a pair

Time delay between state and action to account

for time needed by operator for state recognition and physical action

(18)

Behavior Cloning

Machine Learning

Action(Time)=f(State(Time-Delay)) Goal: learn function f from examples

(19)

Decision Tree Learning

(20)

Decision Tree Learning

(21)
(22)

Fuzzy Logic

Fuzzy Logic is an extension of classical logic

that is based on the idea of a fuzzy set.

Distance Value At 0.00..0.15 Very Close 0.10..0.35 Close 0.30..0.70 Pretty Far 0.60..0.90 Very Far 0.85..1.00

(23)

Fuzzy Logic

Distance Value At 0.00..0.15 Very Close 0.10..0.35 Close 0.30..0.70 Pretty Far 0.60..0.90 Very Far 0.85..1.00

(24)

Fuzzy Logic in Game

Control

Train, Air Condition, Robot

 E.g. Turning Smoothly

Threat Assessment

(25)

Control

Fuzzy Set 歸屬程度很左邊 0.0左邊 0.0 前方 0.0 右邊 0.47 很右邊 0.3 mFarLeft = FuzzyReverseGrade (33, -40, -50) mLeft = FuzzyTrapezoid (33, -40, -25, -15, 0) mAhead = FuzzyTriangle (33, -10, -10) mRight = FuzzyTrapezoid (33,0,15,25,40) mFarRight = FuzzyGrade (30, 30,40);

(26)

Threat Assessment

mClose = FuzzyTriangle(25, -30, 0, 30); mMedium = FuzzyTrapezoid(25, 10, 30, 50, 70); mFar = FuzzyGrade(25, 50, 70); mTiny = FuzzyTriangle(8, -10, 0, 10); mSmall = FuzzyTrapezoid(8, 2.5, 10, 15, 20); mModerate = FuzzyTrapezoid(8, 15, 20, 25, 30); mLarge = FuzzyGrade(8, 25, 30); Fuzzy Set 歸屬程度 逼近 0.17 附近 0.75 遠 0.0 零星 0.2 少量 0.73 中等 0.0 大型 0.0

(27)

Rule Matrix

逼近 附近 零星 中等 低等 低等 少量 高度 低等 低等 中等 高度 中等 低等 大型 高度 高度 中等

(28)
(29)

Random and Probability

25 % Left

25% Right

50% Back

Random (0-99)

0~24Left 25~74Back 75~99Right

(30)
(31)

Status Transfer

參考文獻

相關文件

dimensional nanomaterials for photodetectors with ultrahigh gain and wide spectral response. II.  Photon down conversion and light trapping in hybrid ZnS nanopartcles/Si

Researches of game algorithms from earlier two-player games and perfect information games extend to multi-player games and imperfect information games3. There are many kinds of

The set of concrete decision problems that are polynomial-

In digital systems, a register transfer operation is a basic operation that consists of a transfer of binary information from one set of registers into another set of

A set of kernel interfaces and APIs QEMU frontend.. EACH VM IS

◦ Action, State, and Reward Markov Decision Process Reinforcement Learning.

○ Value function: how good is each state and/or action. ○ Policy: agent’s

• Definition: A binary tree is a finite set of nodes that is either empty or consists of a root and two disjoint binary trees called the left subtree and t he right subtree2.