Archived

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

_stalker

Object management

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
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