When I had first started working on the isometric engine, it was to honestly get it done and move on to the rest of the game. I did a few days of researching information and trying out a few things, I knew how I was going to do it, but I wanted to see other approaches and how easily I could get those to work. In the end it took me barely an hour to get the basics programmed in and going after 3 days of research.
At first the engine wasn't going to involve stacking tiles and instead you adjusted each tile's height and it got higher, dirt or whatever the block was made of would fill in as the tile was raised. This was working perfectly for my project I had very few hiccups with it and everything was going smoothly. I started to add in noise functions to generate terrain and that was working out so well to that I was surprised at my own progress when I thought for sure this was gonna take the longest out of making the game.
Given the actual coding and how simply it really was I decided then that it would be something cool to share with the GMC. Isometric games you really don't see often and if it helped get a few more in the WiP section that was fine by me . Thus the blog was started, a discussion topic on isometric engines GMC Topic was created and it went very complex real quick xD.
Well I say complex because it was suggested that it would be really cool if say an a RPG you could fight battles on a stairwell and that started the implementation of more then a single swath of tiles on the ground. Actually I had already did the first iteration with multiple tiles supported but for what I was needing I found a single tile just adjusted up was really really simple and it worked. So began "layering the world" as the Post title suggests and all though it hasn't been difficult there has been a lot of problem solving.
One of the harder aspects of isometric is depth control, maintaining what should be drawn where and at what depth, all this and just a little bit of anything being off something messes up. How about some visuals for the slightly more challenging fixes:
I would like to point out that the screenshot is of the very early Map Editor with just the basics in there. Most of the functionality is through key bindings but as the tile handling gets complete the Editor will receive a new face ;).
Tile are defined by what kind of tile it is, it's Z height, and the layer it occupies, tile depth is retrieved not only by the placement within the game world based on it's "y" and "x", but also it's height and the layer it occupies. You would think the height alone would be enough to help any one tile maintain it's depth, but as you got tiles around the same height but just slightly adjacent and offset by the tile stacking, things would get out of depth.
To solve this enter "tile layers", it works pretty much like this: The very first layer is the base ground, that layer all tiles can have it's own height and be adjusted in various ways. The next layer would be any new tiles you place on top of other tiles and because there depth is adjust due to the fact they are higher layers it makes sure they are always drawn on top.
If you maintain correct layering with height there *shouldn't be any depth issues, I say shouldn't because it hasn't gone through rigorous testing just yet but all my tests come up with no errors. Currently the engine doesn't maintain this ratio of height to layering mainly because of the noise functions added in earlier. They adjust layer 0 of the world and gives it random heights then smooths them down to form really nice looking terrain, which can be seen here:
It allows some nice RTS style terrains but forcing a height to layering causes problems. One solution is to bump up any tiles above a certain height to the next layer but then 2 tiles cannot occupy the same place at the same layer, well they could but I don't feel that is necessary with the layering in and is a load more work on my end :S. Currently my idea is to just visual present an icon or warning when any certain tiles approach this threshold within the editor, it happens when you stack say 8 tiles up then stick one tile down at the bottom and raise it's height to the top. On some directions it appears fine but once you start rotating the map you being to see where it doesn't work from certain angles. The fix? just make sure the tile you want to raise up is within a 3 layers of the tile you're putting the new tile at, very simple :D. There will be ways to adjust any one tiles layer and even quicker fix just make the tile that's out of depth a higher layer
Don't worry about features like tree's or the "units" on the map, there depth is based on the tile they are standing on so they always maintain depth. As long as the tile is correct so will the objects that occupy it.
And with that I think the blog post is long enough xD I am probably making these to long, I don't know, I start talking and just keep going. So just let me know if I ramble on a little to long and thanks for reading!
Be sure to leave comments or suggestions and hit follow!