Counting trains on the main line per track

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
CrazyCat007
Engineer
Engineer
Posts: 2
Joined: 17 Sep 2023 04:43

Counting trains on the main line per track

Post by CrazyCat007 »

Hello,

I'd like to improve my main line design to ensure trains are split as even as possible across tracks. For this I need functionality similar to "how many trains currently on a particular track" or "how many trains went through waypoint/station X per last year".

Wonder whether there is addon/patch which does something similar? Or any other way I can achieve this?

If nothing like this exists - is it possible to build it myself? What is the best approach - modify OpenTTD itself? Or is it possible to do it through NewGRF?
mauried
Traffic Manager
Traffic Manager
Posts: 148
Joined: 07 Sep 2010 11:35

Re: Counting trains on the main line per track

Post by mauried »

In JGRs patchpack there is a function called counters which allows you to count how many trains have passed a defined signal.
Its not that commonly used so there doesnt seem to be much information about how it works.
Its accessed by the routefinding functionality for trains signals and you can increase , decrease, set or reset the count.
The trains orders would have to be modified to take action based on what the count was.
CrazyCat007
Engineer
Engineer
Posts: 2
Joined: 17 Sep 2023 04:43

Re: Counting trains on the main line per track

Post by CrazyCat007 »

Thank you! Do you know whether it visualizes this information somewhere as well? Or can it be used only in orders? I need the former...
mauried
Traffic Manager
Traffic Manager
Posts: 148
Joined: 07 Sep 2010 11:35

Re: Counting trains on the main line per track

Post by mauried »

The counter info is only available via the trains orders .
Its possible to change a trains route based on specific criteria such as cargo being hauled or trains maximum or minimum speed limits, but I dont think that will help you.
If its possible to obtain the info that you need, you will then have to do something with it and this will still need you to change the orders of the trains so that they go via differant tracks.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: Counting trains on the main line per track

Post by OzTrans »

CrazyCat007 wrote: 20 Sep 2023 16:34 Thank you! Do you know whether it visualizes this information somewhere as well? Or can it be used only in orders? I need the former...
Here is the wiki about Sigalling and Counters.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 31 guests