[GS] Peaks and Troughs - 24 Timetabling

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

[GS] Peaks and Troughs - 24 Timetabling

Post by Erato »

One of the newest features in JGR that allows gamescripts to make use of the time of day. As such, I present:
Peaks and Troughs GS
In normal OpenTTD, the time does not actually matter, and a certain frequency at a certain time is either always enough, or never enough. Scheduled dispatch allows for 24h timetabling, but there is no reason to.
In real life, we have peak hours, which create a much more complicated logistic problem. Of course, how this travel demand varies throughout the day depends a lot on the culture. Here in the Netherlands, people do not take a train earlier or later than the one that lets them be exactly on time, creating a hyper peak, but when you leave work isn't that important. Elsewhere, like the German S-Bahn, the evening and the morning peak are both a bit wider, and the same height, they have two roughly equal peaks. In Japan, being early is frowned upon, as is leaving earlier from work than your manager, and working hours are less flexible than elsewhere. This creates both a massive morning peak, and an extremely wide and low evening peak.
In this gamescript I tried to roughly recreate this relationship between time and travel demand using 3 presets. None of these 3 presets should generate more passengers than other presets.
See here the demand graphs:
[+] Spoiler
Equal peaks:
Image
Hyperpeak:
Image
Japan:
Image
This gamescript adds a logistic challenge that is nothing like you've ever seen before, makes 24 hour timetabling imperative, and finally gives you a reason to create a railyard or overnight bus storage.

This gamescript requires JGRpp version 0.39.0 or newer.

I want to thank JGR for taking my request for time-based travel demand, and turning it into a few simple gamescript functions, so I can make it a lot more than an internal feature ever would've.

Changing the amount of ticks per minute will slow down or speed up changes, and thus lengthen or shorten peaks. Changing the daylength does not affect these changes.

License: GPLv2
Credits
Author: Erato
New GSDate functions: JGR

Data:
- Hyperpeaks: 2015 Nederlandse Spoorwegen - NS
- Equal peaks: 2010 Zürcher Verkehrsverbund - ZVV
- Japan: 2015 Ministry of Land, Infrastructure, Transport and Tourism

Made using Minimal GS.
Minimal GS author: Zuu

Gameplay notes.
There is not a lot that can be changed within this gamescript to fix issues pertaining to station rating. That has to be done with a NewGRF. Should a poor station rating reduce the morning peak significantly or make night freight impossible, then a NewGRF will have to be doctored to make station rating drop more slowly. Maybe fixing it at 100% works well enough. There's a NewGRF for that here:
viewtopic.php?p=1228729#p1228729
Let me know if this plays better or worse.

From testing it has been found that running this gamescript on existing savefiles will give very unsatisfactory results. It is important that all passengers will be transported, for example using peak services, as they will wait for multiple hours or even days. This may sometimes stretch the peaks.
The server I playtest this on has 148 ticks per minute, which is twice default, this makes the peaks a nice length and allows for a large amount of peak vehicles to transport everyone.

Further testing is still required.
Attachments
Peaks-and-Troughs-v1.tar
(40 KiB) Downloaded 24 times
Peaks_and_Troughs_Source.rar
Practically identical to the tar. Includes make_tar.py from Zuu.
(13.64 KiB) Downloaded 3 times
Last edited by Erato on 22 Nov 2020 14:23, edited 1 time in total.
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
User avatar
spajdy
Engineer
Engineer
Posts: 29
Joined: 28 Jan 2018 12:59

Re: [GS] Peaks and Troughs - 24 Timetabling

Post by spajdy »

Hi, I am just curious I've tried it but I am not sure about the settings. Do I need to change anything or what is ideal settings, you would recommend. Thanks. I was looking for something like this thanks for that.
Špajdy | Slovakia | languages: slovak, eneglish | I code in NML |

| My projects: DB PushPull https://bit.ly/3l9MIzf | Slovak Transport Graphic Set https://bit.ly/38jEHo1

Image
The first BETA version of the Slovak Bus Set is planned for the end of the December of 2020 or the first days of 2021.
User avatar
Erato
Director
Director
Posts: 525
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: [GS] Peaks and Troughs - 24 Timetabling

Post by Erato »

spajdy wrote: 18 Nov 2020 18:32 Hi, I am just curious I've tried it but I am not sure about the settings. Do I need to change anything or what is ideal settings, you would recommend. Thanks. I was looking for something like this thanks for that.
I'm currently playtesting this script on a server. We have 148 ticks per minute (default is 74). That works pretty nice. Without fastforward that does mean that an in-game day takes 2 hours, so this may be something to think about. With 148 ticks per minute, the peaks are a reasonable length, so you get a nice amount of time to enjoy increased service and a good amount of time to move the last few passengers out of the way and do maintenance at night, and you can get trains across the map in less than a day. We play on a 2k by 2k map, if your map is bigger you might want to increase the amount of ticks per minute.

We play with daylength 30, so there's about 4 days in a year. Math:
[+] Spoiler
1440 minutes in a day.
1440*148=213 120 ticks per day
365*74*30=810 300 ticks per year
3.8 days per year
For realism you could turn up the effect of distance on cargo production, so people won't travel to the other side of the map as often.

But to be honest, I'm not sure what settings are good and nice. It depends in large part on your own preferences, but because I have only experienced the server I'm currently on, I can't do much more than tell you about that. Many settings can still be tweaked mid-game, so I'd say get some settings that seem nice to play with, and choose to edit them later. The settings of the gamescript can be changed mid-game as well, however you need to save and reload for those changes to take effect.

I hope this helps.
No pics no clicks. Seriously.
ImageImageImageImageImageImageImage
User avatar
spajdy
Engineer
Engineer
Posts: 29
Joined: 28 Jan 2018 12:59

Re: [GS] Peaks and Troughs - 24 Timetabling

Post by spajdy »

I mean it is helpful because default settings are behavioral weirdly right now for me. Gonna try yours for this.Thanks.
Špajdy | Slovakia | languages: slovak, eneglish | I code in NML |

| My projects: DB PushPull https://bit.ly/3l9MIzf | Slovak Transport Graphic Set https://bit.ly/38jEHo1

Image
The first BETA version of the Slovak Bus Set is planned for the end of the December of 2020 or the first days of 2021.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests