Skip to main content
gamedev.net
🔒 Locked

Sectorizing game objects

Started by Potsticker 0 replies 850+ views
Original Post
Potsticker
Potsticker
I''ve been toying around with a side scrolling blasting the carp out of everything game, and I''ve been thinking about different methods of collision detections and trying to come up with a method that would be efficient for thousands of objects. Not because I really need thousands of objects, but I''d like it to be as efficient as possible. Currently I have a routine that goes and updates all objects - ie move, and do any thinking or testing for player input. While going through this loop it seems that collision detection would be a pretty OK thing to be doing. My question is, how to manage what objects are relevent to test collisions against. My current plan, is to divide the world/playing area up into different sections, each section represented by a list of objects in it. During the update routine, it''s determined what sector(s) an object should belong to for testing. After all objects are updated the sectors test for collisions within themselves to see what''s up. Another idea I had was some kind of sorting method that would let objects know what ones are close to them. That way they''d test against what''s near them, and be able to stop at some range away from them. Of course, in a 2D world, managing this would be a little weird. So I was curious about what other people do to solve this problem.
Shannon Barber
Shannon Barber
One thing to consider, is that a method that efficently CT''s 1000''s of objects is not the same method that efficently CT''s 100''s or a dozen objects.

For the 1000''s you''ll have a bunch of overhead deciding whether a group of objects have a chance of colliding. In the dozens, you''ll already be done checking them all. I''m not where the trade off is, and worse, it''s machine dependant

So a good algo needs to know when to JFDI and when to use a BSP or OctTree.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.