Questions tagged [spatial-partitioning]

Spatial partitioning refers to dividing up some space (such as the game world) into regions with the intent to efficiently search or traverse those regions or the objects within those regions.

Spatial partitioning is an important divide-and-conquer technique used in games, typically for optimizing queries for game objects.

Hierarchical data structures such as trees are common in spatial partitioning techniques (BSP trees, kd-tree, bounding volume hierarchies), but non-hierarchical solutions, such as grid partitioning, are also applicable.

21 questions
24
votes
4 answers

How can I detect "rooms" in a 2D side scrolling game?

I'm looking to create a system that recognizes certain types of buildings and rooms you can create in game, like how Terraria detects "residences." In that game, a house can be constructed in a tile-based world by constructing a zone of blocks…
Bernardo Becker
  • 343
  • 2
  • 6
3
votes
0 answers

How often should I do a spatial partition over a top down MMO 2D game?

I am writing an top down 2D game like agario/diep.io and I am using spatial hashing for detecting on screen objects. However I find it is too expensive to do a spatial partition a few times a second. (I do it at an interval of 250ms) I have about…
newguy
  • 255
  • 2
  • 11
0
votes
2 answers

Looking for a 2D spatial partitioning method for my top down browser game

Hi I am currently using a modified version of spatial hashing algorithm written by Christer Bystrom. This algorithm is OK for collision detection. However when I use it for detecting entities in interested range it has its limits. I use a huge map.…
newguy
  • 255
  • 2
  • 11