OTTD: glitch with custom tunnel portals?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

OTTD: glitch with custom tunnel portals?

Post 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 1540 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!
The French Narrow Gauge Train Set is now released! Get it here
skc
Traffic Manager
Traffic Manager
Posts: 170
Joined: 17 Sep 2022 02:02

Re: OTTD: glitch with custom tunnel portals?

Post 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.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1675
Joined: 04 Mar 2005 01:07

Re: OTTD: glitch with custom tunnel portals?

Post 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 ...
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: OTTD: glitch with custom tunnel portals?

Post 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
Image
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: OTTD: glitch with custom tunnel portals?

Post 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.
The French Narrow Gauge Train Set is now released! Get it here
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1675
Joined: 04 Mar 2005 01:07

Re: OTTD: glitch with custom tunnel portals?

Post 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.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests