• Advertisement
Sign in to follow this  

Seperated world intro smaller chuncks, object occupies more the none chunk

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

Hello.

I am doing 2d top down game, and i am storing objects as(chair, unit, tree, stone...) in a 1d vector, i used to loop all objects to seach for but, as the map grew in size and i require faster search for objects in it at this point.

For perspective, map size X = 3200pixels, map size Y = 3200pixels and has 5 layers, objects size vary from 5x5 pixels to 96x128 pixels in size, there can stacked one upon other.

 

What i require: I want to speed up the process when i search for a object that fits the search criteria. My solution would be to separate map intro smaller peaces and with that achieve easier search for objects.

 

For one scenario lets take this: A unit moves, it needs to check if position is valid, it needs to check each object if it collides with the new position unit wants to move to, it no collision found, position fine and it can reposition the unit, if collision was found no movement can be done.

I thought if i separate map intro smaller peaces i can check only the peace where unit wants to move and efficiently reducing amount of objects that it has to check collision with.

 

The question: What is the term called when i want to separate a big map intro smaller peaces, id like to read on the topic and educate, i have no experience in it, and i don't know the term.

Also if you want to do suggestions, fell free to do so biggrin.png.

Edited by BaneTrapper

Share this post


Link to post
Share on other sites
Advertisement

Spatial Hashing is also a term used for this.  Be sure to include that in your googling (you'll find some gamedev articles on it in fact)

Share this post


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

  • Advertisement