Problem with Z-Layering of graphics

Bug #839386 reported by Astuur
42
This bug affects 6 people
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Low
GunChleoc

Bug Description

bzr 5958.
There is a problem in the way the game decides which graphics should cover which other ones.
This can be see most noteably with the quarry, but the problem is also with animals and immovables, and to some extent also to houses and fields.
When returning north, the stonemason seems to go underneath the stone pile.
To reproduce: play the game. Any map, any world, any tribe.
Build a quarry positioned north of a stone field. Watch the stonemason go to and return from his work.
Could somebody please identify and understand the code, and in conjunction with the graphics department
discuss ways, how irritating Z-layering could be avoided, or its characteristics be use advantageously.
Perhaps the code could even be altered to allow more flexibility in the way workers and animals
approach immovables and retreat from them, when they need to go north.

Astuur (wolfsteinmetz)
tags: added: gamedata graphic
Revision history for this message
Astuur (wolfsteinmetz) wrote :
Chuck Wilder (chuckw20)
Changed in widelands:
status: New → Confirmed
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I'd just want to add a short comment: I recently played through the Settlers 2 demo again, just to see how it is compared to Widelands these days. Anyways, I noticed at least in one place where a carrier walking on a diagonal road would have his head displayed beneath the corner of a nearby house.

So I think it is safe to say that dealing with the z-layering is a known issue, and probably pretty hard to fix completely. That said, we should of course strive to minimize the impact of this problem, and at least deal with the most obvious places this could cause a problem.

A question for the programmers; how is the engine set up? Would it be possible to delay drawing any workers until houses have been finished, so that workers would always be shown in the front at least?

Revision history for this message
SirVer (sirver) wrote :

currently, the engine stats top left and renders each node row wise from left to right. It draws first the floor tiles for each node (right and bottom triangle), than immovables, than associated bobs (IIRC). Maybe we can solve the problem by delaying the drawing of bobs by one row (so starting to draw bobs of the first field as soon as we start the SECOND row of floor tiles and immovables). This would make bobs always atop of immovables... if I think correctly currently.

Changed in widelands:
importance: Undecided → Low
status: Confirmed → Triaged
Revision history for this message
Venatrix (elisabeth) wrote :

That sounds a bit like the carriers are always in front of a building, no matter, if the road is „in front“ or „behind” it. Is that right?

Revision history for this message
SirVer (sirver) wrote :

not necessarily. I didn't think it through, but I think clever iterating for the various objects can improve the situation. Some experimentation is required. I do not think that I am able to state an algorithm that would do things just right without any investigation and experimentation; I only want to say that I would experiment with changing the iteration order for the various objects.

Revision history for this message
Chuck Wilder (chuckw20) wrote :

To perhaps help clarify (or muddy) the matter, I draw your attention to http://wl.widelands.org/forum/post/5998/.

Hope it helps. :)

Revision history for this message
fuchur (fuchur77) wrote :

I guess this is not unexpected, but the problem also occurs with ships and the frontier posts in the water.

Revision history for this message
Joachim Breitner (nomeata) wrote :

Could be related to or duplicate of bug 939544.

Revision history for this message
Borim (borim) wrote :

It looks like Z layering depends not only on the position of the objects but also of the walking direction. When you look at the screenshot, you see on the left that the carrier walks south and for the complete road, everything is fine.

But on the right side the carrier walks north and he is under the building.

(bzr revision: 6528)

Revision history for this message
Nicolai Hähnle (nha) wrote :

The explanation is really quite simple, and fixing most cases should not require black magic, I just never got around to it.

The point is that everything is rendered one Field at a time, as SirVer said from top-left to bottom-right, but moving Bobs are always associated with the Field they are walking _towards_. So a little bit of thought needs to go into special-casing the drawing order for bobs that are currently moving.

Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Triaged → Incomplete
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

See duplicate bug 939544 for an example of overlapping with the barbarian bakery.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for widelands because there has been no activity for 60 days.]

Changed in widelands:
status: Incomplete → Expired
SirVer (sirver)
Changed in widelands:
status: Expired → Confirmed
Revision history for this message
GunChleoc (gunchleoc) wrote :
GunChleoc (gunchleoc)
tags: added: graphics
removed: graphic
Revision history for this message
giffel (xgiffel) wrote :

Barbarian Brewery is affected as well. It happens, when carrier/ox has upper left direction. On the opposite way it does not happen.

GunChleoc (gunchleoc)
Changed in widelands:
status: Confirmed → In Progress
assignee: nobody → GunChleoc (gunchleoc)
milestone: none → build21-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.