Archived

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

davidkosenina

Quad Tree in STL for large outdoor Areas.

Recommended Posts

Helo Is it posible to implement a Quad Tree by using STL. Quad Tree will be used for large outdoor areas of the game. Requarement: * If ( node is NOT in camera view ) { Dismis this node and all other child nodes! } else RenderSubnode(); Q1) Is it posible to implement this kind of Rendering/Scene Hierarchy by using STL containers or do I have to code Quad Tree myself. Q2) Where can I found good free Tree library with which I can realize Quad Trees, and similar Trees?

Share this post


Link to post
Share on other sites
I was in the same position a few months ago, thinking about scene managemenet on a 2d tile based rpg.

You can check out the thread here:
http://www.gamedev.net/community/forums/topic.asp?topic_id=166132

and sure, you could use STL... using either a vector-vector or just a plain vector and a making it width*height large (then just use a simple function to get the right vector index with a x and a y coordinate. It''s something like i = x + y*height)

a better alternative to the vector might be Boost Array: http://www.boost.org/libs/array/index.htm
because the std::vector can increase and shrink in size during existence, and that''s probably not needed if your map is static (i.e. doesn''t add or delete cols/rows just because the character did something.)

But then there''s also Boost MultiArray: http://www.boost.org/libs/multi_array/doc/index.html

good luck

"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