Its often been suggested to add more railtypes to OpenTTD, so I mulled it over and have come up with this full semi-technical proposal. In short I suggest the addition of narrow gauge, electric third rail standard gauge and vacuum tube maglev, and possibly atmospheric/pneumatic standard gauge and tracked hovercraft/hovertrain. Track type of vehicles would be defined by newGRF, using action0 property 19, and compatibility with TTDpatch would be well maintained. Track graphics would be modified using a similar framework to the overhead electric catenary, so all bridge and road replacement newGRFs would be supported without requiring any additional graphics.
Action0 Property 19
Currently this byte value defines track type via the traction type of the vehicle, the following values are used:
Code: Select all
Values Traction type Track type Visual effect Power supply type
00..07 Steam Standard gauge Steam None
08..27 Diesel Standard gauge Diesel smoke None
28..31 Electric Standard gauge Sparks Overhead electric catenary
32..37 Monorail Monorail None None
38..41 Maglev Maglev None None
Code: Select all
Values Track type Visual effect Power supply type
00..05 Standard gauge Steam None
06 Standard gauge None Pneumatic
07 Narrow gauge Steam None
08..26 Standard gauge Diesel smoke None
27 Narrow gauge Diesel smoke None
28..30 Standard gauge Sparks Overhead electric catenary
31 Standard gauge Sparks Electric third rail
32..36 Monorail None None
37 Hoverrail None None
38..40 Maglev None None
41 Maglev None Vacuum tube
standard gauge atmospheric/pneumatic would act as standard gauge steam (same era)
Narrow gauge steam would act as standard gauge steam (both steam)
Narrow gauge deisel would act as standard gauge deisel (both deisel)
Standard gauge electric third rail would act as standard gauge overhead electric caternary (both electric)
Hoverrail would act as monorail (both single rail tracks)
Vacuum maglev would act as maglev (both maglev)
Interpretation of old newGRFs (which do not take into account these new rail types) may be affected, although most newGRF coders tend to use the lower limit of each range, which is not changed in this scheme, and any incompatible newGRFs could be easily updated. No change is required to the newGRF specifications (this simply redefines the interpretation of specific values) or TTDpatch (TTDpatch would correctly read, and relitavely correctly display, the newGRF).
Rail Graphics
New rail graphics would, where possible, use a similar display scheme as the overhead electric catenary. Re-ordering of the sprite z-stack would be required for use of this method on the electric third rail, narrow gauge, pneumatic narrow gauge and hoverrail tracks. Vacuum maglev would require no such modification. The quality of this method on total track replacement (narrow gauge and hoverrail) would be moderate at best (see attachment) and may require further improvement to reach release quality.
Use of this method would make the new railtypes fully compatible with any road, bridge or tunnel newGRF set as the modified rail graphics would be overlaied onto the new infrastructure graphics.
Attached are three demonstration GRFs (NOT newGRFs) for narrow gauge (elrailswNrw.grf), electric third rail (elrailsw3rd.grf) and vacuum tube maglev (elrailswVac.grf). To use first make a backup copy of the existing elrailsw.grf in /data. Next rename one of the attached files to elrailsw.grf and run OpenTTD as normal. An error message will inform you that elrailsw.grf may be missing or corrupt - ignore this and proceed as normal. OpenTTD will now display the modified electric railway catenary graphics.
Narrow gauge and electric third rail demonstrate the current sprite z-stack problem (trains travel under the graphics). The vacuum tube works correctly (minus slope and tunnel entrance sprites which I have not drawn) but on standard gauge rail instead of maglev. The attached image illustrates the appearance of these new track types.
Coding
I am under the impression that when electric rail was added the code was revamped to allow easy addition of new railtypes. Unfortunately I am no coder!