NotRoadTypes

Contents

Road- and Tramtypes

Introduction

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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.

/File/en/Archive/Development/Nrt defaulttypes.png

Compatibility/Poweredness

/File/en/Outdated content.png
Out of Date
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:

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.

/File/en/Archive/Development/Nrt example1 dot.png

(the image does not include the transitive relations)

Example 2

5 tramtypes:

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

/File/en/Archive/Development/Nrt example2 dot.png

(the image does not include the transitive relations)

Sprite layers

/File/en/Outdated content.png
Out of Date
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:

Regular tiles

/File/en/Outdated content.png
Out of Date
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 Composition
Foundation baseset X X X (1) /File/en/Archive/Development/Nrt layers.png
Grass or paved sidewalks baseset X X X (2)
Underlay from Roadtype Roadtype X X

Underlay from Tramtype Tramtype

- X (3)
Overlay from Roadtype Roadtype X X

Overlay from Tramtype Tramtype

X X (4)
Oneway signs baseset X X

Roadworks baseset X X X

Road catenary, back Roadtype X X

Tram catenary, back Tramtype

X X (5)
Roadside (lamps, trees), back baseset X X X (6)
Vehicles

X X X

Roadside (lamps, trees), front baseset X X X (7)
Road catenary, front Roadtype X X

Tram catenary, front Tramtype

X X (8)

Level crossing

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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-/tramtype of vehicle:

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

/File/en/Outdated content.png
Out of Date
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.
Current road-/tramtype under vehicle:

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

/File/en/Outdated content.png
Out of Date
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.
Feature:

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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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

/File/en/Outdated content.png
Out of Date
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 Action3 Id NML Required Notes Action 5 equivalent
0x00 gui optional 12 sprites (6 gui icons, 6 cursors) /File/en/Archive/Development/Nrt gui.png 0-1, 4 new, 2-3, 4 new
0x01 track_overlay optional for road, required for tram 19 sprites (11 roadbit combinations, 4 slopes, 4 dead ends) /File/en/Archive/Development/Nrt overlay.png 4-22
0x02 underlay required 19 sprites (11 roadbit combinations, 4 slopes, 4 dead ends) /File/en/Archive/Development/Nrt underlay.png 27-45
0x04 catenary_front optional 29 sprites (11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps) /File/en/Archive/Development/Nrt catenary front.png 56-62, 64-67, 72-75, 4 new, 80-83, 97-98, 103-106
0x05 catenary_back optional 29 sprites (11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps) /File/en/Archive/Development/Nrt catenary back.png 84-94, 68-71, 4 new, 4 new, 95-96, 99-102
0x06 bridge_surfaces required 6 sprites (2 bridge middle, 4 bridge ramps) /File/en/Archive/Development/Nrt bridge.png 107-112
0x08 depots optional 6 sprites /File/en/Archive/Development/Nrt depot.png
If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.
If present, the depot sprites are expected to include track overlay graphics.
49-54 or 113-118
0x0A drive-in stops require for road, invalid for tram 4 sprites (overlays for drive-in road stops) /File/en/Archive/Development/Nrt drivein.png new

ToDo list

Which roadtypes are build and used by towns?

Current status:

Future:

Disallow construction for drive-in stops

Current status:

Future:

Roadsides / fences

Current status:

Future:

Draw underlay for both road and tram

Current status:

Future:

Problem:

Related:

Independent movement for road vehicle and trams

Current status:

Future:

Non-constructible rail-/road-/tramtypes to model vehicle compatibility/poweredness

Current status:

Future:

Foundations

Current status:

Future:

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:

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.

More information for the overlay graphics

Pass information about the tile context in var10, in particular for the overlay sprites: