manual:subwaysim:map_construction:create_timetable
This is an old revision of the document!
Table of Contents
Create Timetables
Timetables define the AI service pattern on a map:
- which trains spawn (compositions)
- which route they drive (stops)
- on which platforms they stop
- when and how often services repeat
- how depot and dispatching logic supports the timetable traffic
Timetables are usually created in your map's Map.lua inside:
- `function <MapClass>:loadTimetables()`
This page explains the full timetable workflow using the TestMap example.
Related:
Prerequisites
Before creating timetables, ensure:
- stations are fully defined in `loadStations()`
- platform numbers / lengths / directions are final
- the map loads correctly without timetables first (recommended)
Timetables reference station objects, so stations must exist before you build schedules.
Timetables in Map.lua (Where they “live”)
A typical `loadTimetables()` builds:
- `self.timetables` — list of actual service entries (the ones that spawn trains)
- templates per line/direction (used for cloning)
- optional lookup tables (`self.templatesByLine`, `self.templatesByDirection`)
- depot spaces (`self.depots`)
- dispatching strategies (`self.dispatchingStrategies`)
At the end, the map registers them via:
controlCenter:setTimetableList(self.timetables, self.dispatchingStrategies, self.depots);
Step 1 — Create Templates (Per Line & Direction)
Templates describe the route and the allowed compositions, but do not spawn trains by themselves.
Example:
-- Direction 1 (TS -> TSA) self.TestLine_Dir1 = Timetable:new("U1", 0) :addTrainComposition("Berlin_HK_1x", 0.5) :addTrainComposition("Berlin_HK_2x") :addTrainComposition("Berlin_A3L92_1x", 0) :addTrainComposition("Berlin_A3L92_2x", 0) :addTrainComposition("Berlin_A3L92_3x", 0.5) :addTrainComposition("Berlin_A3L92_4x")
| Parameter | Description |
|---|---|
| `“U1”` | Line name used for UI and routing logic. |
| `0` | Variant / index value (map-specific usage). |
Step 2 — Add Stops (Route Definition)
Stops define the route as a sequence of station/platform/time entries.
:addStop({ station = self.stations.TS, platform = 2, departure = 0, speedLimit = 70, routeSettingMaxETA = 0.5, })
| Field | Type | Description |
|---|---|---|
| station | Station | Reference to a station defined in `loadStations()`. |
| platform | number | Platform number the train uses at this station. Must exist in BP_StationDefinition. |
| departure | number | Minutes after service start/spawn when the train departs this stop. |
| speedLimit | number | Speed limit applied after departing this stop (signal logic dependent). |
| routeSettingMaxETA | number (optional) | How many minutes before departure the route (Fahrstraße) should be requested/set. |
| altPlatform | table<string> (optional) | Alternative platforms that may be used if the primary platform is unavailable. |
Step 3 — Alternative Platforms (altPlatform)
Example:
<code
manual/subwaysim/map_construction/create_timetable.1769509140.txt.gz · Last modified: by dcs
