I plan to write a patch improving timetable handling. This thread is
currently just for presenting my ideas for such a patch, lateron if
and when I write such a patch, I will make this the corresponding
development thread. Note that currently, no line of code is written
for this. So, I present these ideas now to get feedback on them.
My aim when using timetables is building up a network of trains, that
meet at defined times at defined stations or other places. Simple
example: I have a one-track-line with a station in the middle, and in
this station every 60 days two trains from different directions should
meet.
With the current timetable handling, building up this is possible, but
has in my opinion several disadvantages:
- Orders are given in a relative manner, not in an absolute. There
is a patch for a departure board that helps a lot, but if I know, at
time X something should happen, I can´t just write X into the orders,
but have to calculate somewhere outside the game starting at some
base time Y. - Thus, synchronizing a non-trivial number of vehicles IMHO only is
feasible by keeping book outside the game about their timetables. - Starting dates of timetables are recorded once and forgotten
afterwards. You can synchronize vehicles by giving different
timetables matching lengths (e.g. 30, 60, 120 days), but if you have
to change something in a timetable, and the timetable for a short
period of time has e.g. 116 instead of 120 days, vehicles quickly get
out of sync. - If you want to get an overview about the timetable of some railway
line, there is no simple way to do that in-game, you have to keep
track about this outside the game. Actually, OpenTTD has not even a
concept of a railway line.
- Set up vehicle timetables using absolute dates. E.g at 4th
September 1932, leave Station X. Relative dates can be used for
setting up a timetable conveniently (e.g. 6 days later enter Station
Y), but will be transformed into absolute dates. - Different vehicles sharing a timetable are connected using
offsets. I.e. the timetable exists once, and each vehicle stores a
offset relative to the start of this timetable. - Each timetable is explicitely assigned a length. Based on both
length of timetable and offsets, absolute times for vehicles (Vehicle
X should enter Y at time Z) are calculated. Periodically, the length
of the timetable is added to all absolute dates, to keep offsets
small. - Introduce a concept of (railway) lines. Why do I want to
introduce railway lines? My ultimate goal is supporting train graphs
(I hope the term is correct, in German I would say Bildfahrplan), and
for being able to support them I need an abstraction of railway
lines. - In terms of GUI,
displaying them can be switched on or off using a new transparency
option. If activated, they are painted as lines over map, giving the
player an abstraction of the actual railway lines for planning. If
deactivated, nothing at all is displayed for them. An appropriate GUI
is provided for managing them, plus a tab in the minimap for
displaying information about them. - Railway lines consist of nodes (stations or maybe coordinates on
map) and edges (between two nodes, having coordinate points for
displaying them). E.g. railway line 120 goes from node A via node B,
C, D to node E. - Timetables technically define arrivals and departures at nodes.
The idea of supporting arbitrary coordinates here is making
synchronizing things at junctions outside of stations simpler. A
timetable reads like Start at time X at node (read: station) A and go
via railway line 345 to node (read: station) B, arriving at time Y. - Note that I only talk about timetables, not about routing. I do
not intend to change routing in any way. Thus, if one don´t want to
deal with railway lines, one is not forced to do so. If the via
railway line 345 part in my above example is not filled because a
player doesn´t care about, this only affects the ability to display
data about timetables, not the ability to use timetables at all.
displaying data about timetables:
- Timetable of some particular vehicle
- Timetable at some particular station
- Train graph / Bildfahrplan of some particular railway line /
edge. - Either in the train graph or separately, displaying timetable data
for some particular edge in textual form. - As a tool for this, display data about railway lines on map using
a new transparency setting, in minimap, and in an appropriate GUI for
this.
state of not-yet-coded ideas (although I already had a look on what
data I would have to put into which data structure, and which new data
structures I would need - I could detail this probably quite fast).
When, and how much time I will have for this is to some degree an
open question (in particular, but not only, depending on some other
well-known-patch...). So, feel free to comment on it.