1
Graphics / Isometric Depth?
« on: December 20, 2012, 10:37:45 am »
I am working on a map engine for isometric tile based maps. I am thinking on how to draw the sprites and map tiles in the right depth order.
I have made my own implementation of a vertex array with all kinds of extra features just for drawing isometric tile maps such as being able to draw for Y[0] to Y[1] so i was thinking i could store each drawable object in the game in some kind of depth sorting class that divides the screen into screen height / tileStepY (if a isometric diamond is say 32 pixels height then the step is 16 pixels) and then sorts the sprites by their bottom of their shape (the feet) into a bunch of arrays for each depth division. This way when i move a sprite in the map i just have to give its new foot position to the depth sorting class and it would move it to the correct depth division.
This would allow me to draw the map tiles for each depth division and then the sprites that need to be drawn next then goes to the next depth and draws the tiles of the map for that division then the draw that depths sprites. I can optimize this to detect depth divisions with no sprites so i can draw multiple depth divisions of the map tiles at once.
My question is, as i have no idea how this is normally implemented and have come to this style on my own, is this a bad idea or are there any problems anyone can see that i may run into later? I am not sure as well if i should store all active sprites in a overall array and then use its indices or something as an ID and use that to reference that drawable/sprite in the depth arrays or what but that is another issue.
How would you do isometric depth sorting/drawing?
I have made my own implementation of a vertex array with all kinds of extra features just for drawing isometric tile maps such as being able to draw for Y[0] to Y[1] so i was thinking i could store each drawable object in the game in some kind of depth sorting class that divides the screen into screen height / tileStepY (if a isometric diamond is say 32 pixels height then the step is 16 pixels) and then sorts the sprites by their bottom of their shape (the feet) into a bunch of arrays for each depth division. This way when i move a sprite in the map i just have to give its new foot position to the depth sorting class and it would move it to the correct depth division.
This would allow me to draw the map tiles for each depth division and then the sprites that need to be drawn next then goes to the next depth and draws the tiles of the map for that division then the draw that depths sprites. I can optimize this to detect depth divisions with no sprites so i can draw multiple depth divisions of the map tiles at once.
My question is, as i have no idea how this is normally implemented and have come to this style on my own, is this a bad idea or are there any problems anyone can see that i may run into later? I am not sure as well if i should store all active sprites in a overall array and then use its indices or something as an ID and use that to reference that drawable/sprite in the depth arrays or what but that is another issue.
How would you do isometric depth sorting/drawing?