• Tidak ada hasil yang ditemukan

Index of /Kuliah2016-2017/KecerdasanBuatanUntukGame

N/A
N/A
Protected

Academic year: 2017

Membagikan "Index of /Kuliah2016-2017/KecerdasanBuatanUntukGame"

Copied!
23
0
0

Teks penuh

(1)

Artificial Intelligence in

Game Design

(2)

Decision Making

Based on internal and external information

Defines a current action

(“eat food”)

Changes world and internal state

“I am hungry” “There is food nearby”

(3)

“Intelligent Agent” Approach

• Reflex agent

No memory, just “if-then” rules

• Memory-based agent

Also based on current state

• Goal-based agent

Chooses actions that best help meet current goal

• Utility-based agent

Balances multiple weighted goals, choosing actions that give best

overall state Sims

Goal-based planning

input rules action

input rules action

(4)

Reflex Agents

• Example: “

orc

” reflex agent

if hitPoints < 5

then run away from player if distance to player < 2 units then attack player

if player visible

then run towards player else

move in random direction

Internal state

(5)

Scripted Actions

Visible actions usually limited to set

of animations created in advance

Often sequence of

actions (“

scripting

”)

Game AI

Self destruct sequence

Game Engine

(6)

Reflex Agents

Must consider cost of gathering inputs

if hitPoints < 5

then run away from player

if distance to player < 2 units

then attack player

if player visible

then run towards player

else

move in random direction

This requires complex computations

(7)

Hierarchical Rules

Actions often hierarchical

if hitPoints < 5

then moveTowards(player) if distance to player < 2 units then attack(player)

if player visible

then moveTowards(player) else

moveTowards(random)

(8)

Hierarchical Rules

Lowest level = actions supported by game engine

void moveTowards(object) if not facing object

then turn towards object

else if facing obstacle at distance < 2 units then turn right or left at random

(9)

Designing Hierarchies

Strategy Level

– What goal does character attempt to meet?

• Build, attack, negotiate

Tactical Level

– How does character meet current goal?

• Which city to attack

• Which resources to use

Motion Level

– What action does character take this turn?

(10)

Designing Hierarchies

• Task based

– Major tasks NPC performs

• Guard

• Patrol

• Defend

– Steps in tasks

• Wait

• Chase

• …

– …

– Motion

• Turn

• Move

• …

High level character design team (works with game designers)

Character motion team

(11)

Level of Detail in Graphics

Only render graphics at detail necessary for

what player can see

– Close up = full detail

– Far away = little detail

(12)

Level of Detail in AI

Only use full AI when necessary

– Fast approximations in other situations

– Often when NPCs “off screen” Use full passing AI

for cars visible to player

Simple rule for cars not visible to player

“Faster car has 75% chance of

(13)

Swarm Intelligence

Simple NPCs in groups can appear to cooperate

• Decision example:

if no other player shooting, I shoot if in open, run for cover and shout if in cover, reload and wait

• Orc motion example:

if NPC blocking path to player then run sideways

else run towards player

(14)

Randomness in Games

Randomness adds to playability

– Characters less predictable, more “realistic” – Greater replayability

– Rare occurrences can surprise player

Example: choice of weapon in Fight state

(15)

Randomness in Games

Goal: Randomness should not appear random

• Best solution: Randomness used to “tweak”

existing rules

if hitPoints < 5

then run away from player else if hitPoints < 10

and random# < 0.5 then run away from player else attack player

Unpredictable behavior in borderline situations

(16)

Potential Problems with Randomness

Possibly many parameters to tweak

– How do we know these are the best probabilities to use?

Difficult to thoroughly test

– Combinations of probabilities may create a bad case (i.e. easy win) which is possible but very unlikely

– That case will be found by some player

Confident Angry Frightened

Attack Left 40% 60% 30%

Attack Right 40% 35% 20%

(17)

Prioritization

Problem:

Multiple rules may fire with contradictory actions

– Problem if rules added by multiple developers (side effects)

if hitPoints < 5

then run away from player if distance to player < 2 units then attack player

What if next to player and have low hit

(18)

Decision Trees

Simple tree traversal

– Node = question

– Branch to follow = answer

– Leaf = final action to take

Hit points < 5? yes no Obstacle between

myself and player? yes

hide

no

run

(19)

Decision Trees

Not necessarily binary

Can merge branches

Hit points HP < 5

light run away

Within one unit of player? heavy

attack

HP ≥ 10

yes hold position no run towards player Weapon type

(20)

Designing Decision Trees

• Identify possible actions (leafs)

• Identify internal/external knowledge for choosing action

• Order questions in tree:

– Crucial factors (health, etc.)

– Ease of gathering knowledge (fastest first)

yes Player visible? no attack yes hide patrol HP < 5?

no yes Player visible? no attack yes hide patrol HP < 5?

(21)

Randomness in Decision Trees

Make decisions at some nodes based on

random number

Math.random() < 0.5 yes

defend

no

Math.random() < 0.2 yes

Swing sword from left

no

(22)

Randomness in Decision Trees

• Problem:

Randomness in high level decisions

• Stands still or patrol for a few frames at a time

• Better if it decided to do one and keep doing it for a while

Math.random() < 0.4 yes

Stand still

no

(23)

Timeouts in Decision Trees

• Execute decisions for specific time

• Problem: must have some way to interrupt actions if world changes

Math.random() < 0.4 yes

Stand still For 10 min

no

Referensi

Dokumen terkait

289.713.000,- (Dua Ratus Delapan Puluh Sembilan Juta Tujuh Ratus Tiga Belas Ribu Rupiah). Demikian untuk diketahui, dan atas perhatian Saudara kami ucapkan

Bertitik tolak dari permasalahan tersebut di atas dan seiring dengan pesatnya perkembangan teknologi khususnya dalam hal bidang teknologi informasi yang terdiri dari

NO NAMA SATUAN KERJA NAMA KEGIATAN LOKASI SUMBER DANA KODE DIPA JENIS PENGADAAN PAGU (Rupiah)...

Deskripsi Singkat : Buku Materi Pokok (BMP) ini mengkaji uraian mengenai: ruang lingkup penelitian kearsipan, logika dan prosedur penelitian kearsipan, perumusan permasalahan

• hat international community actors engaged in constitution building processes build and maintain trust with all parties, ensuring that national stakeholders view their actions

Mesin sablon yang sudah dilengkapi dengan alat penggerak otomatis untuk mencetak design pada seragam sekolah tersebut tentu memberikan kecepatan yang lebih tinggi

SISTEM PENDUKUNG KEPUTUSAN PEMILIHAN MAHASISWA BERPRESTASI MENGGUNAKAN METODE AHP DAN LOGIKA FUZZY..

85 Gambar 4.6 Distribusi Rumah Tangga Miskin Berdasarkan Jenis Bahan Bakar Memasak 88 Gambar 4.7 Katogori Rumah Tangga Miskin Berdasarkan Monetary Poverty………… 90 Gambar 4.8