#+TITLE: OpenTTD Self Regulating Networks
#+DATE: 2024-01-12
[[file:openttd-srnw/srnw_head.png]]
* Prologue
Every other year or so I decide to play a game or ten of
[[https://openttd.org/][OpenTTD]]. Unfortunately I don't remember most of the things I figured
out in the past so I have to start from first principles.
In this case, first principles means reading the [[https://wiki.openttdcoop.org/Main_Page][openttdcoop Wiki]]
[fn::which is quite dense] and watching a bunch of [[https://www.youtube.com/@LugnutsK][LugnutsK]] videos.

* Self Regulating Passenger Network
The idea of a self regulating passenger network is to grow a city and
transport as many passengers out of the city as possible with the
least amount of train orders.

openttdcoop calls it [[http://wiki.openttdcoop.org/Gametype:ICE_SBahn][Gametype:ICE SBahn]] / [[http://wiki.openttdcoop.org/Self-regulating_SBahn][Self-regulating SBahn]].

The idea is to have (SBahn) stations spread throughout the city that
collect passengers. Once a train is fully loaded with passengers, it
drives outside of the city to a transfer (ICE) station and transfers
passengers to a waiting train that then transports the passengers to a
far away city to make money.

We do not want to deal with each station individually but run the
pick-up trains in a loop that automatically visits a station with
a full load of passengers available.

To make all of this work we have:
1. Inner-city SBahn stations
2. Outside-city waiting loop for the pick-up trains
3. Outside-city exit track to the transfer / ICE station
4. Outside-city transfer / ICE station
5. Injection mechanism from the ICE station to the waiting loop.

[[file:openttd-srnw/overview.png][file:openttd-srnw/overview_small.png]]

The pick-up trains have two orders:
1. Go to transfer / ICE station and transfer passengers.
2. Go to inject way-point.

The inject way-point leads to the waiting loop. From there the only
way to reach the transfer station is through any of the SBahn
stations. We have to arrange the SBahn stations in a way that they are
only accessible when there is a full load of passengers available.

* City Layout
For maximum growth and ease of putting train stations into the city we
are using a 3x3 road grid. A spiral would be even better for city
growth but it is annoying to put train stations into a spiral without
disrupting the roads too much and creating dead-ends. Dead-ends are
very bad for town growth.

We need to find a balance between station size[fn:One constraint here
is how much the station takes away from the city to build houses.],
city coverage, and needed capacity at the transfer station. Using spread
stations covering a 5x5 block[fn: A block is a 3x3 road grid.] and
having six of those works fairly well. To be able to fit tunnels in we
put two in a line and have three lines. Three in a line would also
leave enough space for tunnels. This results in a city grid of 13x8
blocks.

[[file:openttd-srnw/city-layout.png][file:openttd-srnw/city-layout_small.png]]

