The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: yobbobandana on June 06, 2010, 06:15:11 pm

Title: Allowing trains to use the correct platform on a return journey
Post by: yobbobandana on June 06, 2010, 06:15:11 pm
Hi!

After implementing more user-friendly return journeys (see http://forum.simutrans.com/index.php?topic=5262.0 (http://forum.simutrans.com/index.php?topic=5262.0)) it was suggested that it would be nice if trains could make use of this as well.

Currently if you specify two opposite one-way tracks and use the automatic line mirroring feature, the trains will travel all the way around your loop in order to stop at the exact platform specified by the line.

I've done a little preliminary work on this in my simutrans-experimental git fork, so I thought I should split discussion off from the above thread into a new one here.

I've just pushed some changes to my repo, so that trains behave thus:
* Trains will attempt to go to the exact platform specified, even if it would result in a trip around your whole rail loop.
* If during this journey the train should happen to p**** thru a connected platform of appropriate length, it will stop there in stead.
* If the train is set to wait for a certain load percentage at the stop, it will always go to the exact designated platform regardless.

This seems to be working well for me, but I'm sure there are situations where it will do the wrong thing. So if anyone would like to test, or point out where this might fail I'd be grateful :).

Changes are in my git repo at
http://github.com/mesilliac/simutrans-experimental/tree/testing

@James and sdog, my last pushes reverted my first attempt, and now the second should behave a little more sensibly. Before trains would stop at the closest platform, but now they'll try to get to the designated one, allowing better routing control.
Title: Re: Allowing trains to use the correct platform on a return journey
Post by: jamespetts on June 06, 2010, 06:54:47 pm
yobbobandana,

this is very interesting - thank you for your work on this. I haven't had the chance to test this yet, but I am in the process of merging this into the "-devel" branch. In that branch is also merged the latest GUI changes from Simutrans-Standard, which currently have some problems (the "chart" and "details" button on stations and convoys do not work - I am not immediately sure whether this is a merge issue or a Simutrans-Standard issue).

I should be interested in anyone else's test results for this!
Title: Re: Allowing trains to use the correct platform on a return journey
Post by: wlindley on June 06, 2010, 07:38:13 pm
I just tested, and the 'chart' and 'details' buttons in standard worked in r3397; broke in r3405; and are still broken in r3426.
Title: Re: Allowing trains to use the correct platform on a return journey
Post by: jamespetts on June 06, 2010, 08:33:50 pm
A -Standard bug report is in order, then. Thank you for testing :-)

Edit: Posted bug report here (http://forum.simutrans.com/index.php?topic=5288.0).
Title: Re: Allowing trains to use the correct platform on a return journey
Post by: jamespetts on September 08, 2010, 12:31:47 am
Yobobandana,

I am currently in the process of preliminary testing in advance of a 9.x release. I have found a bug in this feature, which I'd rather like to include (the feature, that is, not the bug). The problem is that the reversing of the schedules is not recognised by the system that checks the time that it takes to go from one halt to another. The problem is caused by the fact that you implemented a system for checking in simhalt.cc, without realising that that code is, in effect, depreceated in favour of more sophisticated (and much faster) code written by Knightly in path_explorer.cc, where your system has not been implemented (understandably, since the code in simhalt.cc is not marked as deprecated).

I had a brief go this evening at implementing it there, but my initial attempts failed: a combination of my relatively limited time and the complexity both of your system and Knightly's code got the better of me.

Do you think that you could implement your system in path_explorer.cc? The relevant part starts at around line 681. I should be very grateful indeed. Thank you for all your work on this!
Title: Re: Allowing trains to use the correct platform on a return journey
Post by: jamespetts on September 11, 2010, 10:23:40 pm
I have managed to implement something of a fix to this - the timings are not identical to an implementation involving putting the stops in reverse order in the schedule, but it's not far off. Any testing (-devel branch) would be appreciated.