Thursday, February 17, 2011

How to Make an Isometric Game Engine #2

Continuing from my last post, I am now going to ruin everything. Last time I said a simple 2D array would suffice for representing an isometric level, and things would appear correctly by just drawing them in the order they are in the array. For some games that might be ok, but in most cases it isn't enough.

Suppose you have a character that can smoothly walk from one cell to another.



This naughty red shirt isn't in his tile! Well, no problem you think, I'll just have the mobile characters separate from the underlying tiles. First draw tiles, then draw characters. Which works great when the floor is totally flat, but when you start having tiles that are a bit higher, like these bushes here, this happens:



The character should actually be drawn between the tiles, but now he seems to be floating in air. Your first thought might be to figure out which tile the character is in and draw him after right after that tile. The problem with that is that the drawing order could still be different if he is slightly behind the tree.



One possible solution to this in the next post.