News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Wish: Diagonal graphics for signals

Started by makie, July 24, 2026, 10:15:41 AM

Previous topic - Next topic

makie and 7 Guests are viewing this topic.

makie

#35
At the road traffic signs, the background and foreground are swapped in all direction.
But beware: for the railways, it is correct.

For driving on the left side of the road, this behavior would be correct. So, if the flag "drive_on_left" is set. Greetings from Japan!

It would be nice for motorway bridges if it is possible to define BackImage and FrontImage, but currently not possible.

For testing One-way street traffic sign added.
https://makie.de/diagonal-signal.zip

prissi

A no_shift flag would take care of gantries with front and back images...

makie

Quote from: prissi on August 08, 2026, 10:06:26 AMA no_shift flag would take care of gantries with front and back images...
No
Because one one bridge pillar is in front of the bus and the other is behind it, so it's obscured by the bus. If it's supposed to look nice, the there are two graphics.

Same for the One-way sign of pak128. There are Signs at both sides of the road. One bevor and one behind the bus. And this should be swapped for drive to the left. Same for the highway sign.

prissi

#38
Yes, two graphics, but not swapped as swapping with gantry would not work so the gantry would stay a gantry just not swapped. It would have the signs on the wrong side, but still would be a gantry.

EDIT1: Looking deeper into this, the sign system is severely flawed as there is no way to properly define the front and backimage in the first place. And the offset shoudl nto be needed, one should just mirror the image according to the central point of the tile.

EDIT2: With offset_left=0 for pak128 double signs, the road signs are at least no longer somewhere but at the same position as before. Still, a crutch.

makie

#39
Quote from: prissi on August 08, 2026, 01:20:54 PMStill, a crutch.
Yes
That's why I would suggest handling it the same way as with the winter graphics:
Bracket 0 = right-hand traffic,
Bracket 1 = left-hand traffic.

Since drive_on_left can only be changed by saving and reloading, it can select the corresponding graphic while loading.

Quote--------------------------------
#    PAK128.german
#    Signale
#    Neu:01-2011
---------------------------------
obj=roadsign
name=Einbahnstrasse
copyright=The Transporter
waytype=road
intro_year=1800
intro_month=1
cost=450
single_way=1
cursor=Einbahnstrasse2.0.4
icon=> Einbahnstrasse2.0.5
BackImage[0][0]=Einbahnstrasse2.0.1
BackImage[0][1]=Einbahnstrasse2.0.0
BackImage[0][2]=Einbahnstrasse2.0.3
BackImage[0][3]=Einbahnstrasse2.0.2
BackDiagonal[0][0]=Einbahnstrasse2.0.7,13,0
BackDiagonal[0][1]=Einbahnstrasse2.0.6,55,0
BackDiagonal[0][2]=Einbahnstrasse2.0.8,0,3
BackDiagonal[0][3]=Einbahnstrasse2.0.9,0,32
BackDiagonal[0][4]=Einbahnstrasse2.0.8,0,-29
BackDiagonal[0][5]=Einbahnstrasse2.0.9,0,0
BackDiagonal[0][6]=Einbahnstrasse2.0.6,-9,0
BackDiagonal[0][7]=Einbahnstrasse2.0.7,-51,0
FrontImage[0][0]=Einbahnstrasse2.0.1
FrontImage[0][1]=Einbahnstrasse2.0.0
FrontImage[0][2]=Einbahnstrasse2.0.3
FrontImage[0][3]=Einbahnstrasse2.0.2
FrontDiagonal[0][0]=Einbahnstrasse2.0.7,13,0
FrontDiagonal[0][1]=Einbahnstrasse2.0.6,55,0
FrontDiagonal[0][2]=Einbahnstrasse2.0.8,0,3
FrontDiagonal[0][3]=Einbahnstrasse2.0.9,0,32
FrontDiagonal[0][4]=Einbahnstrasse2.0.8,0,-29
FrontDiagonal[0][5]=Einbahnstrasse2.0.9,0,0
FrontDiagonal[0][6]=Einbahnstrasse2.0.6,-9,0
FrontDiagonal[0][7]=Einbahnstrasse2.0.7,-51,0
BackImage[1][0]=Einbahnstrasse2.0.1
BackImage[1][1]=Einbahnstrasse2.0.0
BackImage[1][2]=Einbahnstrasse2.0.3
BackImage[1][3]=Einbahnstrasse2.0.2
BackDiagonal[1][0]=Einbahnstrasse2.0.7,13,0
BackDiagonal[1][1]=Einbahnstrasse2.0.6,55,0
BackDiagonal[1][2]=Einbahnstrasse2.0.8,0,3
BackDiagonal[1][3]=Einbahnstrasse2.0.9,0,32
BackDiagonal[1][4]=Einbahnstrasse2.0.8,0,-29
BackDiagonal[1][5]=Einbahnstrasse2.0.9,0,0
BackDiagonal[1][6]=Einbahnstrasse2.0.6,-9,0
BackDiagonal[1][7]=Einbahnstrasse2.0.7,-51,0
FrontImage[1][0]=Einbahnstrasse2.0.1
FrontImage[1][1]=Einbahnstrasse2.0.0
FrontImage[1][2]=Einbahnstrasse2.0.3
FrontImage[1][3]=Einbahnstrasse2.0.2
FrontDiagonal[1][0]=Einbahnstrasse2.0.7,13,0
FrontDiagonal[1][1]=Einbahnstrasse2.0.6,55,0
FrontDiagonal[1][2]=Einbahnstrasse2.0.8,0,3
FrontDiagonal[1][3]=Einbahnstrasse2.0.9,0,32
FrontDiagonal[1][4]=Einbahnstrasse2.0.8,0,-29
FrontDiagonal[1][5]=Einbahnstrasse2.0.9,0,0
FrontDiagonal[1][6]=Einbahnstrasse2.0.6,-9,0
FrontDiagonal[1][7]=Einbahnstrasse2.0.7,-51,0

makie

Quote from: makie on August 08, 2026, 02:16:09 PMSince drive_on_left can only be changed by saving and reloading, it can select the corresponding graphic while loading.
Ok no, not possible, because pak-set is load bevor the save-game.

Nevertheless, I think this solution covers all possible cases, because you can assign a specific offset to each graphic.


prissi

I think having a back and front sign (like for gantries) is another thing to consider.

Image[n,s,e,w][0]  (old)
Image[n,s,e,w][1]  (left)
FrontImage[n,s,e,w][0..1]

analog.

Needs a special flag for traffic lights, which are currently only recognized by their image number.

makie

Quote from: prissi on August 08, 2026, 02:59:59 PMImage[n,s,e,w][0]  (old)
Image[n,s,e,w][1]  (left)
FrontImage[n,s,e,w][0..1]


Ok, missing diagonals  ne, nw, se, sw, en, es, ws, wn?

Edit: ups we have 8 diagonals



prissi

Diagonals are "diagonal[][]" and "fontrdiagonal[][]" then, similar to signals.


makie

#45
I created the "autobahn" traffic signs for pak128, including diagonal, frontimage and left-hand traffic.
https://makie.de/p128_sign_road_autobahn.zip
I created it carefully, but since I can't test it, there might be errors. The positions of the straight sections aren't optimal; I left them as they were originally.

Attention: The program normally decides whether it draw as backimage or frontimage.
If the pak provide frontimage then "image" must drawn as backimage. Independent of the program logic.
That might be nonsensical for vertical diagonals, but I use it to position the graphics on the left and right independently.

Should set "offset_left=0" automatically if graphics provided for "drive on left"?

prissi

Somehow neither on diagonals nor on straight tiles I seen a sign appearing. Unluckily, I had not more time to test this today.
 

makie

#47
Of course not, that requires the program change discussed above for drive on left. That is precisely why I haven't been able to test it.

Haven't you already received tons of error messages from makeobj?


prissi

A, sorry, I thought the signal code was incorporated. Indeed, makeobj does not yet recognize the diagonal images.

victor_18993

Hi,
I went through the whole thread again and reproduced the current problem against trunk r12171.
The main issue is simply that the signal code discussed earlier in the thread was never actually incorporated into trunk, so current
makeobj still does not recognize the new diagonal/front/left-hand image keys. That is why the current objects are ignored with
check spelling warnings and why the expected result is not visible when testing them.
I have prepared one updated patch against current trunk that contains:
  • the previously agreed 8-slot diagonal image support;
  • the later extension discussed in posts #39–#44:
     
    Image[dir][1],
     
    Diagonal[0..7][1],
     
    FrontImage[dir][0..1],
     
    FrontDiagonal[0..7][0..1].
The implementation keeps the normal image list unchanged, so the existing traffic-light detection by image count is preserved. The new image lists are stored separately and are only used when the pak provides them.
I also kept the fallback behaviour conservative: if a specialised image is missing, it falls back step by step to the normal image instead of making the sign disappear.
Validation performed:
  • all three current objects from makie compile without warnings with the patched
    makeobj;
  • legacy signs without the new keys produce byte-identical output;
  • right-hand and left-hand traffic variants were both tested;
  • diagonal and straight fallback behaviour was tested;
  • full Simutrans regression suite passes 286/286;
  • no new compiler warnings were introduced. 
There are two design points I have deliberately left visible rather than deciding them silently:
  • Traffic lights: in #41 Prissi mentioned a special flag because traffic lights are identified by image count. With this implementation the flag does not appear to be necessary, because all new variants live in separate child nodes and the main image list is untouched. If an explicit flag is still preferred, I can add it.
  • offset_left: I have not made it automatically switch to zero when left-hand graphics are present. Makie's current
    .dat already sets it explicitly, so I left that behaviour unchanged pending a decision. 
The patch is attached. It is against current trunk r12171 and contains only the signal/roadsign changes discussed in this thread.
If the overall shape is acceptable, I can adjust either of those two points before integration.
Regards
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)