Jump to content
  • Advertisement

Archived

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

_stalker

Object management

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

I''m writing my first 3D game engine. For collision detection against static environment I''m planning to use BSP tree as it looks like a good way to go. But how about dynamic objects in a scene? For example what is a good method for checking collision between user and monsters in a game. The easiest way will be to keep every moving object is an array and every frame go through the array and check for collision. But there must be a faster way to do it. Another question, where is a best to keep doors, and items the user can open/pick up, like ammo and armor (by where I mean a data structure)? Again, the easiest way to keep them in an array and check every frame. But since doors and items do not move in a scene, is it possible to stick them into BSP tree? Any comments/suggestions greatly appriciated

Share this post


Link to post
Share on other sites
Advertisement
I''m working on the same problem right now. The solution I use dates back to 2D games where objects reside on a grid. When you step on a square you know what objects are there (The tile based system).

With 3D it''s a little more complicated but the same principle can work. Divide your Object map into sqaures of 10''x10''. Then to do sorting insted of looking at every object in the game, you just have to look at 1 or 2 objects on that grid. Monsters and players move around, so they must update which grid they are standing on, but that''s much faster than searching a list every game tick.

I hope that makes sense.

Share this post


Link to post
Share on other sites
Yes, this is what I had in mind. So I guess I''ll divide my map into bunch of cells and will use something like quad/oct tree.

thanks..

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.

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!