Results 1 to 7 of 7

Thread: My solution to the overlapping issue in isometric worlds.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Is GroundSizeY the index of last item, or count of items in array? Your current code would suggest that it's index of last item.
    Code:
    OrderHeap : Array[0..GroundSizeY] of ^tOrder;
    If you want it to represent array length, you need to change the array to
    Code:
    OrderHeap : Array[0..GroundSizeY-1] of ^tOrder;
    And actually there is nothing wrong with sorting. We aren't sorting any drawn tiles, because they are linear anyway, and simple mathematics can tell the order in which to draw. But what remains is all the game objects, such as players and objects, which aren't tied to any tile. If they are, they are drawn right after the tile itself.

    As for sorting, you have different algorithms to choose from. You don't need to go through all possible checks every frame, because there is very high propability that the whole object array is not going to be much different next frame. So for each unique object, you could only compare it to previous item, and push it back if it's higher/lower in Z order. Then stop with that item and do the same for next item, and so on. But even if it's "slowly" sorting the array the way it should be, it's faster than player can see, and trivially fast for the CPU.

    edit: Oh, drawing a freely placed sorted object array in the mix of tiles... I think it should be done at the same time as the tiles are. Going through the list and comparing Z order to the currently drawn tile.
    Last edited by User137; 02-11-2013 at 11:58 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •