Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zoomby

finding objects/sprites on tiles...

This topic is 5545 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

hi What is the best way to find objects/sprites on a tile in a basic tile-based role play game? sould every tile have a container object which contains the sprites currently exisiting on the tile, or should there be no relationship between tiles and sprites, and then searching the sprite list for a position? Or is there a third way? I don''t want to use difficult tree-search techniques, so I wonder if it would be a waste of memory to create, say a STL container object for every Tile on a big map bye chris

Share this post


Link to post
Share on other sites
Advertisement
Whats so difficult about a search tree? A nice 2D quad-tree could be implemented very easily and works very well. Yes, it would be a huge waste of memory to have an STL container on very dense tile grids (unless you had millions of objects with multiple objects on each tile). A better approach (if you don''t want the tree) would be to use containers on a much coarser grid (say 128x128 pixels). This grid would be totally independent of the tiles of the background and will allow for fast lookups of nearby objects.

Share this post


Link to post
Share on other sites
hi

the problem is, I never worked with or wrote trees. Do I need to implement the tree myself, or is there useful class out there?
A good tuorial wouldn''t be bad as well. Any tips?

bye chris

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!