Download presentation
Presentation is loading. Please wait.
Published byCathleen Singleton Modified over 8 years ago
1
Artificial Intelligence in Game Design Influence Maps and Decision Making
2
Decision Making How can influences determine path character follows? How can influences determine high level decisions made by character? How can goals of player affect influences?
3
3456777777 3456788888 3456789998 345678998 3456789998 3456788888 456777777 3456666666 3455555555 3444444444 Simple Tile-Based Movement Use influence map directly to determine next tile –Treasure has positive influence –Snakes have negative influence Move to adjacent tile with highest measure 3456777777 3456788888 3234579998 321237998 321157798 321-224688 23223577 3454222466 3453111355 3444444444
4
Simple Tile-Based Movement Vulnerable to local maxima if influences interact in complex ways –Locations on map where each possible move is worse than current position –Will become “stuck” and cycle forever in area Requires careful design or heuristics to avoid –Don’t return to previous location, etc. 123456789 1212367899 100147888 10 147777 10 024666 1210011355 123200244 011 133 -3-200000022 -31111111
5
Influence: 1 Edge Costs Use influence map to estimate edge costs in graph –Based on influences instead of computed from graph Other units Terrain costs –Positive number low cost to move through –Negative number high cost to move through Average influences of start, end point to get path costs –Assumption: “half” of path is through each area Influence: 5 Average influence = 3
6
Influence: 1 Edge Costs Must normalize to get actual edge costs –Reverse sign High influence = low edge cost Low influence = high edge cost –Must avoid negative edge costs! Dijkstra, A* will not work if edge costs negative –Can factor in other costs Multiply by distance, etc. Simple example: edgeCost(i, j) = maximumInfluence – averageInfluence(i, j) Influence: 5 maximumInfluence = 7 edgeCost = 4
7
Edge Cost Example 4.5 30.5-2-3 64.52-0.5-3 4.5 2-1.5-3 332-0.5-3-2 2.53.255.257.759.5 1.753.756.258.7510 2.53.756.759.2510 44.56.258.759.5 1.75 3.25 2.5 3.25 4.5 5 5 7 8 8 9.5 10 maximumInfluence = 7
8
Edge Cost Example 4.5 30.5-2-3 64.52-0.5-3 4.5 2-1.5-3 332-0.5-3-2 2.53.255.257.759.5 1.753.756.258.7510 2.53.756.759.2510 44.56.258.759.5 1.75 3.25 2.5 3.25 4.5 5 5 7 8 8 9.5 10 “Shortest” path from A to B: A B A B
9
Edge Costs Only works for adjacent areas –Edges between non-adjacent areas might go through other areas with very different influences Safe waypoint Path between them not safe
10
Edge Costs Terrain analysis –Determine total terrain influence at each tile –Determine which tiles an edge passes through –If influence level at a tile significantly different than at vertices, add a new waypoint Medium influence Low measure due to influence of other tile Path between them not safe Should have a waypoint here! Medium influence New waypoint
11
Group Movement Edge cost of group of characters based on individual costs Hand to Hand Weaponry Hand to Hand Weaponry Long Distance Weaponry Hand to Hand Weaponry Long Distance Weaponry Heavy Weaponry 5 4 7 6 4 2 What is cost of this edge for unit as a whole?
12
Group Movement Possible solutions Edge cost of group = maximum(individual costs) –Must do this if cost based on speed over some terrain Edge cost of group = average(individual costs) –May do if willing to lose team members to reach goal quickly Edge cost of group = cost of most critical unit –Group fails if this unit is lost –Particularly important if that unit has high cost 563 45 5 = 6 536 53 = 4.4 43 6 53 = 5
13
Decision Making Higher-level character actions may be based on terrain influences See player? yesno Wander Cover nearby? yes no Attack Run towards cover Is there a tile within distance d that has significant influence over player position? Move to tile in range d with highest influence
14
Example: Master of Orion AI selects planets to colonize based on: –Economic value of planets –Proximity to current borders –Proximity to borders of other players Star in current territory all edges from star connected to colony/another star in territory
15
Master of Orion Decision Tree Already have colony at this star? yesno Another has colony at this star? yesno Multiplier *= 1.5Multiplier *= 0.8 Another has colony at this star? yes no Multiplier *= 0.3 Star inside our borders? yesno Multiplier *= 0.9 no Star inside borders of another? yesno Multiplier *= 0.3 CONTINUE Goal: Giver each star a multiplier proportional to influences of our and other player territories
16
Master of Orion Terrain Analysis Give other stars multiplier based on how adding it would change territory –Multiplier = 1 –For each new unclaimed star now inside border add 0.25 –For each colony now inside border add 1 –If homeworld now inside border add 1 Colonizing Lupi would put Volans colony inside border multiplier = 2
17
Master of Orion Decision Making Probabilistic decision on planet to colonize –For each star, generate multiplier and square –Multiply by economic value of planet to get weight –Eliminate any with < 50% of best candidate (avoid stupid moves) –Choose randomly with probabilities proportional to weight Example: A: 0.5 B: 1.5 C: 1.0 D: 2.0 E: 1.5 0.25 2.25 1.0 4.0 2.25 26% 48% 26%
18
Fuzzy Decision Making Terrain influences often not binary Different objects may have degree of membership in type of terrain Example: “Move to nearby high ground” –What if have several choices? Mountain 1 Height = 400 Distance = 80 Mountain 2 Height = 200 Distance = 50 Mountain 3 Height = 500 Distance = 100
19
Fuzzy Decision Making “Nearby” and “high” can be fuzzy measures distance 020406080100120 Nearby 0.4 0.9 0.2 0100200300400500600 High 0.3 0.9 1.0
20
Fuzzy Decision Making “Nearby and high” = min(µ nearby (mountain), µ high (mountain)) Choose mountain with highest value –Mountain 1 = min(0.4, 0.9) = 0.4 –Mountain 2 = min(0.9, 0.3) = 0.3 –Mountain 3 = min(0.2, 1.0) = 0.2 Many rules include “nearby” component –Cover nearby? depends on how near and degree of cover –Attack nearby cities which are no well defended depends on how near and degree of positive/negative influence Best choice
21
Goal-based Terrain Understand goals of player –Areas that player would consider valuable Give higher values to areas with influence over those areas –NPC will try to secure areas of value to the player –Looks like “anticipating” player actions –Prevents players from accomplishing goals –Looks like “trap” if NPC units can be hidden Can use to manipulate the terrain –NPC could try to plant goal items (such as treasure) in areas NPC has control over! –Level design could automatically place goal items in areas that other areas have influence over
22
Goal-based Terrain Example: Treasure (with value 4 to player) next to forest Forest has influence over open areas next to it Areas with influence over the treasure increased by value of treasure -3 333777 111111 11111 12221 12321 12221 11111 Best places to be!
23
Goal-based Terrain Areas with influence over good terrain Areas with influence over other high influence areas Path with low terrain cost = high value to player Forest area with influence over neighbors Highest influence areas B Height = 50 C Height = 20 D Height = 30 Area of value to player Influence over that area more valuable
24
Exploration Goals Exploring new areas should be a goal of NPC –More accurate maps, more accurate influences –Usually have scouting units for that purpose Areas at edge of map should have strong positive influence Might be combined with other factors: –Proximity (explore areas already near to) –Safety (explore areas not under player control) –Terrain (explore areas can move quickly through) –Visibility (go to areas where can see much from) Mountains, etc. Visibility area on ground Visibility area on mountain
25
Exploration Goals 24 36 24 14814 12712 310 38 26 Unknown territory Scout’s visibility = 2 tiles away Views maximum unknown territory
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.