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

Started by
2 comments, last by BaneTrapper 9 years, 9 months ago

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.

Advertisement

Spatial partitioning?

http://gameprogrammingpatterns.com/spatial-partition.html

EDIT: Also see the references at the bottom for other methods of partitioning.

Hello to all my stalkers.

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)

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Thank you, i totally forgot i asked for it here, that helps allot!

This topic is closed to new replies.

Advertisement