Jump to content
  • Advertisement


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


2d BSP tree or what?

This topic is 6629 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 about to ask how to blt all things on map without getting them overlaying over each other? First should be ground, then units, then buildings, then trees, right? But like I got a big house and a tree above it, what should I do in that way? Don''t allow user to put tree over there or what? THANKS

Share this post

Link to post
Share on other sites
I don''t think a binary space partition tree is your answer here.

I think you should just create a z-order for each unit of visible space and then test that against whatever you want to put there.

Share this post

Link to post
Share on other sites
Z order the sprites and draw them from back to front.
It should be ground, then all the other stuff, depending on Z order.

#pragma twice

Share this post

Link to post
Share on other sites
Yes, Furby''s right. In my RPG (isn''t everyone writing one these days?), I have an ImagePrecedence variable for each object that states which "layer" it''s in. So there''s a ground layer, a shadow layer, a normal layer, and several overlayed layers for glow effects, particles etc.

If you order objects in terms of precedence (from ground upwards), and then Z-Order them as Furby suggests (as a secondary method of ordering), you can place streams of light coming in from windows over players, or patches of dirt under players'' feet. This could solve your tree problem, too. I just hope it''s explained well enough...


C++ is the language of the not-so-ancients.
Learn to speak it well.


Share this post

Link to post
Share on other sites
You are all right. But you can use a BSP too (like Doom). It is just a way of splitting the crossing walls, thats all . Z-order is easier to do and understand though, and it takes a hell of a long time to actually split your world into a BSP tree.

PS.. Gee, there are a lot of Aussies here eh? Cheers fellas

-Chris Bennett of Dwarfsoft
"The Philosophers' Stone of Programming Alchemy"
IOL (The list formerly known as NPCAI) - A GDNet production
Our Doc - The future of RPGs
Thanks to all the goblins over in our little Game Design Corner niche

Share this post

Link to post
Share on other sites
OK. Thanks for all replies to all!!
I was thinking that I can achieve all that without Z order. Look.

firstly I''m drawing lines like:
1 2 3 4 5 6 7 8
9 10 11 12.. and so on.
So, I think I can just draw each layer for each tile.
Like, I got for tile (11,12) a ground and a tree so I put them in order to draw firstly ground, then all the following. Right? )
I''ve been thinking about this last day, though this would solve the problemo. If not, please post some more replies, ok?? )
I put all drawing layers in ordrer:

and others( I don''t know others yet... ) )

How is it looks?

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!