Cytopia icon indicating copy to clipboard operation
Cytopia copied to clipboard

Implement depth-first sorting algorithm for mapnodes

Open SimplyLiz opened this issue 2 years ago • 2 comments

Currently the mapnodes are sorted by a Z-index. which works fairly well for 1x1 tiles. For multitile buildings, it's not possible to calculate a Z-index that will work. Instead, mapNodes should be sorted by a depth search.

I think it's safe to assume, that only the BUILDINGS layer will inhabit multitile buildings. We will still need a basic Z-Order for the overlapping terrain tiles. Worst case, we'll have two containers (with mapnode*) in two orders, and move the rendering to Map to render each layer.

I found this article: http://shaunlebron.github.io/IsometricBlocks/ Source Code: https://github.com/shaunlebron/IsometricBlocks

SimplyLiz avatar May 04 '22 11:05 SimplyLiz

Hi, I'd like to help with this issue. But I found that current implementation doesn't use Z-index. Is it ture? And why there will has multiple buildings in one node?

iaGuoZhi avatar May 10 '22 01:05 iaGuoZhi

I'm refactoring mapNode soon to help with this as preparation. I'll tell you when i'm done and we can discuss the details.

But I found that current implementation doesn't use Z-index This is true, nodes are ordered in "calculateVisibleNodes" in a for loop.

SimplyLiz avatar May 24 '22 11:05 SimplyLiz