The International Simutrans Forum

Simutrans Extended => Simutrans Extended Development => Topic started by: Carl on April 30, 2011, 11:37:13 AM

Title: Waypoints are ignored in journey time calculation
Post by: Carl on April 30, 2011, 11:37:13 AM
Hi all,

Here's a toy network which demonstrates problem with Experimental's method of  calculating journey times. Have a look at the following image:

First, let's have our train travel route 1:

Route 1: Norwich West --> Newport Central --> Norwich East (schedule mirrored)

Norwich East reports a 21-minute journey time to Norwich West on this route.  Now let's change to route 2:

Route 2. Norwich West --> Waypoint --> Norwich East

We've merely deleted Newport Central from the schedule and replaced it with the waypoint marked on the map, so we should expect route 2 to return a broadly similar journey time. But this isn't what happens: strangely, Norwich East now displays a much shorter 6-minute journey time to Norwich West.* Finally, let's check out route 3:

Route 3. Norwich West --> Norwich East

This route removes the waypoint from the schedule. Since the train can now take the quicker route between Norwich's stations -- via Line B rather than Line A -- we should expect the journey time to be faster. But it remains at 6 minutes.

I think I see what's going on here. In working out the journey time between Norwich West and Norwich East, the game works out the point-to-point distance between the stations and then figures in the average speed of the convoy to work out the journey time. But it doesn't involve waypoints in the calculation. Consider our three conflicting routes:

1. Norwich West --> Newport Central --> Norwich East (21 mins)
2. Norwich West --> Waypoint --> Norwich East (6 mins)
3. Norwich West --> Norwich East (6 mins)

1 and 2 come out with wildly different journey times because route 2 ignores the waypoint when calculating the journey time. The game mistakenly treats route 2 exactly like route 3.

Waypoints should be treated like regular station stops for the purposes of calculating journey time. In working out the journey time for route 2, the game should first work out the time between West and waypoint, and then the time between waypoint and East. This will yield (more) accurate results.

Though this is just a toy example, I think it's pretty clear that this detail is important in making extensive networks: especially when there are convoys which travel large distances without stopping for cargo but are nevertheless guided by waypoints.

I can upload the save-game if anyone would like to play around with it, but it should be fairly simple to re-create.

* Note that another problem arises at this point. The average speed of the train plummets to 1/4 of its previous value, despite no visible change in pace. This would also be remedied by my proposal here.
Title: Re: Waypoints are ignored in journey time calculation
Post by: Carl on May 05, 2011, 11:27:03 AM
Having thought about this some more, I've realised that the problem won't be the journey times on the section of track in question. The fact that the average speed plummets (as I note at the end of the last post) will mean that the journey time adjusts in due course. The problem then will be that the line in question has a mistakenly low average speed -- so on other sections of its route the journey times will be incorrect. So when it's competing with other lines elsewhere, it'll always lose out.

If waypoints were treated as stations in this way then the average speed would not suffer to the same degree.
Title: Re: Waypoints are ignored in journey time calculation
Post by: jamespetts on May 28, 2011, 12:26:28 AM

thank you for reporting this, and apologies for not having reverted to you earlier: I have been rather preoccupied with the physics issue, I am afraid. The behaviour relating to the short journey time display that you notice when you replace the station with a waypoint is caused by the fact that the journey time has not yet been recalculated to reflect the lower average speed. Once the journey time is recalibrated to show the lower average speed, the journey time should revert to its previous value.

The underlying issue here, however, should be corrected when I implement point-to-point average speeds as I plan to do in a future version. This will not be quite the same as treating waypoints as stations (which I think would have undesirable side-effects of giving players an incentive to add redundant waypoints to give falsely high average speeds - after all, what passengers/goods care about is how long that it takes them to reach actual destinations, not the physical speeds of the vehicles), but should make sure that the 6-minute journey time in scenario no. 1 is less likely to arise.
Title: Re: Waypoints are ignored in journey time calculation
Post by: Carl on May 28, 2011, 08:09:29 AM
Hi jamespetts,

Thanks for the reply! I definitely mis-diagnosed the issue in the OP, and you're right that average speed calculation the concern here -- the issue of waypoints is a red herring. The broader issue is that the average speeds of lines are often dragged down by slow runs on isolated sections of their route, and this would be addressed by the point-to-point average speed proposal that you mention.

May I ask a question about point-to-point average speeds? Is the idea that there will be point-to-point average speeds for each line between each station, or just a single average speed of all journeys taken between each station? The latter seems like it could get the wrong results. For instance, assume that some trains from A to B take an hour, and some take two hours. We do not want them all to be thrown into the calculation of the journey time between A and B, since we'll end up with a figure of 90 minutes--which is absurd, because none of the trains take 90 minutes. (Obviously this calculation will be done in terms of average speeds -- but the results in times of journey time are relevant.)
Title: Re: Waypoints are ignored in journey time calculation
Post by: jamespetts on May 28, 2011, 10:59:16 AM
It is the former that is planned :-)
Title: Re: Waypoints are ignored in journey time calculation
Post by: Carl on May 28, 2011, 11:01:43 AM
Excellent! I look forward to seeing this in action! :-)