A large building is drawn over the small house in front of it, or under the one behind
Sorting buildings by the position of one corner works for equal tiles and fails as soon as a long building stands next to a small one. The picture then shows a wall poking through a house. Here is a rule that compares the footprints themselves and an ordering that always ends.
Why this works
What stands in front must be painted last, and that is a question about which building blocks the view of which, not about one number each. Comparing pairs by their extent, then ordering so that nothing is painted before what it hides, stays right for long buildings too.
When not to use it
Do not bother when all buildings are the same size, or when the camera looks straight down with no overlap. A simple sort by position is enough there; for smooth free shapes let the graphics card decide with depth.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 25 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "A large building is drawn over the small house in front of it, or under the one behind" (read_entry strategy-draw-order-for-big-buildings) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP