Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

When I do a spatial partition, how often should I insert/delete entities?

$
0
0
For example I have 6000 entities on a 2D map and I want to get about 180 which are on my player's screen. When my player is moving new entities may appear on the map, at the same time some entities or enemies die so they disappear. I used to clear the entire spatial hash and insert everything again a few times a second. But I am thinking maybe it is better to only update those entities that change on the map, the number of changes may be huge though, but still, compared to the number of entities on the map it is still small. I am just not sure if this is worthy or not.

Viewing all articles
Browse latest Browse all 17825

Trending Articles