Surranding aware tram stations

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
luxtram
Route Supervisor
Route Supervisor
Posts: 417
Joined: 10 May 2016 19:09

Surranding aware tram stations

Post by luxtram »

Hello,

I have coded buildings and objects but never stations and was wondering about one possibility.

Is it possible for a tram station to sense what is on the surrounding tiles and choose the graphic accordingly?

I have an idea to base metro network on trams and tunnels such that tunnel entrances are not visible in the game when station is next to the tunnel entrance.

This would allow to hide metro stations on public squares or even between the houses without extra tiles.
Tram Metro.png
Tram Metro.png (54.91 KiB) Viewed 4881 times
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Re: Surrounding aware tram stations

Post by OzTrans »

luxtram wrote: 12 Aug 2024 12:38 ... Is it possible for a tram station to sense what is on the surrounding tiles and choose the graphic accordingly?
Yes, it is possible. However, you can only query the tile class of other features and no other details; act2 var 0x67 will let you check for nearby tunnel entrances.

Sample metro station ...

Metro Station A.png
Metro Station A.png (239.17 KiB) Viewed 4845 times
Metro Station B.png
Metro Station B.png (215.99 KiB) Viewed 4845 times
luxtram
Route Supervisor
Route Supervisor
Posts: 417
Joined: 10 May 2016 19:09

Re: Surranding aware tram stations

Post by luxtram »

OzTrans wrote: 13 Aug 2024 00:32
luxtram wrote: 12 Aug 2024 12:38 ... Is it possible for a tram station to sense what is on the surrounding tiles and choose the graphic accordingly?
Yes, it is possible. However, you can only query the tile class of other features and no other details; act2 var 0x67 will let you check for nearby tunnel entrances.

Sample metro station ...
Thank you!

Is this some dynamic thing that shows different tiles when there is a train?
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Re: Surranding aware tram stations

Post by OzTrans »

luxtram wrote: 15 Aug 2024 14:18 Is this some dynamic thing that shows different tiles when there is a train?
No it is not. The first image shows the station normally [all metro train activity is hidden]. The second image shows the station in transparency mode; i.e. it reveals the metro station, but all other station furniture is not shown. This station is just a prototype and not quite finished yet. I have plans to add a glass roof for the below ground version, that would then make train activity visible; as well as make a version on level ground and elevated.
ebla71
Route Supervisor
Route Supervisor
Posts: 485
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Surranding aware tram stations

Post by ebla71 »

OzTrans wrote: 15 Aug 2024 23:41 No it is not. The first image shows the station normally [all metro train activity is hidden]. The second image shows the station in transparency mode; i.e. it reveals the metro station, but all other station furniture is not shown. This station is just a prototype and not quite finished yet. I have plans to add a glass roof for the below ground version, that would then make train activity visible; as well as make a version on level ground and elevated.
Interesting - but the metro is based on "tram tracks" not "real railway", as there are two metro trains on a single tile with two tracks, right?!?

Also, the metro is at level -1 relative to adjacent terrain, right? How did you solve the problem with the sloped tiles next to the track then?!?

There are some decorative sets with overlaps but they do not work as nicely as in your example ...
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Re: Surrounding aware tram stations

Post by OzTrans »

ebla71 wrote: 15 Aug 2024 23:59 Interesting - but the metro is based on "tram tracks" not "real railway", as there are two metro trains on a single tile with two tracks, right?!?
Correct, this is a tram type implementation, done with roadstops. Requires less space in a packed city. May be, one day, I'll do a Rail Station one too. With rail stations, you need to deal with signalling too.
Also, the metro is at level -1 relative to adjacent terrain, right? How did you solve the problem with the sloped tiles next to the track then?!?
The slopes [also called embankment] are covered with simple non-track roadstop tiles; the tile in front of the tunnel entrances are roadstop waypoints [the one with the little building]; easier that way, because the tile above of the tunnel entrances is overlapping; a tricky bit on the southern end.

Coding of complex Roadstops is particularly difficult, as there is a lack of variables; especially those corresponding rail type ones, like 0x40/41/46/47.
There are some decorative sets with overlaps but they do not work as nicely as in your example ...
Thank you; I don't really like overlapping graphics myself, I try to avoid them if at all possible; it can cause a lot of glitches.
ebla71
Route Supervisor
Route Supervisor
Posts: 485
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Surrounding aware tram stations

Post by ebla71 »

OzTrans wrote: 16 Aug 2024 00:49 The slopes [also called embankment] are covered with simple non-track roadstop tiles; the tile in front of the tunnel entrances are roadstop waypoints [the one with the little building]; easier that way, because the tile above of the tunnel entrances is overlapping; a tricky bit on the southern end.
There are some decorative sets with overlaps but they do not work as nicely as in your example ...
Thank you; I don't really like overlapping graphics myself, I try to avoid them if at all possible; it can cause a lot of glitches.
But still the road stops creatively used to cover the tunnel entrances feature some kind of overlap, right?

Does that only work left/right (north/south) or also top/bottom (east/west)?!? Which means you will need four roadstops to cover all possible tunnel orientations, right?

And another question: Why did you opt to cover the slopes with non-track roadstop tiles, not decorative/landscaping tiles - to avoid mixing stop/station and other objects in a single NewGRF?!?
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Re: Surrounding aware tram stations

Post by OzTrans »

ebla71 wrote: 16 Aug 2024 01:33 But still the road stops creatively used to cover the tunnel entrances feature some kind of overlap, right?

Does that only work left/right (north/south) or also top/bottom (east/west)?!? Which means you will need four road-stops to cover all possible tunnel orientations, right?
Yes, there is an overlap of the tunnel entrance tile. To cover all 4 tunnels, I only use 2 road-stop IDs, one for the track in front of the tunnel and one for the side tiles to cover the slopes. In all there are 5 tiles for each tunnel, but only using 2 IDs.

See below : the image shows just the tunnel overlap tile for all possible directions. The player only needs to get the direction right. If the tile is placed in the wrong direction, or there is no tunnel, the tile will show a red-cross instead of the overlap. All done with one single road-stop ID.

Metro Tunnel A.png
Metro Tunnel A.png (20.81 KiB) Viewed 4572 times
Next : this image below shows on the right side, the slopes on either side of the tunnel being covered. On left side, the slopes on either side of tunnel overlap tile covered too. Once, you have that 2x3 covereage, station furniture will appear. Again, all the covering is done with a single road-stop ID.

Metro Tunnel B.png
Metro Tunnel B.png (20.06 KiB) Viewed 4572 times
Why does this all work ? It is all in the magic of coding.
And another question: Why did you opt to cover the slopes with non-track road-stop tiles, not decorative/landscaping tiles - to avoid mixing stop/station and other objects in a single NewGRF?!?
You can cover side slopes with anything; bus- tram-stops, rail stations, roads, tram tracks, landscape or any flat object tile. I prefer to keep things on the same menu, therefore the entire station complex can be built with road-stop tiles in the same tram construction menu. Players may be free to use any other suitable decorative/landscaping tile, including nothing [slopes may be built over by the city with houses then, provided there is a road nearby].

There are no issues with having multiple features in the one GRF. I could have done covering side slopes with objects, but why forcing players to switch construction menus, if that is not necessary. Using non-track road-stop tiles expands station catchment area too. Side slopes can also be covered with a bus/tram stop, after all a metro station is usually a transit hub, where bus/tram services drop off passengers to take the metro.
ebla71
Route Supervisor
Route Supervisor
Posts: 485
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Surrounding aware tram stations

Post by ebla71 »

OzTrans wrote: 17 Aug 2024 00:27 Yes, there is an overlap of the tunnel entrance tile. To cover all 4 tunnels, I only use 2 road-stop IDs, one for the track in front of the tunnel and one for the side tiles to cover the slopes. In all there are 5 tiles for each tunnel, but only using 2 IDs.
Thanks for the explanation - indeed very clever, I draw my hat to you.

Agree on keeping things together in one menue, was just asking for the rationale behind it (technical vs. ease of use)

Would be lovely to have that for "normal" rail also.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Re: Surrounding aware tram stations

Post by OzTrans »

ebla71 wrote: 17 Aug 2024 04:31 Would be lovely to have that for "normal" rail also.
I have plans to do that, when I refurbish 'Gare centrale de Montréal'. Gare Centrale is an underground terminus railway station, but a couple of platforms will continue through 'Tunnel du mont Royal' in a north-westerly direction and used by REM [Réseau express métropolitain] services. REM is the Rapid transit system in the Greater Montréal area and all in stadard gauge.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 2 guests