Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for NRT tunnels #79

Closed
Andrew350 opened this issue Dec 22, 2019 · 14 comments
Closed

No support for NRT tunnels #79

Andrew350 opened this issue Dec 22, 2019 · 14 comments

Comments

@Andrew350
Copy link

Currently the NML language has no support for providing tunnel sprites for roadtypes or tramtypes. Inclusion of both the "tunnels" and "tunnel_overlay" callbacks for these features would be ideal to allow authors to complete their NRT NewGRFs in time for OpenTTD 1.10.

@andythenorth
Copy link
Contributor

andythenorth commented Feb 21, 2020

Original frosch spec includes tunnels. https://wiki.openttd.org/Frosch/NotRoadTypes#Tunnel

[digging]

I don't see tunnels in the nfo spec or https://wiki.openttd.org/NewGRF_Specification_Status#OpenTTD_1.10

[further digging]

I don't know how action 3 is resolved, but tunnel is missing for RoadTypeSpriteGroup:
https://github.com/OpenTTD/OpenTTD/blob/13cc8a0ceec90def39cbcb84135a0bf039793a6f/src/road.h#L54

Whereas it's present for RailTypeSpriteGroup: https://github.com/OpenTTD/OpenTTD/blob/b769eb30c43ccbc4e60b8b7df024253ac55d2265/src/rail.h#L43

@glx22
Copy link
Contributor

glx22 commented Feb 21, 2020

I don't see any use of overlays when a road tunnel portal is drawn
https://github.com/OpenTTD/OpenTTD/blob/b769eb30c43ccbc4e60b8b7df024253ac55d2265/src/tunnelbridge_cmd.cpp#L1264-L1274
So NML can't support a non existing feature ;)
Unless we are talking about catenary overlay
https://github.com/OpenTTD/OpenTTD/blob/b769eb30c43ccbc4e60b8b7df024253ac55d2265/src/tunnelbridge_cmd.cpp#L1292-L1306

@andythenorth
Copy link
Contributor

@glx22 so is your conclusion that there's no support in OpenTTD for custom road (or tram) tunnel sprites?

That's my understanding, from reading src.

OpenTTD ticket needed?

@glx22
Copy link
Contributor

glx22 commented Feb 21, 2020

Yes that's my understanding, only catenary overlays are supported, both in openttd and nml.

BTW example on https://newgrf-specs.tt-wiki.net/wiki/NML:Roadtypes is wrong, there's no "tunnels" callback

@andythenorth
Copy link
Contributor

BTW example on https://newgrf-specs.tt-wiki.net/wiki/NML:Roadtypes is wrong, there's no "tunnels" callback

Thanks, fixed.

@frosch123
Copy link
Member

Roadtypes do not include tunnels for the same reason they do not include bridges and stations.
On one tile there can be both road and tram, but only one tunnel/bridge/station.
Tunnels would be part of https://wiki.openttd.org/Frosch/ButGroundTypes , but NRT they make no sense.

@Andrew350
Copy link
Author

@frosch123 Ok, so the idea was that roadtypes were not going to have the ability to provide custom tunnel entrances like railtypes do, in favor of waiting for a whole new schema of ground types? I love the spec proposed there, but with all due respect it sounds like another huge project which is years away. Meanwhile NRT is already going "live" in a month or so, and it would be nice in the meantime to at least have a basic implementation to provide some custom tunnel sprites similar to railtypes. Is that at least open to consideration?

@andythenorth
Copy link
Contributor

For NRT tunnels, the blocker is that there's no rationale for determining whether to draw the tram tunnel, the road tunnel, or overlap sprites for both on the same tile. :)

If both the road type and the tram type on the tile provide tunnel sprites, I can't envisage that looking good.

With catenary, both the road type and the tram type can provide the sprites, and authors need to make sure that doesn't look bad by keeping catenary sprites simple so they can be combined. That's going to fail sometimes, but at least it allowed NRT to be implemented.

But for tunnels I can't figure out a way to use the same approach and have any hope of a good result :)

@Andrew350
Copy link
Author

Ok, I guess I can understand the issue with drawing the portals, so how about a callback for just the road/tram surfaces, not including the "structure"? That is definitely in-scope of NRT and doesn't involve any conflict of which sprite to draw over another.

That at least would allow for some very basic control of tunnels for NRT authors until something better comes along :)

@frosch123
Copy link
Member

Tunnels already draw the normal road/tram overlay, just like rail types also do. Why would they need to be different?

@Andrew350
Copy link
Author

Tunnel portals are quite narrow, so the normal road tiles sometimes overlap the sides of the tunnel (essentially the same reason why bridges have special overlay sprites, to make them "fit") . It would also allow for shadows/lighting inside the tunnel for better effect, and just to make things prettier in general :)

@PikkaBird
Copy link

+1 to this request, just being able to use a different overlay sprite for the road in the tunnel entrance would be 95% of the way there, even without different portals.

Tunnels already draw the normal road/tram overlay, just like rail types also do. Why would they need to be different?

The road in the tunnel may need to be narrower, different marked, shaded, etc. That's why we have the option to provide different (or no) overlays for rail types.

@EmperorJake
Copy link

It seems silly and inconsistent for railtypes to be able to provide their own tunnel portal sprites, but not roadtypes. It would be nice to specify different tunnel graphics for modern highways, old dirt roads, and metro tram tracks for example, just like you see in railtype GRFs with modern high speed lines, old branchlines and metro tracks.

As for the problem of which tunnel gets drawn in cases of both road and tram, simply draw the road tunnel if a road or road+tram is present, and draw the tram tunnel when only the tram track is present.

@EmperorJake
Copy link

EmperorJake commented Apr 9, 2023

The fact that this grahical issue is not solvable seems like a bug. It also has nothing to do with the tunnel portal itself necessarily, as the provision of a custom road overlay would be enough to solve it. Please reconsider adding this feature to the NRT spec.

image

EDIT: I have been informed that the latest dev version of NML supports the road tunnel overlay . While it doesn't solve the portal issue, it does allow to solve the issue of wide roads overlapping the portal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants