Quote from: jumpjack on Fri 13/01/2023 09:01:05Quote from: Khris on Fri 13/01/2023 07:42:45If two overlays have the same z-order, their per-frame order is based on the cosmic rays hitting the earth and the energy flowing through ley lines in that precise quantum moment, which makes them flicker to the front and back.Funny... but I think this is not the case: if you watch carefully you can see that flickering is not random, it always happens at same moment on same overlay when player is in same position. There is something in the engine code which makes player position influence overlays draw order.
![]()
It's not literally "random", as in Khris's joke. The actual result is determined by the number of game elements, their z-orders, and std::sort algorithm. As character moves around, its z-order changes (with y coordinate), which affects overall sorting. Elements with equal z-order will be treated depending on a coincidental factor. This result is actually deterministic in a given environment, but it won't help to know how it's received, and should not be relied upon, that's the point. (Hypothetically, it may even depend on C++ library implementation used when compiling the engine, so different versions of engine on different platforms may have slightly different result.)