YAPP - Yet Another PBS Patch (now in trunk!)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
T-Unit
Transport Coordinator
Transport Coordinator
Posts: 368
Joined: 03 Feb 2007 18:53
Location: Leeds, England

Re: YAPP - Yet Another PBS Patch

Post by T-Unit »

If i know my PBS so far I think you want signals at the end of each platform. That should help.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: YAPP - Yet Another PBS Patch

Post by Tekky »

@Noldo: Train #4 attempts to go to a depot but fails. After having failed, it doesn't reserve the next piece of track properly, which causes the next train to crash into it. Therefore, this is obviously a bug in the automatic depot servicing code.

@cal: I was unable to reproduce this problem with the savegame you provided.
cal
Engineer
Engineer
Posts: 8
Joined: 08 Feb 2008 18:54
Location: Thun, Switzerland

Re: YAPP - Yet Another PBS Patch

Post by cal »

@T-Unit: Well, there *are* exit signals.
cal
Engineer
Engineer
Posts: 8
Joined: 08 Feb 2008 18:54
Location: Thun, Switzerland

Re: YAPP - Yet Another PBS Patch

Post by cal »

Tekky wrote:I was unable to reproduce this problem with the savegame you provided.
Hmm... I can reproduce it, as you can see in the following screenshot:
Neuhausen am Rheinfall Transport, 21. Apr 1955.png
(245.52 KiB) Downloaded 198 times
EDIT: thanks for the quick reply anyway.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: YAPP - Yet Another PBS Patch

Post by Zuu »

Thanks for a great patch!

In my game my busiest town station was built a bit to close to the main-track. Without PBS this situation would have caused deadlock for sure. However in my junction-area I've created a possibility for trains that exit the station to pass around a train that waits to get in the station. (see attached image) But it seams like the exiting train (train 8 in the image) have already decided to go though the blocking train and not around it.
path_exists.png
path_exists.png (51.3 KiB) Viewed 1380 times
On theory I tested was that to take the blue-marked way around the blocking-train the two trains have to share the same tile, so I tested to add some extra track and re created the same situation with new trains.
seperate_tiles.png
seperate_tiles.png (11.25 KiB) Viewed 3683 times
I think by taking a train that will go to the left from the station and stop it a tile before it reserve it's path though the junction and then cause a deadlock and then restart the train, I've shown that the exiting train have not on before-hand decided on a specific path and therefore don't want to take the blue path around the blocking train.

Savegame attached:
path_available.sav
I've used the trunk_r12072_yapp_r12062 build posted earlier in this thread.
(258.56 KiB) Downloaded 168 times
EDIT: If you want to recreate this situation with other trains it should be useful to know that all trains that arrives from the left will depart to the left too. Similar all trains that arrives from the right depart to the right. Also all trains are exactly 5 tiles long.

--------

One thing I would like to have is a way to mark one-way without marking safe-place to stop in the driving-direction.


Again, thanks for your hard work with the patch!
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
T-Unit
Transport Coordinator
Transport Coordinator
Posts: 368
Joined: 03 Feb 2007 18:53
Location: Leeds, England

Re: YAPP - Yet Another PBS Patch

Post by T-Unit »

cal wrote:@T-Unit: Well, there *are* exit signals.
Sorry i thought that was catenary.
cal
Engineer
Engineer
Posts: 8
Joined: 08 Feb 2008 18:54
Location: Thun, Switzerland

Re: YAPP - Yet Another PBS Patch

Post by cal »

T-Unit wrote:Sorry i thought that was catenary.
Well, in fact I'm still in the fifties, so I can't even build electric railway yet (which is not very realistic, btw. In Switzerland, already in 1928 half of the railway network was electrified.)
T-Unit
Transport Coordinator
Transport Coordinator
Posts: 368
Joined: 03 Feb 2007 18:53
Location: Leeds, England

Re: YAPP - Yet Another PBS Patch

Post by T-Unit »

Well it depends which trainset you are using. Now with the UKRS i am using some whilst im in the 50s
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1795
Joined: 30 Mar 2005 09:43

Re: YAPP - Yet Another PBS Patch

Post by peter1138 »

cal wrote:Altough it is still loading, the passenger train in the middle of Bülach station has reserved the track up to the junction and blocks the iron train on the right:
This is a bug. It happens when a train stops and loads/unloads at a station that is not in its orders. If you catch it you'll see it actually reserves the path ahead before it stops.
cal wrote:@T-Unit: Well, there *are* exit signals.
But not at the entrance of Büluch Höhe.
He's like, some kind of OpenTTD developer.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: YAPP - Yet Another PBS Patch

Post by Tekky »

Michi_cc wrote:
Tekky wrote:I have already noticed that trains are having trouble finding a depot in PBS areas.
It's a side effect of how the system works. Without PBS, trains have the chance to find a depot at every junction tile. With PBS trains will unconditionally follow their reservation and in turn will only look for a depot if they have to reserve a further stretch. As only depots within a certain distance are considered, this makes finding a depot more difficult.
When a train is in PBS mode, it should not decide whether it should visit a depot for servicing at every junction tile. Instead, it should make this decision at every signal and then reserve its path accordingly.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YAPP - Yet Another PBS Patch

Post by Michi_cc »

Tekky wrote:
Michi_cc wrote: It's a side effect of how the system works. Without PBS, trains have the chance to find a depot at every junction tile. With PBS trains will unconditionally follow their reservation and in turn will only look for a depot if they have to reserve a further stretch. As only depots within a certain distance are considered, this makes finding a depot more difficult.
When a train is in PBS mode, it should not decide whether it should visit a depot for servicing at every junction tile. Instead, it should make this decision at every signal and then reserve its path accordingly.
Well, that's exactly what I wrote. The problem is that it makes that decision only at every signal. The pathfinder won't consider depots that are more expensive (too far away) the get to than a certain limit. This means that a depot might be too far away at the first signal and too far away at the next signal, but could be near enough on a junction tile in between. A non-pbs train can now find the depot on the junction tile, whereas a pbs train is not able to. I'll take a look if I can tweak the pathfinder penalties for this case to yield better results.


The inconsistency with some reservations stopping at stations and others not will be recitified in the next release.

-- Michael Lutz
-- Michael Lutz
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: YAPP - Yet Another PBS Patch

Post by Tekky »

Michi_cc wrote:Well, that's exactly what I wrote. The problem is that it makes that decision only at every signal. The pathfinder won't consider depots that are more expensive (too far away) the get to than a certain limit. This means that a depot might be too far away at the first signal and too far away at the next signal, but could be near enough on a junction tile in between. A non-pbs train can now find the depot on the junction tile, whereas a pbs train is not able to. I'll take a look if I can tweak the pathfinder penalties for this case to yield better results.
This cannot be correct. Please take a look at Noldo's bug report. I found out that train #4 decides to visit the depot it passed by. It makes this decision at a junction tile and not at a signal, despite being in PBS mode. This is visible by looking at the train's status bar. However, the train first follows its previous reservation despite having decided to visit the depot. Therefore, it gives up to visit the depot on the next signal and goes wild. This behavior leads to train #4 not making a proper reservation and thereby another train crashing into it.
Spingo
Engineer
Engineer
Posts: 15
Joined: 12 Jul 2007 00:43
Location: SydAU

Re: YAPP - Yet Another PBS Patch

Post by Spingo »

From what I have read, this patch is not directly compatible with Tekky's bi-directional double track philosophy (for lack of a better word). However, I had the thought of using three tracks and this PBS patch to provide some sort of path redundancy in the event of train breakdown, while minimising the amount of space that the track layouts take up. However, I've come across a problem. It could be to do with my signalling, but I thought that I'd post my layout here for feedback.

Essentially, the layout has three tracks - one is a dedicated "up" track, another is a dedicated "down" track and the middle is bi-directional. The idea is that trains will always use the uni-directional tracks if they are clear and will use the bi-directional track if the uni-directional one is blocked. However, it doesn't work and I can't figure out why...
The third rail theory - but why doesn't it work?
The third rail theory - but why doesn't it work?
third_rail.png (226.14 KiB) Viewed 1467 times
In the picture above, assume that Train 1 is broken down (I've actually stopped it to generate the screenshot). Train 2 comes from behind but stays at the PBS signal - it doesn't want to use the middle track at all, even though there is a patch to the destination via that track.

I'm guessing that it has something to do with an earlier post in this thread - that trains will always prefer uni-directional track - but surely the train should be able to choose the bi-directional option in this case?

Can anyone shed some light as to what I'm doing wrong, if anything? It should work in theory, but it just doesn't...
May your cheese be tasty!
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: YAPP - Yet Another PBS Patch

Post by Tekky »

yapf.rail_pbs_signal_back_penalty is currently set to 2500 by default in openttd.cfg. Try setting it to 300 or maybe even 0.

However, changing your openttd.cfg does not update this value in your existing savegames. In order to change this value in your already existing games, you must use the console command "patch yapf.rail_pbs_signal_back_penalty 300".
cal
Engineer
Engineer
Posts: 8
Joined: 08 Feb 2008 18:54
Location: Thun, Switzerland

Re: YAPP - Yet Another PBS Patch

Post by cal »

peter1138 wrote:
cal wrote:@T-Unit: Well, there *are* exit signals.
But not at the entrance of Büluch Höhe.
Yes and no - there are only exit signals in south-east direction, but since this is a unidirectional station, I think it should suffice. I don't see why a train should ever leave the station in north-west direction, there is no possibility to go any further there, because of the one-way signals.
anboni
Engineer
Engineer
Posts: 23
Joined: 21 May 2006 10:12

Re: YAPP - Yet Another PBS Patch

Post by anboni »

I think I've come across some inconsistency between (trunk) patch settings and this patch. With the "Enable Signal GUI" set to on, it appears the "Signal type to build by default" setting isn't honoured. It will always build normal signals in that case. With Signal GUI disabled, the select default gets built.
User avatar
Maedhros
OpenTTD Developer
OpenTTD Developer
Posts: 603
Joined: 30 Mar 2006 18:24
Location: Durham, UK

Re: YAPP - Yet Another PBS Patch

Post by Maedhros »

One thing I've noticed is that level crossings aren't closed when a path is reserved through them. Is this deliberate, or was it just missed?
No-one's more important than the earthworm.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: YAPP - Yet Another PBS Patch

Post by Tekky »

@Spingo: I have just tried building 3 tracks with the middle track bi-directional, like you did. My suspicion was correct. If I set the patch setting yapf.rail_pbs_signal_back_penalty from 2500 (default setting) to under 1000, the middle track is also used. If you set it to 0, then trains use the middle track just as frequently as the outer tracks. Since this behavior is not desired, you should maybe set it between 400 and 700.

Please refer to my last post for instructions on how to set the patch setting yapf.rail_pbs_signal_back_penalty for existing savegames, as changing the setting in openttd.cfg will only change this patch setting for new games.

@anboni: Yes, I noticed this too and I agree with you that this should be changed.

@Maedhros: I'm not sure if this is a good idea to close road crossings whenever a train has reserved a path over it. Think of a long piece of single track connecting two stations with multiple platforms. In this case, the road crossing will be closed 90% of the time, even if the train will only actually reach the road crossing in a very long time, because the train will reserve the entire single track in advance.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YAPP - Yet Another PBS Patch

Post by Michi_cc »

Maedhros wrote:One thing I've noticed is that level crossings aren't closed when a path is reserved through them. Is this deliberate, or was it just missed?
Not implemented, if there's sufficient support for this I will add it.
anboni wrote:I think I've come across some inconsistency between (trunk) patch settings and this patch. With the "Enable Signal GUI" set to on, it appears the "Signal type to build by default" setting isn't honoured. It will always build normal signals in that case. With Signal GUI disabled, the select default gets built.
Known. Will change.
dihedral wrote:the save game will help :-) just let it run
Thank you, problem found and fixed.

-- Michael Lutz
-- Michael Lutz
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: YAPP - Yet Another PBS Patch

Post by Tekky »

I have found another bug. In the attached screenshot, I have reversed a train on a piece of track. As you can see in the screenshot, it then reserves the route past the one-way PBS signal, despite it showing in the other direction. When I reverse the train again in its current position, it clears its reservation up to the one-way PBS signal, but it doesn't clear the reservation beyond that signal, although it had previously reserved it.
Attachments
bugreport.png
bugreport.png (5.67 KiB) Viewed 1427 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 14 guests