Archived

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

Seriema

2D scene handling?

Recommended Posts

Hi! I''ve been reading and playing with 3D for some time now. Been around binary/quad/oct/DAG-trees. But what would be good for a 2D game (isometric, tile-based) without being overkill? I was thinking something in the lines of a quadtree for the static world (tiles) optimized for searching (sorted std::vector perhaps?) and a quadtree for the dynamic parts (characters, items, etc) optimized for re-sorting (sorted std::list, or std::set? std::map perhaps?). Or a quadtree of "TileNodes" where each can have a list of dynamic objects? Any thoughts and tips and/or tutorials/articles would be appreciated! "No lies of sugar can sweeten the sournes of reality" }+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

Share this post


Link to post
Share on other sites
A bidimensional array. Since you need to store those tiles anyway, just add a pointer list to each tile, which contains everything on that tile. And add in a list of all objects too.

ToohrVyk

Share this post


Link to post
Share on other sites
is it good to separate the "static" from the "dynamic" world? the static part being basicly the tiles that set up the bakground and can "never" (well, switch from one tilenumber/texture to another.) be changed.

{ STATIC WORLD }
Yes, a bidirectional array would be a way to store the tiles. I''m trying at the same time have good occlusion culling because the maps are gonna be big. So sorting them with a quadtree?

I''ve been around a DAG and it''s quite usefull. In this case it could be used to switch textures while the tiles only hold a number?

A goal would be to have big maps, using tile-textures. But minimizing texture-switching (render all tiles from one textures, then all textures from another texture, and so on).


{ DYNAMIC "STUFF" }
It should be client-server oriented so that AI or other players can controll characters, game logic distributing items. But it should be optimized for collision detection and physics.

Some kind of sorting, first on the say y-axis and second on the x-axi? What would be good for characters that walk around and items being dropped here and there? Something that''s optimized for sorting and lookup for objects around a object (what stuff are in proximity of this say character?).

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

Share this post


Link to post
Share on other sites
Like I said, remember on which tile the center of the object lies, and each tile also "remembers" (use a list for this) all objects whose center lies on it.

Like that, when you need to check for collision, you only need to look at the tiles around your object (based on that object''s radius, and the max radius an object can have), select the objects they contain that can collide with the object, and finally check for the collision between these two objects.

ToohrVyk

Share this post


Link to post
Share on other sites