Astorath86

Initiate
Hey guys!
I know this does not concern servuo emulator but had no idea where to put it...so...let's move on, shall we? :)

If we have 2 static items placed on map - both in same location including "z" parameter - how it is decided which one will be on top (cover the second one).

I've tried changing their height (in tiledata) and check if the factor is their itemid and still got no clue.
Of course the item with higher "z" will be on top the one with lower but it's not the case - both items' location is the same.
 
Hi Astorath86, I think I can answer your question! There is a somewhat complicated sorting algorithm which I've done my best to replicate here: https://github.com/ZaneDubya/Ultima...2b7fc4e6f/dev/Ultima/World/Maps/TileSorter.cs

In summary, every object has a type value, a threshold value,and a tiebreaker value.

Grounds have type of 0, threshold of 0, and tiebreaker of 0.
Items have a type of 1, threshold of 0 (but if item data background flag is not set, +1, and if item data height is greater than 0, +1), and tiebreaker equal to their index in the statics mul, if static, or serial, if they are a dynamic item.
Mobiles have a type of 3, threshold of 2, and tiebreaker equal to their serial.
Effects have a type of 4, threshold of 2, and tiebreaker of 0.

When sorting two objects, the client first compares the z. Objects with higher z values are drawn on top. If the z values are equal, then the client compares the type, the threshold, and then the tiebreaker values of the two objects, in sequence. If, at any point, these values are not equal, then the object with the higher value is drawn on top.

I can't be 100% certain of the values I've included above, but they appear to emulate the legacy client 99.9% of the time.

Let me know if you have any questions!
 
Last edited:
Hey Zane!
Thank You for your help. In my case both objects were items but in their case Background flag helped - now items which in my case were shelves are not covering their content. Furthermore, your explanation will be handy in the future so more thanks to You!

No further questions from my side.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back