Jump to content
  • Advertisement
Sign in to follow this  
nex7

quick 2D Z sorting solution for staggered maps

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

which should work for diamond maps as well. I just wanted to post this here because I couldn't really find a concise solution on the forum. z = yPos - tileDepth where yPos is the y position in the tile array tileDepth is how many tiles high the object would normally be in 3D space. (not image height in tiles....the amount of tiles the base of the object would take up if it were a 3d mesh) Add all drawable objects into a list...sort by Z and make a render pass. So far I haven't found a situation where this simple equation fails. Probably will at some point but it's a start.

Share this post


Link to post
Share on other sites
Advertisement
This is pretty much the Painter's Algorithm, is it not?

You're unlikely to run into any problems with it, for isometric lands; but for more general meshes and whatnot, you'd want to do some cutting - with Newell's algorithm.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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