1 / 20

Ch 7.1: Using a Spatial Database for Runtime Spatial Analysis

Ch 7.1: Using a Spatial Database for Runtime Spatial Analysis. Purpose. Dynamic environment – player’s actions are unpredictable, player can change environment (i.e. game has a physics engine) High levels of interactivity, coupled with dynamic environments, require sophisticated AI

rupali
Download Presentation

Ch 7.1: Using a Spatial Database for Runtime Spatial Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ch 7.1: Using a Spatial Database for Runtime Spatial Analysis

  2. Purpose • Dynamic environment – player’s actions are unpredictable, player can change environment (i.e. game has a physics engine) • High levels of interactivity, coupled with dynamic environments, require sophisticated AI • AI needs way to process information in environment

  3. Example

  4. Possible Representations • Static • Place “hints” in the game world • Analyze world and build a data structure • Dynamic • Influence maps (establishes implicit boundaries between opposing forces) • Want a solution that represents all relevant data

  5. Spatial Database • 2D grid overlaid on top of the game world • Multiple independent layers superimposed on the same grid • Most useful layers: • Openness • Area occupancy • Area search • Line-of-fire • Light level

  6. Use of Spatial Database • Combine multiple layers to compute composite desirability values • AI examines nearby cells, moves accordingly • Implicitly coordinates behavior of multiple AIs

  7. Openness Layer • Needed for tactics which require certain amount of open space (ex – “Circle of Death”) • Cells contain values that indicate how close it is to a wall/object • If blocked, value = 0; else, value = 1 • Propagate influence of 0-value cells to neighbors

  8. Example Propagation

  9. Uses of Openness Layer • Can determine the direction of increasing/decreasing openness • Can use this gradient to find the middle of the room (high openness) and the walls (low openness)

  10. Area Occupancy Layer • More for RTS games, “fog of war” • Each unit propagates an area of influence around itself • Cells with nonzero values are visible • Units update grid values when moving (or created/destroyed) • Used in other genres for AIs to know how populated an area of the world is

  11. Uses of Area of Occupancy Layer • Higher values if cells are closer to more agents • Avoid moving into occupied areas when maneuvering • Difference between “fog of war” and occupancy – values depend on distance between AI units for occupancy, not “fog of war”

  12. Area Search Layer • Games with stealth components, AI needs to search for player • Scouts in RTS games, uncovering the map • Initialize the layer to zero values • Increment cell values as they enter AI agent’s view arc

  13. Implementation for Stealth Games • Guard considers surrounding area a “hidden map” • Has clues to aid search; knows where to begin and where to look • Store database of evidence, bias search towards it • Decay database over time (randomly?) • Automatically coordinates multiple NPCs

  14. Thief 3

  15. Line-of-Fire Layer • For game genres with ranged weapons • Want to ensure that AIs don’t block each others’ shots • Each cell starts as zero • When AI aims, propagates values in its viewing arc • Each AI ignores its own contribution (temporarily subtract value before reading)

  16. Light Level Layer • Needed for games with dynamic lighting • Stealthy characters/vampires would avoid light, guards would prefer light • Initialize to 0s • Each light source propagates values based on current radius, lighting type, intensity, etc.

  17. Handling 3D Environments • Single 2D grid can’t represent vertically overlapping areas • Solution: transform grid into one of sub-grids • Assign a sub-grid to each different height • Works well for human environments

  18. Potential Issues • Spatial database system could be a performance nightmare • Large grid + high resolution + large # of AIs + frequent updates = • Updating certain areas constantly is a waste of time/memory

  19. Optimizations • Pare size of the grid (make cells represent larger areas of environment) • Don’t recalculate static layers • Decompress sub-grids as needed • Combine cells if all values are the same • Use short-circuit evaluation • Update cells only when used

  20. Sources • Tozour, Paul, “Using a Spatial Database for Runtime Spatial Analysis,” AI Game Programming Wisdom 2. • HL2 video - http://www.zippyvideos.com/212120745294215.html • Thief 3 video - http://media.pc.ign.com/media/015/015244/vids_4.html • BSOD image - www.palindrom.agava.ru/en.intro.bsod.html

More Related