Spatial Index
Speed searches by position in a Model Database.
[size="5"]Intent
[size="5"]Problem
A few examples of spatial searches:
- The renderer needs to cull objects which cannot be seen.
- A trigger needs to determine if the player has passed over it.
- The UI needs to determine what object was clicked on by the mouse.
- The physics needs to detect collisions.
- A time bomb needs to determine what to damage.
[size="5"]Solution
Indices must remain synchronized with the associated Model Database. It is common to see the spatial index implemented within the framework of a Model Database.
Spatial indices are often considered a View pattern optimization and become strongly associated with View code. Because the index is usually read-only by the view, but read-write by the model, it should probably belong more to Model code than to View code.[/bquote]
[size="5"]Examples
- Binary Space Partition Trees
- X and Y Hashes with threaded collision resolution
- Portals which link isolated spatial indices
- Octrees
[size="5"]Issues and Risks
Coupling: Spatial indices have a tendency to become too tightly coupled with their associated database, which can reduce flexibility and reusability. The index can be overly optimized for a particular subsystem leaving it less useful for another subsystem. For example, if the Spatial Index is highly optimized for and coupled to the renderer, the AI subsystem might have trouble using it to find the nearest enemy units efficiently.
Synchronization and duplication: The keys in an index must remain synchronized with the values in the database. This can be difficult if the index is cached to improve performance. If a unit moves in the database, the cached data in the Spatial Index must either be updated or invalidated. Uncoupling an index from a database can create synchronization problems. Data is often duplicated from the database to the index, which consumes resources (both memory and overhead keeping the data synchronized).[/bquote]
Also, Mike Abrash describes Quake's Spatial Index, called the Potentially Visible Set, on Blue's News at www.bluesnews.com/abrash. The PVS is actually a Spatial Index that references a BSP, another Spatial Index.[/bquote]
Related Tutorials
Balancing Game Development and Creative Direction in Indie Production
A practical look at how indie developers can balance creative direction with hands-on game development. This article co…
My Unreal Engine Development Process: From Core Idea to Playable Build
A practical overview of my Unreal Engine development process, covering how I move from a core game idea to a playable b…
Introducing LaneGraph: The Ultimate Road Network Solution for Unity
Discover the power of LaneGraph, a lightweight and flexible lane-based navigation system for Unity. LaneGraph makes it…
Retargeting Mixamo Characters with Root Motion In Unreal Engine 5.4.
I have always found Retargeting Mixamo Characters To have Root Motion is a serious lengthy Tast, Recently I stumbled up…
How To Make A SIMPLE Main Menu In Unity
In this tutorial for unity, i go over how to make a simple main menu for unity, it's an unlisted video because i do not…
Guide to Gameplay Balance
A perspective on competitive gameplay balance, from a background of "shooter" sandbox design.
Discussion
More from Zachary Booth Simpson
Comparing Shadow Mapping Techniques with Shadow Explorer
New Incentives and a Whole New Platform From The Intel AppUp developer program
The final installment in this series on Intel's AppUp program details additional incentives and opportunities for devel…
The Game Maker
This book excerpt contains the first chapter of the book that introduces beginning game developers to the Game Maker pr…
Discussion