TCP
OpenTTD Development Documentation
External Links

OpenTTD GitHub
Contributing to OpenTTD - guidelines
OpenTTD Doxygen

General Reference

Coding style
Compiling OpenTTD
Debugging
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

Multiplayer

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)
Vehicles
Pathfinding
Train acceleration
Sound IDs

Contents

Open TTD Network Protocol - TCP

Packet List

The packet list is ordered is the same way than in the enum definition located in network/core/tcp_game.h

Packet Name Sent By Function
PACKET_SERVER_FULL Server The network game has no more client left
PACKET_SERVER_BANNED Server Client IP appears in the openttd.cfg ban list
PACKET_CLIENT_JOIN Client Client is requesting to join the game
PACKET_SERVER_ERROR Server Inform that the client made an error
PACKET_CLIENT_COMPANY_INFO Client Client is requesting companies information
PACKET_SERVER_COMPANY_INFO Server Server Sends info about the companies
PACKET_SERVER_CLIENT_INFO Server Server Sends info about a client
PACKET_SERVER_NEED_PASSWORD Server Server is requesting a password from the Client
PACKET_CLIENT_PASSWORD Client Client is sending a password
PACKET_SERVER_WELCOME Server The client is joined and ready to receive his map
PACKET_CLIENT_GETMAP Client Client is requesting a map download
PACKET_SERVER_WAIT Server Server has something else to do, please wait
PACKET_SERVER_MAP Server Server is sending Map information
PACKET_CLIENT_MAP_OK Client Client has received the map
PACKET_SERVER_JOIN Server

PACKET_SERVER_FRAME Server Sends the current frame-counter to the client
PACKET_SERVER_SYNC Server Sends a sync-check to the client
PACKET_CLIENT_ACK Client

PACKET_CLIENT_COMMAND Client Client is sending a DoCommand to the Server
PACKET_SERVER_COMMAND Server Server is sending a DoCommand to the Client
PACKET_CLIENT_CHAT Client Client is sending Chat information
PACKET_SERVER_CHAT Server Server Sends a chat-packet to the client
PACKET_CLIENT_SET_PASSWORD Client Client is requesting a password change
PACKET_CLIENT_SET_NAME Client Client is requesting a name change
PACKET_CLIENT_QUIT Client Client quits the game
PACKET_CLIENT_ERROR Client

PACKET_SERVER_QUIT Server Server Informs connected clients that a client has left the game
PACKET_SERVER_ERROR_QUIT Server Server informs that a client made an error and is leaving the game
PACKET_SERVER_SHUTDOWN Server

PACKET_SERVER_NEWGAME Server

PACKET_SERVER_RCON Server Server sends remote console command results
PACKET_CLIENT_RCON Client Client sends a command to the console
PACKET_SERVER_CHECK_NEWGRFS Server Sends info about the used GRFs to the client
PACKET_CLIENT_NEWGRFS_CHECKED Client

PACKET_SERVER_MOVE Server

PACKET_CLIENT_MOVE Client

PACKET_SERVER_COMPANY_UPDATE Server This packet informs client what companies are passworded
PACKET_SERVER_CONFIG_UPDATE Server

PACKET_END None This packet is the last one in the enum

Packet Format

Packets Sent by Server

Client Packets

Enumerate company information

This step is used by GUI in order to enumerate company information before connection to the server

Client Server
PACKET_CLIENT_COMPANY_INFO  
  PACKET_SERVER_COMPANY_INFO

Connecting to a server

This is a simple example of what is sent between client and server when joining a game.

Client Server
PACKET_CLIENT_JOIN  
  PACKET_SERVER_CHECK_NEWGRFS
PACKET_CLIENT_NEWGRFS_CHECKED  
  PACKET_SERVER_WELCOME
PACKET_CLIENT_GETMAP  
  PACKET_SERVER_MAP (multiple)
PACKET_CLIENT_MAP_OK  
  PACKET_SERVER_FRAME
PACKET_CLIENT_ACK  
  PACKET_SERVER_SYNC
  PACKET_SERVER_CLIENT_INFO
  PACKET_SERVER_JOIN
  PACKET_SERVER_CONFIG_UPDATE
  PACKET_SERVER_COMPANY_UPDATE

Maintain connection with the Server