Intelligent Asteroid Agents combining Pathfinding and Steering

advertisement
INTELLIGENT ASTEROID AGENTS
COMBINING PATHFINDING AND
STEERING ALGORITHMS
Carlos Barboza
Kenny Barron
Kevin Cherry
Tung Le
Daniel Lorio
ABOUT THE GAME
Avoid enemy ships as they chase after you
 Every second alive adds points (10)
 Killing an enemy adds points (100)
 Player can wrap around screen, enemies can’t
 Enemy can only propel forward, player can
move forward and in reverse

DEMONSTRATION
OBJECTIVE
Maximize agent’s performance in fullydynamic, multi-agent environment with limited
knowledge of environment
 Determine performance through the use of
different AI algorithms and parameters
 Performance is gauged by score at end of
game

ORIGINAL GAME
“FRENZY SURVIVOR”
User controlled
player
 Limited ship
following
 Disorganized
in pursuit of
player ship

http://berfenfeldt.com/
ENVIRONMENT
P – Score






E – Grid A – Moves S - Grid Regions
Partially Observable – Limited to set regions
Strategic – Moves based on location of enemy
Episodic – Experience based on perception of
enemy
Dynamic – Enemy constantly moving/regenerating
Discrete – Agent responds with set action based
on perception of enemies in viewed regions
Multi-Agent – Steering algorithm applied to
enemies, and pathfinding for player
ADAPTING THE ENEMY




Adapted open source project
OpenSteer in C#
Enemy determines velocity
and direction based on
players location
Steer for seek allows enemies
to converge around player
Steer for flee allows enemies
to distance themselves away
from player in any direction
ADAPTING THE PLAYER
Loosely based on A*
Pathfinding
 Combines heuristic, actual
cost, and utility function to
quantitate each move choice
 Agent chooses maximum
move value

ALGORITHM EVOLUTION
1st Agent was a simple reflex agent, not
partially observable, random movements and
actions, and it was not rational
 2nd Environment was partially observable,
agent was a simple reflex agent, and partially
rational
 3rd Agent was goal based agent, partially
observable environment, and partially rational

HEURISTIC FUNCTION (H)


Creates grid to discretize the game world
Each grid cell has bitmask that holds information
on cell contents


If enemy is in cell
If cell is part of a region
HEURISTIC FUNCTION (H)


Creates 5 regions from grid
Multiplies enemy presence with
proximity to player in each region
using a cubic scale.
 A – Accelerates Forward
 F – Flees Backward
 L – Turns Left
 R – Turns Right
 S – Shoots
L
S
R
F
A
ACTUAL COST FUNCTION (G)





Concept of look ahead
implemented as a move tree for
actual score
1 point per move simulates
survival time
Prune on dead state (count dead
states)
Total dead states counted for each
move’s subtree
Final move score:

MaxDescendentScore * W1 TotalDescendentDeadStates * W2
root
L
A
S
F
R
...
L
A
S
F
R
UTILITY FUNCTION (U)

Acts as a multiplier for move values, and tilts
the behavior of the player towards passive or
aggressive
A
= 1.4
 B = 1.0
 F = 1.2
 L = 0.8
 R = 0.8
 S = 1.2
FORMULA

f(m) = (h(m) + g(m)) * u(m)
 where

m = move
Overview:
 h(m):
Evaluate for each move and choose the one
with the largest value
 g(m): Simulate gameState for each child, prune
dead states, and select move with highest
 u(m): Utility function adds custom factor to each
value
RESULTS
1
2
3
4
5
6
7
8
9
10
AVG
BEST
H,U(8)
1204
1303
1105
1305
1304
1305
1304
1209
1611
1205
1285.5
1611
H(8)
1204
1208
1203
110
1230
816
1212
1304
1304
1330
1092.1
1081
H,U - EC(4)
1806
1705
2810
1911
1606
1708
1906
1806
5316
2709
2328.3
5316
1004
2416
4814
2306
2606
2605
2307
4412
4923
2607
3000
4923
2708
1606
3710
2508
2609
5218
1009
1408
2506
1805
2508.7
5218
2507
1205
1509
1103
2309
2107
1707
1505
4315
2409
2067.6
4315
H,U Double(8)
HDouble(8)
HDouble(4)
H,U(8)
H(8)
H,U - EC(4)
H,U - Double(8)
H - Double(8)
H - Double(4)
5000
4000
3000
2000
1000
0
1
2
3
4
5
6
7
8
9
10
Avg
Best
DEMONSTRATION
Download