I am working on custom 2D engine for a game.
I am having trouble figuring out a working system for sprite drawing-order sorting for this specific game.
Game description:
- 2D
- Top-down perspective
- Multiple floors
- Bridges


- Characters (Player characters, enemies, NPCs) move around freely. Movement is not tile based (constrained to grid).
- Characters can be positioned and move around any Floor and move between Floors.
- Objects (crates etc.) can be positioned on any Floor. (Not on Stairs.)
- Floors are traversed using Staircases.
Staircase is a "ramp" connecting 2 Floors.
Staircase can connect 2 Floors that can be any number of Floors …