Jump to content
  • Advertisement
Sign in to follow this  
lride

Quickly retrieving entities by position

This topic is 2027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In a tower defense game for example, I want to get all the entities within a splash tower's range. How is this usually implemented?

Share this post


Link to post
Share on other sites
Advertisement
Depends entirely on the game.

Most major 3D games use a spatial tree, such as a loose quadtree, and store object IDs in there. When an object is moved the corresponding entry gets updated. Queries for overlappinng areas of a spatial tree are extremely quick and will return a collection of object IDs.

If your game is tiny and you only have a few dozen or even a few hundred objects and the checks are rare, a simple brute force check to get the squared distances may be more than adaquate.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!