Qualitative Spatial Analysis Chris Mansley
Qualitative Quantitative items are known, definable quantities (x,y) coordinates Remaining health Location of units Qualitative items are much more intangible but intimately related to qualitative items By decoupling the two, more general code/ideas can be used about the AI
An example Trafficablity Given a map and an echelon Restricted (Impassible) Restricted (Passable) Unrestricted Mobility Corridors Avenues of Approach
Example (cont.)
Motivations Game worlds are increasingly more complex NPC must be able to reason about them in an intelligent fashion Dynamic environments Makes scripting less of an option Leads to more problems
Two Implementations Spatial Database Driven by the dynamic environments associated with FPS Terrain Analysis Needed a realistic way to analyze strategic value in RTS
Conventional Methods Conventional Spatial Ideas NPCs are guided by “hints” placed in the level by designers Offline analysis of level to build a data structure the NPCs can use to interact with the environment
AI Nodes
Conventional Methods (cont.) Flaws Only works for static environments! May be difficult with random maps
Spatial Databases 2-D Grid overlaid on the game world Each cell can have many layers of data Can be thought of as several grids laid on top of one another
Spatial Databases Search layer Occupancy layer Openness layer
Data Layers Openness Layer (Static) Cover Layer (Static) Area Search Layer (Dynamic) Area Occupancy Layer (Dynamic) Line-of-Fire Layer (Dynamic) Light Level Layer (Dynamic)
Using Layers Layers can be combine to form desirability layers for different scenarios Combat Desirability Openness Occupancy Cover
Using Layers (cont.) Benefits Implicitly coordinate multiple AI units Generate multiple movements for different actions
Using Layers (cont.) Drawbacks Does not handle 3-D environments easily Simple Solution – break 3-D environment into smaller grids Potentially processor intensive Streamline resolution of grid to get best possible results
Calculating Desirability Cover layer Occupancy layer Openness layer Desirability layer =
Openness Layer A cell containing a wall or blocking object contains a zero All other cells contain a one The zero is propagated to neighboring cells to be able to determine proximity to the wall
Openness Layer (cont.) Solid Wall
Area Occupancy Layer Similar to fog-of-war feature from RTS Nonzero values are placed where the unit is located That value is propagated to the neighboring cells
Area Occupancy Layer (cont.)
Line-of-Fire Layer Useful with ranged weapons Helps AI avoid shooting each other Has a nonzero value in each cell in the direction of fire
Line-of-Fire (cont.)
Light Level Dynamic lighting is an important part of modern games Visibility/area lighting can be taken into account by NPCs The layer has the light intensity at any cell
Area Search Layer In many “sneaker” games, the NPCs spend time searching for the player Once searched, the area layer contains true or some nonzero value Over time that layer can decay, so the NPC will research it if necessary
Thief: Deadly Shadows
References AI Game Programming Wisdom 2 Forbus, K., “How Qualitative Spatial Reasoning Can Improve Strategy Game AIs”, IEEE Intelligent Systems, July/August 2002 Thief: Deadly Shadows, Ion Storm/Eidos Interactive 2004