Jump to content
  • Advertisement
Sign in to follow this  
lride

Quickly retrieving entities by position

This topic is 1940 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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!