• 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!
30
0
0

Teks penuh

(1)

Artificial Intelligence in 

Game Design

(2)

Path Creation

Strategy

Path Planning

Movement

“Where to move to” “How to get there” “Get  there”

Current  location

(3)

Waypoints

• Path = graph structure

• Vertices = waypoints on path

• Edges between waypoints  directly reachable from one 

another

(4)

Waypoints and Costs

• Goals: 

– Provide waypoints  that let characters reach all 

locations on level

• Can SEEK any location from some waypoint

– Minimize number of waypoints

• Cost of path planning = O(number of waypoints)2

• Key idea:

(5)

Defining Waypoints

• Defining  waypoints manually

– Usually at points where direction change necessary

• Corners • Intersections • Doors

– Character must be able to directly seek waypoint from any  adjacent waypoint

(6)
(7)

Defining Waypoints

• Convenient  to generate waypoints  automatically

• Simplest case: simple 2D grid (square or hex)

(8)

Defining Waypoints Automatically

• Can often use floor tiles

– Used by level designer to  create level

– Used to define visibility, 

lighting areas, where sounds  can be heard, etc.

(9)

Defining Waypoints Automatically

• One waypoint  per tile

– Usually in center

• Link waypoints in adjacent

tiles

• May still need  to tweak 

manually

– Make sure all points directly  reachable from a waypoint – Add strategic waypoints 

(cover, shadow, etc.)

(10)

Triangular Mesh Generation

• Automatically  generating  triangular  tiles that cover level

– Connect some two adjacent walls to form a triangle

(11)

Waypoint Cleanup

• Can automatically 

remove some “redundant” 

waypoints

– Not an endpoint

(degree  > 1)

– All adjacent  points can 

directly reach each 

other without using 

that waypoint

– Often based on 

(12)

Path Creation

• Path = list of adjacent 

waypoints

• Move along  path using 

FollowPath

steering

– Seek “close enough” to  next path waypoint Desired  path 73 27 21 45
(13)

Path Creation

• Initial waypoint =

– Waypoint in same tile as  character

– Closest waypoint to character

• May need to test each

– Avoid going backward initially – Less of a problem with small

tiles

Seek

that first waypoint

(14)

Path Creation

• Reaching  goal =

– Character in same tile as  goal

– Character at waypoint  nearest goal

Arrive

at goal from that 

last waypoint

(15)

Hierarchical Paths

• Simple maps at different levels of detail

– Better than single map with thousands of points – Single best solution to minimizing pathfinding costs

(16)

Hierarchical Paths

• Requires  hierarchical  representation  of location

(17)

Path Planning

• May have several

possible  paths from 

current location  to goal

• Need to find “best” path

– Otherwise character  does not look intelligent!

Goal

Good path

(18)

Edge Costs

• “Best” path defined 

by edge costs

(19)

Terrain­based Costs

• Can base cost on terrain type

– Grass = 1 – Desert = 2 – Forest = 3 – River = 20

• Often multiply by edge 

distance

– 5 miles of desert = cost of 10

(20)

Other Edge Costs

Danger

– Cost of traveling through enemy territory = 5 * normal cost

(21)

Other Edge Costs

Visibility

Dark = factor of 3

Fog = factor of 2

– Can also add to danger

(22)

Character Edge Costs

• Different characters may have different edge costs

– Grass = 2 – Desert = 2 – Forest = 10 – River = 30

– Grass = 1 – Desert = 3 – Forest = 2 – River = 10

(23)

Non­Symmetric Edge Costs

(24)

• Some characters require  time to realistically  make a 

direction  change

– Part of edge cost

– Separate edge from location to same location

Turning Costs

Arrive Align

Seek

5 3

(25)

Inflection Points

• Waypoints often near convex corners

– Shortest path in wide areas

– Better than putting waypoint in center of area

Path given by  floor tiles

(26)

Inflection Points

• Put waypoint at each convex corner • Move out some safeRadius from corner

• Connect waypoints visible from one another

(27)

Inflection Points

• Potential problem: “jagged” areas could create too many waypoints • Solution: Only add waypoints for obstacles between critical areas 

(such as doors)

– Recursively add waypoints until critical areas connected

(28)

Inflection Points

• Automatic creation  of 

waypoints  on 

(29)

Path Smoothing

• Problem: Grid­based floor tiles with waypoints  at center

– Jagged” paths

– Too many unnecessary turns

(30)

Path Smoothing

• Recursive  algorithm:

– Draw line between start and goal – Stop at obstacle

Referensi

Dokumen terkait

[r]

➲ The rules that define the operation of the game world make up the core mechanics of the game, or the foundations of gameplay.. ➲ All games tell

Realitas tertambah dan dikenal dengan singkatan bahasa Inggrisnya AR ( augmented reality ), adalah teknologi yang menggabungkan benda maya dua teknologi yang menggabungkan

Writing the code to support parameters.. Contoh

Remote Method 

Digunakan untuk membuat paket data yang disimpan dalam array of byte dan dikirim ke port tertentu...

pengangguran di atas 200 juta (sektor konstruksi, real estate, jasa keuangan, otomotif, dan sebagainya)..  Krisis ekonomi mengakibatkan situasi yang tidak menguntungkan bagi

1 friendly weak Celtic no 2 enemy weak Celtic yes 3 friendly strong Norse no 4 enemy strong Norse no 5 friendly weak Greek no 6 enemy medium Greek yes 7