34
Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Embed Size (px)

Citation preview

Page 1: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Jumping, Climbing, and Tactical ReasoningSection 2.5

Tom Schaible

CSE 497 – AI & Game Programming

Page 2: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Jumping, Climbing, and Tactical Reasoning

Christopher Reed Benjamic Geisler Raven Software/Activison Soldier of Fortune II: Double Helix

Page 3: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Standard Navigation System Recap

Graph Theory Point – A location Edge – A route to get from location to

location Use A* to efficiently navigate through the

graph in game This can be extended to

Climbing Jumping Throwing Grenades

Page 4: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Finding Cover using Teams

Embed appropriate cover information in points

Teammate waits, Leader chooses cover and advances

Leader waits, Leader chooses cover and advances

Repeat

Page 5: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Finding Cover Using Teams

Page 6: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Finding Cover Using Teams

Additional Information Needed at Edges Obstacle Information Visibility Information More on this later

Page 7: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Throwing Grenades

Choice of scripting behavior or encoding data into decision system

Compute edges to points in grenade throwing radius If it is possible to throw a grenade (encode

trajectory) add a grenade throwing edge

Page 8: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Throwing Grenades

Page 9: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Throwing Grenades

Page 10: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Throwing Grenades

Things to keep in mind Is throwing a grenade feasible?

Uncommon situation, grenades are scarce Reserved more as a last resort, when obstacles

prohibit attacking What position is best to throw a grenade from?

It may be impossible to use a grenade effectively What trajectory is necessary? (through windows,

around corners) .05 to .1 seconds per trajectory to calculate Store in memory instead (store only attacker and

trajectory pair)

Page 11: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

How to Bias Edges Data you are adding to points needs to show up in

the edgesParentPoint = OpenList.GetFromOpenList()

For each edge from ParentPoint

Switch edge.type()

Case GRENADE_EDGE:

If ( point.trajectoryGood() )

edge.cost = actor.GrenadeBiasCost()

Case FLY_EDGE:

If ( actor.CanFly() )

edge.cost = actor.FlyBiasCost()

Page 12: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Non-Standard Movement Edges

Instead of scripting behavior, embed type of behavior in edge

Engine will automatically perform movement including animation and set up

Can be used for Jumping Flying Opening Doors

Page 13: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

How to Embed Information in Points

Store point size information for each point Use a sphere to define the size

Can Detect obstacles and obstacle features Obstacle Visibility – Vertical Obstacle Visibility – Side to Side

Page 14: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Obstacle Visibility - Point

Page 15: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Object Visibility – Side to Side

Page 16: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Other Embedded Information

Safe Size Use collision detection to determine how big of an actor can

use the path Jumping

Embed invisible geometry in game (preferred) or use extensive collision detection

Vaulting Same as jumping but geometry is not invisible Requires specific constraints for animation

Movable Objects and Doors Collision detection will find tagged object Retry collision detection after object is moved to test validity of

edge (store movement info in the edge) Stairs, Slopes, Ladders, and Ropes

Checking angle between points vertically can cause edges to be labeled with certain actions

Page 17: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Putting it all together

Flying Edge

Flying Edge

Door EdgeVault Edge

Jump Edge

Rappelling Edge

Page 18: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Soldier of Fortune II

Page 19: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Hunting Down the Player in a Convincing Manner

Section 2.6

Page 20: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Hunting Down the Player in a Convincing Manner

Alex McLean Pivotal Game Ltd. Conflict : Desert Storm

Page 21: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Hunting Down a Player in a Convincing Manner

Intelligent hunting is a good thing The game needs to be somewhat

challenging Allows for strategy

Perfect hunting is a bad thing Takes away from gameplay Really isn’t realistic

It should be apparent that the hunter is exploring and cannot see the target when it is not visible

Page 22: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Parameterizing the Process

A parameter based process will work best

Controls the hunter to do different thigns at different times

Two major parameters we want control over Speed – How quickly you are found Directness – How direct is the path from

hunter to target

Page 23: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Destination

Path finding will be used to direct the hunter

A destination is needed Simplest solution is to move directly to the

destination where the hunter is This makes the AI too good Destination must be more variable and

robust

Page 24: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

States

Break the decision of destination up into different states The player is visible The player was recently seen The player has never been seen

Allows for more realistic destinations Results in more realistic behaviors

Page 25: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

The Player is Visible

Simplest Case Start the attacking behavior

May be a direct route May look for cover

Page 26: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

The Player Was Recently Seen

Another simple case Move to the last point where the

character was seen Provides for much more interesting

game play to the player

Page 27: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

The Player Was Recently Seen

Page 28: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

The Player Was Not Recently Seen

Must start searching “intelligently” Must generate a location

Direction – within an angle θ of the player Distance – Some multiple of the exact direction to

the target in an interval [Smin,Smax] (i.e. [.5,1.5])

Smin

Smax

θ

x

Page 29: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Algorithm Detail

Smin, Smax, and θ control the parameters of hunting

Closeness of Smin, Smax to 1.0 and decreasing θ Increase Speed Increase Directness

Making θ > 180 can make the NPC somewhat dumb

Page 30: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

How it Works

Page 31: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Extensions

Three-Dimensions Simply use a 3-D cone to pick destination

Moving Players Need to update player destination along the way In case NPC and player run into each other Make sure you are moving towards the player and not to

where the player was Sounds

Hearing sounds can act as a new location that the player has been “seen”

Target Priority If a more interesting target is seen, go after it

Team based Tactics

Page 32: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Team Based Tactics

Page 33: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Conflict: Dessert Storm

Page 34: Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming

Conclusion

A* and similar path finding algorithms can be used to provide dynamic motion Edges in graphs can be used to encode motion-

specific information Edges can be biased to modify the search

algorithm

Realistic hunting is an important part of an AI The hunting AI should react intelligently to a player It should be smart but not too smart