Road- and Tramtypes
Introduction
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Road and tram are constructed independently. You can build road with a certain roadtype on a tile, and you can build tram with a certain tramtype on a tile. In general there are no implications between the two infrastructures, just like there are no implications to railtypes on levelcrossings, though rail-, road- and tramtypes can forbid levelcrossings.
Each tile may have one roadtype and one tramtype.
Roadtype and Tramtype labels
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Roadtypes and tramtypes are identified via 4-character labels between NewGRFs. Labels of the different entities are independent. You can have roadtype "OTTD", tramtype "OTTD", railtype "OTTD", cargotype "OTTD", ... independently of each other, in the same game or in the same NewGRF.
By default OpenTTD knows these labels, and provides graphics for them:
Label | Roadtype |
---|---|
ROAD | Normal road |
ELRD | Electrified road |
Label | Tramtype |
---|---|
RAIL | Tramway |
ELRL | Electrified tramway |
Tramtypes use labels very close to railtype labels.
Note, that catenary is not specific to tramtypes. Trolley busses are not trams.
Compatibility/Poweredness
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
This works the same as for railtypes. Vehicles have a specific road-/tramtype label.
The road-/tramtypes specify, which other tracktypes their vehicles can drive on.
Both road and tram may have catenary, but the catenaries exist independent of each other. A tile can show catenary, but still have "electrified road" and "not-electrified tram".
Example 1
4 roadtypes:
- ROAD: Normal road
- ELRD: Electrified road
- OFFR: Off-road / dirt-road
- HAUL: Heavy hauling road
Compatibility:
Roadtype/vehicletype | Powered roadtypes |
---|---|
ROAD | ROAD, ELRD |
ELRD | ELRD |
OFFR | OFFR, ROAD, ELRD, HAUL |
HAUL | HAUL |
Note: Technically the specs do not enforce any "transitivity" for the compatibility. That means, if A can drive on B and B can drive on C, A does not necessarily drive on C.
(the image does not include the transitive relations)
Example 2
5 tramtypes:
- RAIL: Normal rail
- ELRL: Rail with catenary
- 3RDR: Rail with 3rd rail
- 3RDC: Rail with both catenary and 3rd rail
- 3ORC: Vehicles which can switch between catenary or 3rd rail power supply.
The last type "3ORC" is technically no build-able tracktype, just a vehicle type. (This is currently not implemented) There are no vehicles which require both 3rd rail and catenary.
Tramtype/vehicletype | Powered tramtypes |
---|---|
RAIL | RAIL, ELRL, 3RDR, 3RDC, 3ORC |
ELRL | ELRL, 3RDC |
3RDR | 3RDR, 3RDC |
3RDC | 3RDC |
3ORC | ELRL, 3RDR, 3RDC |
(the image does not include the transitive relations)
Sprite layers
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
When drawing road/tram tiles, multiple sprites are drawn in layers over each other.
General rules:
- Pavement and roadsides (lamps, trees) are not part of any road- or tramtype. They are provided by the baseset only.
- There is only one underlay, either from road or from tram. Road takes precedence.
- Overlays are always drawn. (this is different to railtypes)
- Both road and tram can draw catenary. Catenary sprites support company colour (1CC). If company is NONE, grey will be used for company colour.
Regular tiles
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Level crossing
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Layer | Source | Road only | Road and Tram | Tram only |
---|---|---|---|---|
Foundation | baseset | X | X | X |
Grass or paved sidewalks | baseset | X | X | X |
Underlay from Roadtype | Roadtype | X | X | |
Underlay from Tramtype | Tramtype | - | X | |
Overlay from Roadtype | Roadtype | X | X | |
Overlay from Tramtype | Tramtype | X | X | |
Overlay from Roadtype | Roadtype | X | X | |
Overlay from Tramtype | Tramtype | X | X | |
Rail overlay | RailType | X | X | X |
Road catenary, back | Roadtype | X | X | |
Tram catenary, back | Tramtype | X | X | |
Rail catenary, back | RailType | X | X | X |
Crossing bars, back | RailType | X | X | X |
Vehicles | X | X | X | |
Crossing bars, front | RailType | X | X | X |
Rail catenary, front | RailType | X | X | X |
Road catenary, front | Roadtype | X | X | |
Tram catenary, front | Tramtype | X | X |
Road depot
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Layer | Source | Road only | Road and Tram | Tram only |
---|---|---|---|---|
Foundation | baseset | X | X | |
Depot, back | Road/Tramtype | X | X | |
Road/Tram overlay (if default depot gfx) | Road/Tramtype | X | X | |
Depot, front | Road/Tramtype | X | X |
Drive-in road stop
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Layer | Source | Road only | Road and Tram | Tram only |
---|---|---|---|---|
Foundation | baseset | X | ||
Station, back | baseset | X | ||
Road overlay | Roadtype | X | ||
Road catenary, back | Roadtype | X | ||
Vehicles | X | |||
Station, front | baseset | X | ||
Road catenary, front | Roadtype | X |
Note: The roadtypes do not provide sprites for the buildings.
Drive-through road-stop
... similar to regular tiles, no additional sprites needed ...
Note: The roadtypes do not provide sprites for the buildings.
Bridge, Head
... similar to regular tiles ...
Note: The roadtypes do not provide sprites for the actual bridge.
Bridge, Middle
... similar to regular tiles ...
Note: The roadtypes do not provide sprites for the actual bridge.
Tunnel
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
... similar to regular tiles ...
Note: The roadtypes do not provide sprites for actual tunnel portal.
NewGRF format
Global stuff
Road-/Tramtype translation table
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO
Action 0 Feature 8 Properties 0x16 (roadtypes) and 0x17 (tramtypes) work the same as 0x12 for railtypes
NML
"roadtypetable" and "tramtypetable" work the same as "railtypetable"
Testing for road-/tramtypes
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO
Action 7 tests 0x0F (roadtype not defined), 0x10 (roadtype defined), 0x11 (tramtype not defined), 0x12 (tramtype defined) work the same as 0x0D and 0x0E for railtypes.
NML
"roadtype_available" and "tramtype_available" work the same as "railtype_available"
Action 5 tram graphics
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
Type 0B is extended to now provide 119 sprites (6 more than before).
Originally sprites 49..54 provided graphics for the electrified tram depot, which include the tram tracks.
The new sprites 113..118 provide graphics for electrified depots, which do not include tracks. These sprites are used for all electrified road and tram depots, where the road-/tramtype does not supply custom depot sprites. The regular road-/tramtype overlay sprite is drawn over the ground sprite of the depot to provide track graphics.
The old sprites 49..54 are only used for compatibility, if no new sprites 113..118 are provided.
Vehicle stuff
Properties
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO
Property 0x05 (byte) specifies the entry from the road-/tramtype translation table.
NML
"road_type", "tram_type" specifies the entry from the road-/tramtype translation table. ROADVEH_FLAG_TRAM must be set/cleared nevertheless.
If the property is not set, then road vehicles default to "ROAD" and trams default to "ELRL".
Variables
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO
Var 0x4A works the same as for trains. Bit 8 "is/would be powered" is always set.
NML
"current_roadtype" and "current_tramtype" work the same as "current_railtype".
Road-/Tramtype
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO
0x12 for roadtypes, 0x13 for tramtypes
NML
FEAT_ROADTYPES, FEAT_TRAMTYPES
There is no "parent" scope.
There is a global limit of 15 roadtypes and 15 tramtypes, including the default types.
Properties
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO | NML | Notes |
---|---|---|
0x08 (dword) | label | |
0x09 (word) | toolbar_caption | |
0x0A (word) | menu_text | |
0x0B (word) | build_window_caption | |
0x0C (word) | autoreplace_text | |
0x0D (word) | new_engine_text | |
0x0F (*) | powered_roadtype_list, powered_tramtype_list | there is no difference between "powered" and "compatible" for road-/tramtypes |
0x10 (byte) | roadtype_flags, tramtype_flags |
0x01 = ROADTYPE_FLAG_CATENARY = TRAMTYPE_FLAG_CATENARY 0x02 = ROADTYPE_FLAG_NO_LEVEL_CROSSING = TRAMTYPE_FLAG_NO_LEVEL_CROSSING |
0x13 (word) | construction_cost | Defaults: ROAD = 8, ELRD = 16, RAIL = 8, ELRL = 16 |
0x14 (word) | speed_limit | Unit is the same as for road vehicles. 0x100 = 128 km-ish/h = 80 mph |
0x16 (byte) | map_colour | Defaults: 0x01 for all |
0x17 (dword) | introduction_date | |
0x18 (*) | requires_roadtype_list, requires_tramtype_list | |
0x19 (*) | introduces_roadtype_list, introduces_tramtype_list | |
0x1A (byte) | sort_order | Defaults: ROAD = 0x07, ELRD = 0x17, RAIL = 0x07, ELRL = 0x17 |
0x1B (word) | name | |
0x1C (word) | maintenance_cost | Defaults: ROAD = 16, ELRD = 24, RAIL = 16, ELRL = 24 |
0x1D (*) | alternative_roadtype_list, alternative_tramtype_list |
Variables
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
NFO | NML | Notes |
---|---|---|
0x40 (byte) | terrain_type | |
0x42 (byte) | level_crossing_status | Level crossing sprites are provided by RailType only though. |
0x43 (dword) | build_date | Only available for road/tram depots. |
0x44 (byte) | town_zone | Currently not available for bridges and stations. |
0x5F (*) | random_bits | 2 pseudo random bits |
Graphics
This article or section is outdated. Some of its content may no longer be accurate due to changes in the latest release. Please update this article.
This spec is from May 2017. The actual implementation in OpenTTD 1.10 differs to an extent unknown.
ToDo list
Which roadtypes are build and used by towns?
Current status:
- Towns only build ROAD. Houses grow along all road- and tramtypes.
- Flag to enable houses along some road- or tramtypes. Disabled for default tramtypes.
Future:
- Flag to enable construction by towns. Which type do towns choose? The newest? What is the newest? How/when do they upgrade?
Disallow construction for drive-in stops
Current status:
- Roadtypes have drive-in stops, tramtypes do not.
Future:
- Flag to disable drive-in stops for roadtypes. Tramtypes remain always disabled.
Roadsides / fences
Current status:
- The default roadsides are always drawn
Future:
- Flag to enable default pavement.
- Flag to enable default roadsides (lamps, trees).
- Optional sprites for rail-style "fences" (highway barriers, trees, ...)
Draw underlay for both road and tram
Current status:
- When there is both road and tram on a tile, and tram has some trackbits which road doesn't, then it currently looks like this.
Future:
-
Instead tram-underlay should also be drawn. The total order would be
- Grass ground
- Tram underlay
- Road underlay (drawn after tram, so it "takes precedence".)
- Road overlay
- Tram overlay
Problem:
- The default roads do not provide road overlays. So this would need new Action5 sprites, and is not completely compatible with existing landscape and infrastructure NewGRFs and basesets.
Related:
- The same applies to rail level crossings when using default railtypes. However, with NewRailTypes this is already better.
-
This can also be extended for smooth road-type transitions on junctions:
- If a roadtile connects to two tarmac road tiles and one dirt road tile, then it should draw the dirt underlay to the dirt tile and the tarmac underlay over it.
- Something similar is already done for catenary continuation.
Independent movement for road vehicle and trams
Current status:
- Road vehicles and trams occupy the same space and block eachother's movement.
Future:
-
Flag to enable trams to move independent of present road vehicles. (for example: suspension railway)
- Vehicles clip through each other.
- Track sprites would need drawing like catenary.
- Next step "regular tram under suspension rail" fails.
Non-constructible rail-/road-/tramtypes to model vehicle compatibility/poweredness
Current status:
- Vehicles can only use defined tracktypes. Tracktypes are buildable, if a vehicle exists for them.
Future:
- Distinguish "track and vehicle type" and "vehicle-only type".
- "Vehicle-only types" are used by vehicles and reference other types for compatibility, but are not buildable themself.
- "Vehicle-only types" should not count towards the "maximum 15 types" limit.
- "Vehicle-only types" are visible in dropdowns that filter vehicles, like in the autoreplace GUI.
- See also Example 2 above, and #5006.
Foundations
Current status:
- Road, tram and rail use the regular foundation sprites.
Future:
- Optional sprites for railtypes, roadtypes and tramtypes. (precedence in this order)
Variable to test presence of road/tram
To draw different graphics depending on whether there is another road/tramtype present on the tile, add a new variable:
-
Var 0x45, bit 0..7 "current_roadtype"
- 00 - FD: Entry from road translation table.
- FE: Road present, but not in translation table.
- FF: No road present
-
Var 0x45, bit 8..15 "current_tramtype"
- 00 - FD: Entry from tram translation table.
- FE: Tram present, but not in translation table.
- FF: No tram present
TODO Other useful info, maybe rather 16bits per road/tram?
Vehicle variable to test "poweredness" for certain road/tram/railtype
This is to allow powered vehicles to check for track types with even-better power supply.
-
Vehicle var 0x63. Parameter is road/tram/railtype to check for. Result is
- 0 not compatible
- 1 compatible (only for trains)
- 2 compatible and powered
- 0xFF unknown tracktype
More information for the overlay graphics
Pass information about the tile context in var10, in particular for the overlay sprites:
- Regular tile
- Level crossing
- Drive-through stop
- Road depot
- Bridge head
- Bridge middle
- Tunnel entry
- ...