I have an Array of tiles in no particular order. How would I do a isometric back to front rendering on it? Do I HAVE to order it?
From your comments it seems that you are trying to handle chunks all at once when at any 1 time at most you would only need to handle 8.
Where C is the current chunk you are on and P is pre-loaded. Now when the user moves into one of the preloaded chunks you generate/reload the chunks the player is heading towards and write the chunks that are now out of range. By using this method your have pretty much unlimited size (I use the term loosely as there is always a hard drive capacity).
This could be expanded to have a varying pre-load range or maybe pre-loading multiple chunks at once.
Here is a step-by-step example of a implementation:
this would go on and on but you get the idea you ensure you only keep a set number of chunks in memory and load/unload the others.
Hope this helps
|show 3 more comments|
Depends on what your tiles are.
If they are the tiles from your map (fixed objects or terrain elements) they should already be ordered in a 2D grid. In this case, just run through your array in a defined scheme depending on the orientation of your grid.
If you refer to a bunch of random floating sprites, you will have to sort them. But it might not be that expensive; keep a sorted array of the visible sprites, and simply add or remove sprites as they become visible/invisible. Re-insert sprites that have moved, perform the re-insertion from their current position in the sorted array.