Sign in to follow this  
henk1988

Isometric engine

Recommended Posts

Hello, I have recently been working on a isometric engine in XNA. I have rendering working but on large maps (on my computer at about 500x500) is starts getting sluggish. The problem is the fact that all tiles are drawn regardless of whether they are on the screen. Right now I am looping through the entire array of tiles and checking whether the destination rectangle intersects with the graphics window rectangle. If so, then the tile gets drawn. I would however like to be able to determine beforehand which tiles are drawn and which are not so I don't have to loop through the entire array which is where I am losing the most performance right now. I haven't got a clue on how to start implementing this though. Any pointers would be greatly appreciated. Cheers!

Share this post


Link to post
Share on other sites
You could implement some hierarchy like a quadtree

This way, at the top level, you'll have 4 nodes to test for visibility, and rejecting one will reject 1/4 of all the tiles in your world


Alternatively, and probably a better approach is to calculate the tile at the top-left and bottom-right of the screen, and loop over those - that way you won't even need to test anything off-screen. Hopefully you can easily address tiles by X,Y so this is trivial

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this