46
Artificial Intelligence for Games Tactical and Strategical AI Artificial Intelligence for Games

Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Artificial Intelligence for Games

Tactical and Strategical AI

Artificial Intelligence for Games

Page 2: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Character AI

Group AI

Execution Management

World

Inter

Strategy

Decision Making

Content Creation

ScriptingInter

face

Animation Physics

Decision Making

Movement Pathfinding

Scripting

Page 3: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

Artificial Intelligence for Gaming

Page 4: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics� Waypoint: single position in a game

� Pathfinding uses nodes

� Now: associate those nodes with different tactical situations

� Tactical locations (a.k.a. rally points)Waypoints for tactical situations (not only rally � Waypoints for tactical situations (not only rally points)

� Usually used to represent � defensive locations (cover points)

� sniper points

� ambush points

� ...

Page 5: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Waypoints are not necessarily useful for

pathfinding

� Usually many more waypoints

� Generated by hand

� Or generated automatically

Page 6: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

cover

sniping

cover

shadow

cover

shadow

sniping

Page 7: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics� More sophisticated methods

� Ideal sniper position has good cover and wide view of

enemy

� Sniper points are both cover points and reconnaissance points

� Need only store primitive properties of waypoints

� When looking for an ambush point:� When looking for an ambush point:

� based on cover

� based on shadow

� based on exposure

� Preferable for smaller number of characters and simple

conditions

� If not, can preprocess and label waypoints with labels for more

complicated properties

Page 8: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

cover

sniping

cover

shadow

exposed exposed

cover

shadow

sniping

exposed

pointexposed

point

exposed

point

shadow

cover

Page 9: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Context Sensitivity

� Tactical value of any type of point depends on the

situation

� Attitude of a character determines whether a cover point

really provides cover

Sniping points depend on enemy position for their aptitude� Sniping points depend on enemy position for their aptitude

� Evaluation

� Precompute multiple values:

� Enemy position in all four directions

� Casts ray to actual enemy position to see whether cover is

provided

Page 10: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

Cover:

N: 3

E: 5

S: 0

W: 0

Cover:

N: 4

E: 5

S: 4

W: 0

Page 11: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

Page 12: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Precomputing values

� Fast: no calculations necessary

� Can explode:

� Cover in four directions

� Two attitudes: standing / crouchingTwo attitudes: standing / crouching

� Against five types of weapons

� Total 40 values

� Post-processing

� Ray-casting can be expensive

� Some games use 30% of a processing power on line-of-

sight calculations

Page 13: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Waypoint overview:

� Many games can use simple labels

� Context sensitivity through precomputation

� Post-processing for tactically involved games

Page 14: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Using tactical locations

� Mechanism to include waypoint data into decision

making:

1. Simple decision making process such as a decision tree

2. Incorporating tactical information into decision making

processprocess

3. Character motion that is always tactical aware

Page 15: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Simple tactical experience

� Character uses a decision tree based on current

state: health, ammo, enemy position

� Decides for reloading

� Queries tactical waypoints in the vicinity� Queries tactical waypoints in the vicinity

� Evaluate for cover

� Drawback: Availability of a nearby cover point is

not assured

Page 16: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics� Using tactical information during decision making

� Binary decisions:� Decision tree with a node:

� Is there a cover point nearby?

� State machine with state machine

� Fuzzy logic decision making� Fuzzy logic decision making� Incorporates values of waypoints

� Generating nearby decision points

� need to be fast

� Use data structures such as quad-trees, binary space partitions, ...

� Needs to take obstacles into account

Page 17: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Tactical Pathfinding

� Extend A* pathfinding algorithm

Page 18: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Generating waypoints

� Part of level design

� Use tiling

� Evaluate center points

Page 19: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Cover points

� Quality evaluated by calculating proportion of

successful attacks from different points

� Create potential enemy locations around point

� Create different heights of enemy

Page 20: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics� Visibility points

� Use line-of-sight tests

Partial cover

Full cover

Visibility arc Arc of no cover

Partial cover

Partial cover

Full cover

Page 21: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Shadow points

� Use lighting model of level

� Test amount of light at different heights over the

point

Page 22: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Waypoint Tactics

� Automatic generation of waypoints

� Watching human players

� Condensing the waypoint grid

� Start with points in center of a dense tiling

� Discard points with low evaluationDiscard points with low evaluation

� (Careful: In a room with almost no cover, a modest cover

point is important)

� Condense remaining points

� If character can move simply between two points, can

keep the better of the points

Page 23: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

Artificial Intelligence for Gaming

Page 24: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis� Represent the game level

� Tiling with a dense grid

� Dirichlet domains

� Simple influence maps

� Each type of unit gives influence

Page 25: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

cell) d(avatar,--1 max(0, influenceφ

φα ⋅=

Manhattan geometry

Formula for atenuation

Page 26: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

Other formulas for atenuation

Page 27: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Cumulative effect of units

� Add, but limit effect of each unit to a certain circle

� Use a convolution filter

� Use only the highest influence unit to calculate

influenceinfluence

Page 28: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Influence can depend on the type of unit

� Artillery: Influence only in a certain ring around unit

Page 29: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Use of tactical map:

� Difference between influences with and without

enemy

Page 30: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Use of tactical map:

� White piece in center is surrounded by black

influence: vulnerable

Page 31: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Tension Map:

� Difference between influences:

Page 32: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Tension minus my influence gives vulnerability

Tension Influence Vulnerability

Page 33: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

� Example:

� Well-defined frontline

� Conflict in middle

Page 34: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Analysis

Page 35: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical Pathfinding

Artificial Intelligence for Gaming

Page 36: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical pathfinding

� Tactical pathfinding

� Incorporates the tactical evaluation into costs of

paths

� Connection cost depends on

� Distance� Distance

� Tactical quality of each connection

� Tactical quality of connection is stored

� With waypoints

� (Average the tactical quality of the two endpoints, but

face problems)

Page 37: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

A B

Direct connection between A and B exposes character

Can only see this with lots of waypoints

A B

Page 38: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical pathfinding

� Modify pathfinding heuristics

� Euclidean distance heuristic can lead to

underestimate tactically excellent routes

Page 39: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Tactical pathfinding

� Modify graph:

� Need to add waypoints that are not tactical

Page 40: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Actions

Artificial Intelligence for Gaming

Page 41: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Actions

Strategy

Tactical Analysis

Planning

Group Movement

Individual

Movement

Individual

Movement

Individual

Movement

Individual

Movement

Page 42: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Action

� Incorporating players does not mix well with multi-

tiered AI

Pathfinding

pathPreferred

path of player

Page 43: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Action

� Integration of player

� Explicit player orders

� Different structuring of multi-tier AI

Page 44: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Action

Player

Action recognition

(rule based)

Strategy

Tactical Analysis

Group Movement

Individual

Movement

Individual

Movement

Individual

Movement

Individual

Movement

Page 45: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Action

� Emergent cooperation

� Characters run their own decision making

procedure

� Taking into account what other characters are doing

� Tune decision making so that cooperate actions � Tune decision making so that cooperate actions

emerge

Page 46: Tactical and StrategicalAItschwarz/COEN129/PPT... · 2. Incorporating tactical information into decision making process 3. Character motion that is always tactical aware. Waypoint

Coordinated Action

� Scripted actions

� Special situations in sports

� Football

� Soccer: corner kick, free shot

� Baseball: double play, bunt

� Military tactics

� Entering a potential hostile room

� Teams moves into position outside

� Throws stun grenade

� Move into corner of room

� Flank inside of doorway