Page 1 of 1

OTTD: glitch with custom tunnel portals?

Posted: 19 May 2023 00:28
by Snail
Hi all,

I'm developing the French Standard Gauge set. I drew some rather large tunnel portals, in the "monumental" style that was quite widespread at the end of the XIX century.
Unfortunately, there seems to be a glitch whenever I place two tunnels side by side:

SG tunnels glitch.png
SG tunnels glitch.png (18.88 KiB) Viewed 2530 times

As you can see from this screenshot, the portal towards the viewer is drawn "underneath" the slope around the other portal. As a result, the masonry around the corner seems chipped.
This bug was already present in my Narrow Gauge set, but it was less visible, because the portal itself wasn't so large.

Is this a glitch in OTTD? Can it be solved somehow? (and no, "draw a smaller portal" doesn't look like a solution... :roll: )

Thanks in advance!

Re: OTTD: glitch with custom tunnel portals?

Posted: 19 May 2023 01:44
by skc
Given that buildings overlap in the same manner, but don't clip each other like your tunnel portals, I suspect it's an issue with the coding of your GRF.
I'm not a GRF coder, so I don't know if I'm right or not, nor do I know how to fix it.

Re: OTTD: glitch with custom tunnel portals?

Posted: 19 May 2023 07:11
by OzTrans
Snail wrote: 19 May 2023 00:28 Unfortunately, there seems to be a glitch whenever I place two tunnels side by side ...
It is a problem with your tunnel roof; there is too much grass. There should be a grassy ground sprite laid first, so you can remove some of the grass to the left of your tunnel roof. The rest of the grass on the roof needs to match the grassy ground sprite. If you use the OpenTTD provided tunnel roofs, get rid off them (in base graphics by blanking them out) and provide all (bar the left portion) of the tunnel roof including grass.

I used to have the same problem ...

Re: OTTD: glitch with custom tunnel portals?

Posted: 19 May 2023 08:02
by michael blunck
There's a description of sprite arrangement for tunnel portal overlays in the m4nfo docs, under "railtypes". For coding them you could either define them in the usual spriteblock() [nfo's action1], or in a special spriteblock(TUNNELBASE, ..) [nfo's action5]. This works for me.

regards
Michael

Re: OTTD: glitch with custom tunnel portals?

Posted: 21 May 2023 17:52
by Snail
Thanks for your replies!

Michael: I'm not sure how to correctly draw and code the tunnel base. My spriteblock() already includes both RT_TNNL and RT_TUPO blocks, as you explain in your manual. If I look into your custom base sprites page, I can see ID 17 is reserved for parameter TUNNELBASE, and I can see this example:

Code: Select all

spriteblock(TUNNELBASE, 6,
  set(
    sprite(xtunnel.pcx 10 10 09 23 33 -26 0)
    sprite(xtunnel.pcx 45 10 09 23 33 -5 0)
  )
)
Can you please be a bit more precise as to what "xtunnel.pcx" should be?
I also looked in the Action5 page, but that doesn't seem to explain how the tunnel base sprites should look like.

Re: OTTD: glitch with custom tunnel portals?

Posted: 23 May 2023 00:52
by OzTrans
Snail wrote: 21 May 2023 17:52I also looked in the Action5 page, ...
That page is out of date; see Action5.

You can find the default base tunnel sprites in OpenGfx Extra GRF [ogfxe_extra.grf] around sprite numbers 1530++.

If you provide your own base tunnel sprites [using Action-5, type 17/97], you need to do that for all climates/terrain that your GRF can operate in.