Terrain Analysis - PowerPoint PPT Presentation

About This Presentation
Title:

Terrain Analysis

Description:

If you're going to need lab machine(s) for your game, ... Where would be good sniper posts? Where would be good sniper posts? Where are the choke points? ... – PowerPoint PPT presentation

Number of Views:229
Avg rating:3.0/5.0
Slides: 34
Provided by: kenneth182
Category:

less

Transcript and Presenter's Notes

Title: Terrain Analysis


1
Terrain Analysis
  • CS 370
  • Spring, 2003

2
REMINDER
  • One week from tomorrow is the Party!
  • 5-9 pm
  • Pizza and soft drinks will be provided
  • If youre going to need lab machine(s) for your
    game, please coordinate with us ASAP
  • The system staff need plenty of lead time. Next
    Thursday wont really cut it

3
Overview
  • Representing space and terrain
  • Path-finding
  • Position-finding
  • Higher-level analyses

4
Spatial reasoning is really hard
  • Humans have incredible perceptual/motor skills
    dedicated to handling aspects of it
  • Humans appear to have rich representations of
    space and shape at multiple levels of description
  • Pop quiz
  • Which is farther west, San Diego, CA or Reno, NV?
  • Which is further north, Chicago or Milan?
  • Simplification Construct discrete underlying
    representation

5
From the developers side
  • The first of many hurdles to cross is to prevent
    the game from freezing every time we path some
    unit across the screen. This game freeze can
    be considered the plague of pathfinders. Its a
    game killer, and one of the most significant
    problems we will need to solve until we all have
    5-trilliahertz computers with googles of memory
  • Dan Higgens (Empire Earth team from Stainless
    Steel Studios, Inc.),

6
From the players perspective
  • Managing that army can be a bit annoying at
    times, though, because of AoMs errant
    pathfinding. On more than one occasion, Id try
    to send my units to a specific spot on the map
    and theyd end up on a hill overlooking the spot
    where I wanted them to be. Other problems include
    units getting trapped between rows of bushes,
    units jerking this way and that as they move,
    and units hugging a cliff instead of simply
    walking down the road in front of them (which
    results in them moving much slower than they
    should).
  • Age of Mythology review, PC Gamer, 2002

7
Game designers have to cheat like crazy
  • Use simplified representations of space
  • Sometimes hand-constructed, by level designers
  • Sometimes automatically constructed, when random
    terrain or user-level map editors are used

http//www.gamasutra.com/features/20010912/sterren
_02.htm
8
Three families of spatial solutions
  • Tiles
  • Waypoints
  • Quad trees

9
Tiles
  • Variations
  • Can be rectangular or isometric, depending on
    perspective
  • Some games use hexagonal grids to model distances
    traveled on diagonals more accurately
  • Tradeoffs
  • Very simple
  • Uniform resolution can waste storage on
    uninteresting regions of space

10
Quad Trees
  • Carve up space according to where objects arent
  • Stop conditions
  • Uniform contents
  • Maximum depth on recursion reached
  • Tradeoffs
  • Provides variable resolution
  • More intricate to generate and use

11
Waypoints
  • Annotate terrain with hand-selected places that
    movable entities can be in
  • Adjacency relationships between waypoints
    indicate ways to move from one to the other
    (including travel time)
  • Additional annotations can be used to indicate
    other properties
  • whether line-of-sight exists between two
    waypoints
  • Part of a room or a base or some interesting
    location
  • Environment conditions, such as light/dark, types
    of movement required
  • Tradeoffs
  • Can analyze to derive many useful tactical
    properties
  • Generally must be entered by hand

12
Example Using waypoints for tactics
Waypoint
Visible and trafficable
Visible only
13
Where would be good sniper posts?
14
Where would be good sniper posts?
15
Where are the choke points?
16
Where are the choke points?
17
How would you sneak up on them?
18
How would you sneak up on them?
19
How would you trap them?
20
How would you trap them?
21
Path-finding
  • All three spatial solutions give rise to common
    formal framework for finding paths
  • Graph search
  • Costs on links of graph
  • Results from early AI research universally used
    in game development
  • E.g., A search and its successors
  • Game developers have invented many improvements
  • Nothing like trying to live within a tight CPU
    budget to unleash creativity!

22
A Formalization
  • Node a state in your search corresponding to a
    place in your terrain representation
  • Node contains path to get from start to that
    place
  • Multiple paths can go through the same place, so
    there can be more nodes than places
  • Children nodes corresponding to adjacent places
    in your terrain representation.
  • Links between nodes have costs.
  • Depends on distance
  • Depends on difficulty of movement
  • Can roll in other factors, e.g.
    concealment/visibility, to incorporate tactical
    factors

23
A formalization, continued
  • Start, Goal nodes
  • g(n) cost to get to this node from your
    starting position
  • Sum of costs so far along this path
  • h(n) Estimate of cost remaining to goal
  • Intuition Path cost estimate g(n) h(n)
  • Use estimate to explore cheapest paths first
  • If h never overestimates cost remaining, then h
    is admissible
  • If h is admissible, then A is guaranteed to be
    optimal
  • Will always find the cheapest path
  • Will always examine the fewest nodes

24
A
  • Let Open make-node(start), Closed
  • If Open then return failure
  • Let N best node from Open
  • If place(N) goal then return N
  • For each child C of N,
  • Is there a node N2 with place(N2) place(C) in
    Open or Closed?
  • If so, replace path(N2) with path(C) if f(N2) gt
    f(C)
  • Otherwise, add C to Open
  • Move N to Closed

25
Demo
  • http//www.ccg.leeds.ac.uk/james/aStar/

26
Modification Iterative deepening
  • Observation For a search of depth k, there are
    many more nodes at the depth of k than the entire
    search tree for k-1
  • Technique Add a maximum depth of search
  • Start with small but semi-reasonable estimate
  • If failure, search again with larger maximum
    depth
  • Tradeoffs
  • Search the same space near the start over and
    over again
  • Memory requirements can be dramatically smaller

27
Modification Cleaning up paths
  • With large pieces of space, paths generated can
    be unnatural
  • Solution Use a post-processing step to clean
    them up

28
Influence maps
  • Helps identify interesting positions on a map
  • Start from things of interest
  • E.g., friendly/enemy units, resources
  • Propagate numerical values to neighbors
  • Add/subtract values from different sources as
    appropriate
  • Analyze patterns of numerical values to select
    positions, boundaries
  • Where to put a mine or storage shed
  • The front between two warring nations

29
Demo
  • http//www.ccg.leeds.ac.uk/james/influence/

30
Frontier Improving spatial representations
  • Goal Provide human-like spatial representations
    in computer games
  • More realistic opponents
  • More realistic comrades

31
Example Visual computation of cognitive maps
  • Hill, Randall W., Jr., Han, Changhee, Van Lent,
    Michael. - "Applying Perceptually Driven
    Cognitive Mapping To Virtual Urban Environments.
    14th Innovative Applications of Artificial
    Intelligence Conference (IAAI 02)

32
Demo nuSketch Battlespace
33
Some references
  • Brockington, M. 2000. Pawn captures Wyvern How
    computer chess can improve your pathfinding. GDC
    2000.
  • Davis, I. 2000. Warp Speed Path Planning for
    Star Trek Armada, AI and Interactive
    Entertainment Papers from the 2002 AAAI Spring
    Symp., AAAI Press, Menlo Park, Calif.
  • Forbus, K., Mahoney, J., and Dill, K.. 2001. How
    qualitative spatial reasoning can improve
    strategy game AI. AI and Interactive
    Entertainment Papers from the 2001 AAAI Spring
    Symposium. AAAI Press, Menlo Park, CA
  • Liden, L. 2001. Using nodes to develop strategies
    for combat with multiple enemies. AI and
    Interactive Entertainment Papers from the 2001
    AAAI Spring Symposium. AAAI Press, Menlo Park,
    CA
  • Pinter, 2001. Toward more realistic pathfinding.
    Gamasutra.com
  • Rabin, S. (Ed.) 2002. AI Game Programming Wisdom.
    Charles River Media, Inc. Hingham, Mass.
  • Stout, B. 1996. Smart Moves Intelligent
    Path-finding. Game Developer Magazine, October.
  • Van der Sterren, W. 2001. Terrain reasoning for
    3D Action Games. GCD 2001
  • Most of these are available on
  • www.gamasutra.com
  • www.qrg.northwestern.edu/aigames.org/index.html
Write a Comment
User Comments (0)
About PowerShow.com