OpenTTD Development Documentation
External Links

OpenTTD GitHub
Contributing to OpenTTD - guidelines
OpenTTD Doxygen

General Reference

Coding style
Compiling OpenTTD
Add a setting
Add a squirrel function
Understanding the SaveGame handler
Bumping the savegame version
Doing an OpenTTD release

Language and Strings

Manual of style
Format of langfiles
Using OpenTTD strings
List of special strings

Window System

Using the window system
Colour codes that exist in OpenTTD
Adding a text box
Understanding the widget focus system
GUI style guide


The OpenTTD TCP protocol
The OpenTTD UDP protocol
Debugging desyncs
Server Admin Port development

Ingame Console

The console window
Console commands
Console variables
Using console scripting
Adding functions/commands to the console
Adding variables to the console
Console development history

Content APIs (modding frameworks)

Graphics and similar (NewGRF)
AI framework (NoAI)
GameScript framework (NoGO)
Social Integration

Other Reference

Map array (landscape grid)
Train acceleration
Sound IDs

A vehicle is one of the fundamental entities in the game.


There are 6 recognised vehicle types in the VehicleType enum:


The Vehicle struct has many variables and methods. Some of the important ones are:

VehicleTypeByte type The vehicle type
PlayerByte owner owner of the vehicle
TileIndex tile
int32 x_pos
int32 y_pos
byte z_pos
Its current location
x_pos and y_pos are world coordinates in 1/16th of a tile.
byte spritenum
uint16 cur_image
byte sprite_width
byte sprite_height
Sprite infomation
TextEffectID fill_percent_te_id a text-effect id to a loading indicator object
uint16 max_speed
byte subspeed
Speed of the train
byte acceleration
uint16 max_speed
Acceleration and max speed
byte vehstatus Status
CargoID cargo_type
uint16 cargo_cap
Type and amount of cargo
Order *orders Linked list of orders
Entering and leaving a station

There are many more methods and variables than this. For more info, see vehicle_base.h and vehicle.cpp. Vehicles are all subclassed, so there are other more specific methods and variables for trains, etc.