Pathfinding and transfers for unique stations


Notice the green train westbound to the upper square station. Notice that it has star passengers on it. They should have transferred to the orange line at the previous station (triangle) and the seats thus vacated should have been filled by waiting circle passengers. (the output_log.txt file is from March, therefore useless).

Notice the plus passengers on the red train eastbound away from the square station and travelling away from the closest transfer station to a line going to the plus station.

Notice the blue train eastbound between the triangle and diamond stations. There are gem/cone (???) shaped passengers on this train, but the station of that shape is to the west. The previous triangle station would have been the most appropriate place for eastbound passengers to transfer. Given where they actually started, the shortest route for these passengers would have been to get on a westbound train and transfer at the football/rugby shaped station.

Notice the plus passenger on the yellow train moving away from the star station.

I wonder if track distance (or even simple station count) with an additional penalty for each transfer might not be the most efficient pathfinding method for passengers to unique stations.


Thanks for taking the time to document all those oddities!

I would love to know what happened to make those passengers decide to take the route they did. We do have extensive logging for debugging the pathfinding, but unfortunately it doesn’t ship in published builds (it is absurdly slow in anything other than trivial cities) so the retail logs don’t help us. If you do have a city layout that is consistently sending passengers in odd directions, the most helpful thing from a debugging perspective is taking a screenshot, exiting the game, and sending us the savegame.dat (it’ll be next to profile.json, path’s in the log) along with all other information.

I’ve written before about the various complexities involved with the pathfinding, and the silly things it does is mostly derived from inaccurate arrival time estimates and assumptions it makes about future railcar capacity, compounded by the low frequency of trains vs. a normal underground service. Probably the #1 thing we could do to improve the pathfinding would be forcing trains to stop at every station, as just the speed difference between decelerating to a stop and accelerating again, vs. zipping through at full speed, is something like 3 seconds.


Does anyone else have an image of loads of squares staring aimlessly at a departures board?


I’ve been sitting on a suggestion for years because I imaging it would take a lot of new coding (= -$) but maybe you could sell it as an expansion pack (= +$).

A fourth gameplay mode in addition Normal, Extreme and Endless. Call this mode ‘scheduled’ or something. All trains stop at all stations. Trains (and carriages) have 3 doors so 3 passengers can enter/exit at the same time. A full train (with carriage or not) at a busy station would therefore take 4 time ticks to load and unload. To keep trains on schedule, all trains would stop at all stations for 4 time ticks. The schedule (train spacing) for a line would be determined by the number of trains on the line and its length. Since there is a schedule you would not be able to change the position of a train on a line, similar to extreme, but otherwise gameplay would be more like endless in that you would continue to get new assets every week until the maximum. Your score would be some measure of efficiency; total trips completed per week or maybe total trips completed per station per time tick averaged over six hours and the whole map.


Mini (49.8 KB)
The square passenger waiting at the plus station recently got off a northbound grey train. That seemed a little odd at the time, so I started to be vigilant for obviously invalid pathfinding. I did not have to wait long. The blue train crossing the river has just picked up two pie-slice/water-drop passengers from the circle station it has just left.

Upon reflection, a transfer to orange at the triangle station followed by a transfer to yellow or red at the square station seems possible given the current train positions, but the likelihood of actually being able to get on to the orange train seems highly unlikely. The square passenger on the blue train is probably taking this path too.


Mini (44.5 KB)
Follow the diamond and star passengers from the circle station at the intersection of the dark orange and light blue lines to those respective stations on the two mustard coloured lines. This is in endless overtime, but I assume the pathfinding is the same as for the regular game. Since the star and diamond stations are next to each other I expected both types of passengers to follow the same route but they do not.

The star passengers transfer to the pink line here, which I did not expect:

The diamond passengers transfer to the darker mustard line here:

I started to focus on the stars at this point so I assume the diamonds took that single dark mustard train to station.

The star passengers do not get on the next westbound pink train which has vacant seats:

But they do get on the following one:

And transfer at the circle to the two mustard lines: