[Patch] Improved Timetable Management [V2.31tr SVN15778]
Posted: 28 Aug 2008 14:49
This large patch aims at providing improved timetable management. It has the following features:
1. Virtual Time
Have you ever been annoyed that timetables in the game are measured in days or even an artificial unit like ticks? Than this feature is for you. It introduces a second time-scale to the game, the virtual time measured in hours, minutes and seconds. You can configure the relation between virtual time and the traditional scale (which I will call calendar-scale for now) with patch setting between 1 virtual seconds per tick and 4 vsecs/tick yielding the following relationships:
You can enable display of the virtual time in the status bar by patch setting. The patch setting timetable_in_ticks was changed to timetable_unit and allows you to choose between days, ticks, HH:MM and HH:MM:SS. This setting works for both displaying and setting timetables.
Note: Virtual times are a GUI level concept, i.e. internally ticks or days are used and conversion between virtual time and calendar scale happens when displaying or setting data. This is why the virtual time settings are purely client-side settings. It is safe to use different virtual time settings on different clients in multiplayer.
2. Arrival, Departure and Expected Time
Have you ever seen a timetable in real world showing you how long the train drives / stops. Probably not. Usually they display arrival and departure times. And this is what this feature does: When the patch setting "show departure and arrival times in timetables" is enabled a new column is added to timetable windows showing the next scheduled arrival and departure times (actually it shows arrival and departure dates if you happen to set the timetable unit to days or ticks). When pushing the "Expected" button the expected times are shown instead, i.e. lateness/earliness is taken into account (earliness is not propagated past the next departure as the vehicle will just wait until it is on time again).
Note: Arrival and departure times are only shown for complete timetables without conditional orders and only for timetables that have already started (see the next section for an exception).
3. Setting Start Times
So, you want to create a tightly coupled headway system or just make sure that vehicles are equally separated? As a first building block you need to control the time/date the timetable is supposed to start. When a start date is set, the timetable is set to "not started", lateness is reset and when arriving at the first station lateness is initialized according to current time and intended starting time of the timetable. When a start time is set arrival/departure times are shown for orders before the current order even when the timetable is not started (this is the exception mentioned above).
This part is based on a patch by Maedhros.
4. Headway Management
To be rewritten for V2.00: Headway Management Window Details here.
To manage a whole line of vehicles more easily, this feature allows you to put vehicles with a shared timetable at a constant interval. The start time/date must be set for the current vehicle to be able to set an interval by clicking the "Headway" button. The interval is preset to the value leading to an equal separation between vehicles. This feature works by assigning start times of the requested interval to shared vehicles starting at the current vehicle and following the order the vehicles have on the track/road (so it should work for vehicles which are not able to overtake).
This part is based on a patch by MagicBuzz.
5. Station Timetables
This feature allows you to sort the vehicle lists accessible from station and waypoint windows by arrival and departure time (scheduled or expected) at this station/waypoint (vehicles with unknown times are put after those with known time and sorted by unit number). When you do so, arrival and departure times are shown below the vehicle instead of the profit. When pushing the "Expected" button, lateness/earlyness is taken into account.
A separate GUI for station timetables showing all types of vehicles in one window is now available. When you <CTRL>-click any of the vehicle icons of the station window, the integrated station timetable is shown. It features:
6. Non-Destructive Auto-Fill
When <CTRL>-clicking the auto-fill button, the timetable is not cleared before auto-filling. The waiting time at stations is only updated if the value auto-fill just determined is larger than the currently set value. This feature is very useful when upgrading timetabled vehicles.
Thanks to Regiovogel for the idea.
Please vote for flyspray feature request #1124 if you would like to see this part in trunk soon.
7. Warning for very late vehicles
The patch option "Warn if vehicle is late" in the vehicles tab allows you to set a delay, which when exceeded by a vehicle, triggers a warning that the vehicle is very late. The warning also appears when the lateness is truncated due to being larger than the total timetable time if this patch option is enabled. The warning is shown at most every 30 days per vehicle.
Thanks to Eddi for the idea.
A. Known Issues
B. Compatibility Notes
A patch for the cargodest branch is attached.
C. Patch Settings
Patch settings in the Interface tab of the patch settings GUI:
D. History
E. Notes for Developers
This patch was developed as a series of smaller patches (21 so far) with Mercurial Queues which allows to separate the development of trunk and of the patches into two different tracks. Moreover, if parts of the patch should be included in trunk, the patch is already broken up into chunks which can be applied sequentially. I can only recommend warmly to developers planning a similar project to have a look at Mercurial queues. For me, it worked out quite well.
The project uses a versioned patch repository. If you like to do work based on this patch feel free to PM me for a Mercurial bundle of the patch repository.
F. Acknowledgements
- Virtual Time: A wall-clock-based time scale.
- Arrival, Departure and Expected Time in vehicle timetables
- Setting Start Times for vehicle timetables
- Headway Management: Grasp the status of a shared timetable at a glance and keep your vehicles at a defined interval
- Station Timetables: Show arrival, departure and expected times of vehicles stopping at a station.
- Warning for very late vehicles: Configurable by patch option
- Fix the bugs you find
- Cleanup the code
- Start discussion with developers to get it into trunk step after step.
1. Virtual Time
Have you ever been annoyed that timetables in the game are measured in days or even an artificial unit like ticks? Than this feature is for you. It introduces a second time-scale to the game, the virtual time measured in hours, minutes and seconds. You can configure the relation between virtual time and the traditional scale (which I will call calendar-scale for now) with patch setting between 1 virtual seconds per tick and 4 vsecs/tick yielding the following relationships:
Code: Select all
vsecs per tick | 24 Virtual hours equal about
---------------+--------------------------------
1 | 3 years 73 days (38.4 months)
2 | 1 year 219 days (19.2 months)
3 | 1 year 24 days (12.8 months)
4 | 292 days ( 9.6 months)
---------------+--------------------------------
Note: Virtual times are a GUI level concept, i.e. internally ticks or days are used and conversion between virtual time and calendar scale happens when displaying or setting data. This is why the virtual time settings are purely client-side settings. It is safe to use different virtual time settings on different clients in multiplayer.
2. Arrival, Departure and Expected Time
Have you ever seen a timetable in real world showing you how long the train drives / stops. Probably not. Usually they display arrival and departure times. And this is what this feature does: When the patch setting "show departure and arrival times in timetables" is enabled a new column is added to timetable windows showing the next scheduled arrival and departure times (actually it shows arrival and departure dates if you happen to set the timetable unit to days or ticks). When pushing the "Expected" button the expected times are shown instead, i.e. lateness/earliness is taken into account (earliness is not propagated past the next departure as the vehicle will just wait until it is on time again).
Note: Arrival and departure times are only shown for complete timetables without conditional orders and only for timetables that have already started (see the next section for an exception).
3. Setting Start Times
So, you want to create a tightly coupled headway system or just make sure that vehicles are equally separated? As a first building block you need to control the time/date the timetable is supposed to start. When a start date is set, the timetable is set to "not started", lateness is reset and when arriving at the first station lateness is initialized according to current time and intended starting time of the timetable. When a start time is set arrival/departure times are shown for orders before the current order even when the timetable is not started (this is the exception mentioned above).
This part is based on a patch by Maedhros.
4. Headway Management
To be rewritten for V2.00: Headway Management Window Details here.
To manage a whole line of vehicles more easily, this feature allows you to put vehicles with a shared timetable at a constant interval. The start time/date must be set for the current vehicle to be able to set an interval by clicking the "Headway" button. The interval is preset to the value leading to an equal separation between vehicles. This feature works by assigning start times of the requested interval to shared vehicles starting at the current vehicle and following the order the vehicles have on the track/road (so it should work for vehicles which are not able to overtake).
This part is based on a patch by MagicBuzz.
5. Station Timetables
This feature allows you to sort the vehicle lists accessible from station and waypoint windows by arrival and departure time (scheduled or expected) at this station/waypoint (vehicles with unknown times are put after those with known time and sorted by unit number). When you do so, arrival and departure times are shown below the vehicle instead of the profit. When pushing the "Expected" button, lateness/earlyness is taken into account.
A separate GUI for station timetables showing all types of vehicles in one window is now available. When you <CTRL>-click any of the vehicle icons of the station window, the integrated station timetable is shown. It features:
- Arrival/departure panel opening the timetable window of the vehicle when you click on it.
- Mini order list (as already in trunk for ships and aircraft) starting at the station the window is for (i.e. it always shows the next stations starting at this station, instead of starting at the first order).
6. Non-Destructive Auto-Fill
When <CTRL>-clicking the auto-fill button, the timetable is not cleared before auto-filling. The waiting time at stations is only updated if the value auto-fill just determined is larger than the currently set value. This feature is very useful when upgrading timetabled vehicles.
Thanks to Regiovogel for the idea.
Please vote for flyspray feature request #1124 if you would like to see this part in trunk soon.
7. Warning for very late vehicles
The patch option "Warn if vehicle is late" in the vehicles tab allows you to set a delay, which when exceeded by a vehicle, triggers a warning that the vehicle is very late. The warning also appears when the lateness is truncated due to being larger than the total timetable time if this patch option is enabled. The warning is shown at most every 30 days per vehicle.
Thanks to Eddi for the idea.
A. Known Issues
- The "Warn if vehicle is late" can only be set in days no matter what timetable unit you choose.
- This one is not really a bug, but a feature: Since, the headway function assigns the start time cyclically starting at the current vehicle, the vehicles between the current vehicle and the first order get a start time in the "next round". So, they are very early when they arrive at the first order and wait at the first station for a long time. You can avoid this by calling the headway function for the vehicle that next approaches the first station.
B. Compatibility Notes
A patch for the cargodest branch is attached.
C. Patch Settings
Patch settings in the Interface tab of the patch settings GUI:
- Show virtual time in status bar: Off, 12-hour, 24 hour
- Virtual seconds per tick: 1-4
- Show timetable in: Days, ticks, hours/minutes, hours/minutes/seconds
- Show arrival and departure in timetables: Off, On
- Show notice when vehicle has finished timetable autofill: Off, On
- Warn if vehicle is late
D. History
- 2008-08-28 / V1.00 First public release
- 2008-08-29 / V1.01 Bug fixes:
- Setting start date did not work in the calendar scale
- CTRL-click "Headway" did not work in calendar scale when keeping the proposed value (reported by Tekky)
- 2008-08-29 / V1.10 Arrival/departure in station/waypoint vehicle lists
- 2008-08-30 / V1.20 Non-destructive autofill mode
- 2008-09-01 / V1.30 Warning when vehicle is late, text field for entering times, graphical glitches fixed
- 2008-09-03 / V1.40
- Integrated station timetable
- Warn of late vehicles at most every 30 days
- Bug fix: Warning when lateness is truncated was missing
- Bug fix: Station timetables assumed that the station was only in the order list once
- 2008-09-04 / V1.50
- Interval is always preset for the headways feature (<CTRL>-click has no function anymore)
- Don't refuse showing arrivals/departures completely when timetable is incomplete/has conditional orders but continue as far as possible.
- Show mini order list also for non-timetabled vehicles in integrated station timetable
- Allow to sort by expected arrival/departure time
- Some internal rewriting
- 2008-09-04 / V1.51 Bug fix: Garbage arrival/departure times for non-started timetables
- 2008-09-05 / V1.52
- Bug fix: Graphical glitches in arrival/departure panel
- Featurette: When entering start time as time, don't assume it is in the future, but between 6 hours in the past or 18 hours in the future.
- Some more internal cleanup (hopefully didn't break anything)
- 2008-09-06 / V1.53 Bug fixes: YAGG (Yet another graphical glitch), -6 to +18 hour window for start times not working correctly, headway tooltip corrected.
- 2008-09-11 / V1.54
- Featurette: Show whether the timetable is already started (don't just show "on time")
- (Kind of a)Bug fix: If you click headway on a stopped vehicle, don't ignore this vehicle as for other stopped vehicles. The user (hopefully) knows better what he does.
- Bug fix: Only use timetable start for the intended start not for the last start as otherwise headway breaks.
- Bug fix: Room for Mini Order List was reserved even for lists that don't have it.
- Bug fix: Mousewheel scrolling was not working properly for vehicle timetable panel.
- 2008-09-15 / V1.55 Internal change: Order list rewrite
- 2008-09-18 / V1.551 (cargodest only) Bug fix: Loading games/the title screen could crash with cargodest
- 2008-09-18 / V1.56 Bug fix: Order lists were not properly saved, resulting in invalid savegames
- 2008-09-19 / V1.57 Bug fix: Display of group GUI triggered assertion
- 2008-09-19 / V1.571 (cargodest only) Bug fix: Connections were not properly updated when inserting orders
- 2008-09-20 / V1.58 Bug fix: Reloading NewGRFs resulted in trying to convert order lists a second time
- 2008-10-02 / V2.00 Headway has been rewritten completely. It features now a management window showing the state of a shared timetable in a well arranged way.
- 2008-10-09 / V2.01 Bug fixes: Several problems when unit was ticks or days. Make sure that headway features can only be used when at least two vehicles that are not stopped in depot exist.
- 2008-10-16 / V2.10
- Auto-fill rounds to timetable unit selected when starting auto-fill
- Auto-fill allows to set a minimum waiting time (just select a station with a set waiting time, when starting auto-fill and that time will be taken as the minimum time)
- Bug fix: Edit boxes wouldn't accept unchanged settings
- 2008-10-24 / V2.11 Adoption to current trunk and cargodest. No new features or bug fixes.
- 2008-10-29 / V2.20 Headway window: Allow orders without vehicles to be selected and avoid order jumping for complete timetables in most cases.
- 2008-11-11 / V2.21
- Featurette: Show group name of vehicle in vehicle lists when vehicle has no name.
- Bug fix: Mouse-wheel scrolling was not working properly in station timetables.
- Bug fix: Truncation of very late timetables did not work with headway.
- Bug fix: Change date cheat totally confused headway.
- 2008-12-01 / V2.30
- Show leader (^) and autofill (@) marker in headway window.
- Show news item when autofill has finished (default: disabled).
- Autofill & start headway (a leader vehicle must be selected, so that the interval button becomes enabled).
- Bug fix: Clear lateness for leader when (re-)initializing headway.
- 2009-03-21 / V2.31tr (Trunk-only)
- Bug fix: Re-initialize headway when last passing vehicle is removed during first round (e.g. by auto-replace)
E. Notes for Developers
This patch was developed as a series of smaller patches (21 so far) with Mercurial Queues which allows to separate the development of trunk and of the patches into two different tracks. Moreover, if parts of the patch should be included in trunk, the patch is already broken up into chunks which can be applied sequentially. I can only recommend warmly to developers planning a similar project to have a look at Mercurial queues. For me, it worked out quite well.
The project uses a versioned patch repository. If you like to do work based on this patch feel free to PM me for a Mercurial bundle of the patch repository.
F. Acknowledgements
- The setting of start times (dates), the GUI for setting dates and for setting times is heavily based on the timetable patch by Maedhros.
- The setting of headways is based on the timetable based separation patch by MagicBuzz.