Not really an answer (as the code will be rewritten anyway) so few hints for the new code instead (some of them are already mentioned in the comments).
-
Tileset
In the final isometric engine use sprites. They are faster and support pixel art. For my purposes I use compilation of these two free to use tilesets (
64x64
):- outside tileset
- medieval building tileset
Both are compatible. I compiled and edited them to suite the needs of my engine. So this is what I use (still work in progress):
White color
0x00FFFFFF
means transparent. The sprite is not enough. I added info about the height of tile and rotations.If you see first 4 tiles from upper left corner they all are the same thing rotated by 90 degrees. So all my tiles have index of 4 tiles (the 90 degree rotations)
int rot[4]
. This way I can rotate the whole map or just view. I compile the set so the rotations are next to each other. There are 3 options:tile[ix].rot[]={ ix,ix,ix,ix };
whereix
is tile without rotation (ground)tile[ix].rot[]={ ix,ix+1,ix,ix+1 };
whereix
is tile with2
rotations (those 2 tiles with chunk of chopped tree in the middle right)tile[ix].rot[]={ ix,ix+1,ix+2,ix+3 };
whereix
is tile with4
rotations (like the first tile)
The indexes are valid of coarse only for the first tile only, the others have the whole
rot[]
array rotated by 1 value from neighbor. Some rotations are invisible (see the wide trees) but the tile is still present to allow rotations.The tile height is important for placing tiles while editing and also for automatic map generations.
I plan to add also
A*
map for each tile so I can use path finding or compute watter flows and more. -
Map editor
I prefer 3D maps. with bigger resolution you need to properly select the viewed area for viewing to maximize performance. Also a good idea is to create hollow underground so the rendering is much faster (this can be also done virtually during rendering process without the need of updating map).
I recommend to code these features:
- make ground hollow
- make ground solid
- random terrain (diamond & square)
- filter out small holes and smooth edges (add the slope tiles to cubic ones)
-
tile editor
Apart from the obvious paint editor you should add also another features like:
- floor
<->
ceiling - left
<->
right - front
<->
back - divide large sprite into regular tiles
- copy/merge/paste
- adjust lighting after left
<->
right mirror operation
They are really handy while compiling/editing tileset resources. As you can see my tileset has many of tiles not present in the source tilesets. They were created by these functions + some minor paint editing… The colored masks on the bottom of the tileset are used to mask out and properly combine parts of tiles to create the missing ones … (you can take one side form one tile and other from other …)
- floor
[Notes]
For more info/ideas have a look at some related Q/As:
- Improving performance of click detection on a staggered column isometric grid
-
How to procedurally generate isometric map
And here my Standalone no install Win32 Demo:
-
demo v1.000
-
demo v1.034