[Patch] Longer pbs reservations
Moderator: OpenTTD Developers
[Patch] Longer pbs reservations
This patch will eventually add some useful signal types to the game. Currently, it is a mere update of Jafinto's long reserve patch.
Long reserve PBS signals can be chosen in the signal gui (the most right, with the vertical gray bar). Trains try to extend the reserved path to a normal signal.
History:
0.1 - Loaded with bugs...
0.2 - Adds long reserve PBS signals. Based on Jafinto's work.
Roadmap:
0.3 - Real pre-signals: signals that can only show yellow and green, and are not safe waiting places.
0.4 - Graphics for the new signal types.
0.5 - Combination between normal PBS and pre-signals (red, yellow and green states)?
Long reserve PBS signals can be chosen in the signal gui (the most right, with the vertical gray bar). Trains try to extend the reserved path to a normal signal.
History:
0.1 - Loaded with bugs...
0.2 - Adds long reserve PBS signals. Based on Jafinto's work.
Roadmap:
0.3 - Real pre-signals: signals that can only show yellow and green, and are not safe waiting places.
0.4 - Graphics for the new signal types.
0.5 - Combination between normal PBS and pre-signals (red, yellow and green states)?
- Attachments
-
- longer reservations 0.1.patch
- Should work with any current trunk. Patch made with Mercurial.
- (11.11 KiB) Downloaded 151 times
-
- long_reserve_0.2.patch
- Based on the work of Jafinto. Made with Git. Apply with patch -p0 to a current version of trunk.
- (15.29 KiB) Downloaded 133 times
Last edited by Gastje33 on 23 Dec 2009 01:55, edited 2 times in total.
Re: [Patch] Longer pbs reservations
Hi, sounds interesting, but do you have an example of a situation (track layout) where I would benefit from having this functionality?
Re: [Patch] Longer pbs reservations
Here is a bundle built with GCC against r18563, just for testing purposes. Nice looking patch, I see you can reserve the block that a train reserves? Would be good for priorities.
- Attachments
-
- longer_reservations_0.1_win32_r18563.rar
- (3.49 MiB) Downloaded 105 times
Re: [Patch] Longer pbs reservations
I think this is an interesting approach, but in my opinion it would be more useful, if you could set the number of reserved block as a "per-train" (or "per-group")-setting. That way you'd be able to achieve priority for passenger trains over freight trains (for example; or fast passenger trains over slower ones).
Re: [Patch] Longer pbs reservations
No, not yet. I'm just programming this for yellow signals.kvtb wrote:Hi, sounds interesting, but do you have an example of a situation (track layout) where I would benefit from having this functionality?
That is a good idea. After I fixed some bugs, I'll have a look at how hard it is to implement.rbn2903 wrote:I think this is an interesting approach, but in my opinion it would be more useful, if you could set the number of reserved block as a "per-train" (or "per-group")-setting. That way you'd be able to achieve priority for passenger trains over freight trains (for example; or fast passenger trains over slower ones).
Re: [Patch] Longer pbs reservations
Actually over a year ago there was an interesting thread regarding "priorities" (http://www.tt-forums.net/viewtopic.php? ... it=pps+ppo) and there were two ways mentioned to achieve priority: "priority path order" and "priority path signal". If priority reflects the idea behind your patch, you might be interested in that thread (it's only two pagesGastje33 wrote:That is a good idea. After I fixed some bugs, I'll have a look at how hard it is to implement.

I also have two questions: Let's say a train wants to reserve 2 blocks, but only can do one, because the second one is already busy. Would this train reserve the second block as soon as it's free again or only if the trains arrives at the upcoming signal.
And if a train reserves 4 blocks and drives through the next signal, will it eventually change it's previous reservation because a better path got available?
Keep up the good work
![Pleased :]](./images/smilies/pleased.gif)
Re: [Patch] Longer pbs reservations
Well, I wanted to implement yellow signal state, for that trains need to reserve two blocks. Although, it seems to be a good system for priorities too, if the amount of blocks can be set per train.rbn2903 wrote: Otherwise I would be interested in what you are trying to achieve with this patch.
Only if the train requests a reservation, which is at the next signal.rbn2903 wrote: Let's say a train wants to reserve 2 blocks, but only can do one, because the second one is already busy. Would this train reserve the second block as soon as it's free again or only if the trains arrives at the upcoming signal.
That would make it much more complicated, I'm just starting to learn the OpenTTD code.rbn2903 wrote: And if a train reserves 4 blocks and drives through the next signal, will it eventually change it's previous reservation because a better path got available?

Re: [Patch] Longer pbs reservations
Hm, OK, I could unterstand it, if you said: I want a train to reserve more than one block, so I need a yellow signal state as an indicator. But the other way around? I'm sorry and I don't want to be harsh: What's the use in having a yellow signal state? 

Yes, you are right. That may be some option for a future patch.Gastje33 wrote:That would make it much more complicated, I'm just starting to learn the OpenTTD code.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: [Patch] Longer pbs reservations
http://www.icosahedron.de/openttd/patch ... s_v2.patch <-- a patch with ahead-reservation which doesn't crash... - but it's a bit old by now and it probably will need updating.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: [Patch] Longer pbs reservations
Would it be possible to automatically reserve all the following blocks with one entreance and one exit? So we you would get greens from the train up to the next junction. This would indicate an incoming train long before it might enter the screen.
Re: [Patch] Longer pbs reservations
That's easy, don't put any signals between junctions.
Re: [Patch] Longer pbs reservations
Yeah, but if there is a second train (and there usually is), it'll have to wait until the first train clears the entire track. And regular signals are just... always green, not only when a path is reserved.
Re: [Patch] Longer pbs reservations
It irritates me that trains stop completely if they are behind a slower train. If they first encounter a yellow signal, they only slow down and (hopefully) the next signal is green again.rbn2903 wrote:What's the use in having a yellow signal state?
I should have done some research before I started coding... Thank you for that patch, and of course thanks to the original patch maker.planetmaker wrote:http://www.icosahedron.de/openttd/patch ... s_v2.patch <-- a patch with ahead-reservation which doesn't crash... - but it's a bit old by now and it probably will need updating.
In the Netherlands, signals on sections without switches (P-signals) are also always green.Dappa wrote:Yeah, but if there is a second train (and there usually is), it'll have to wait until the first train clears the entire track. And regular signals are just... always green, not only when a path is reserved.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: [Patch] Longer pbs reservations
Hehe. The author of the first patch (and the whole PBS stuff as found in trunk for that matter) also made a - by his standards - hacky patch to allow yellow states: http://www.icosahedron.de/openttd/patch ... _hack.diff
But I really like seeing this idea picked up again
But I really like seeing this idea picked up again

OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: [Patch] Longer pbs reservations
You seem to contradict yourself:
I see no other solution than to have the second train wait until the first one is at the next junction, which is exactly what happens if you have no signals between junctions.
Edit: Added italics font to the quote for more emphasis.
Dappa wrote:Would it be possible to automatically reserve all the following blocks with one entreance and one exit? So we you would get greens from the train up to the next junction. This would indicate an incoming train long before it might enter the screen.
Given that reservations mean that no other train can use the reserved blocks, how do you expect the second train to 'reserve all the following blocks with one entreance and one exit?' while the first train is on it?Dappa wrote:Yeah, but if there is a second train (and there usually is), it'll have to wait until the first train clears the entire track. And regular signals are just... always green, not only when a path is reserved.
I see no other solution than to have the second train wait until the first one is at the next junction, which is exactly what happens if you have no signals between junctions.
Edit: Added italics font to the quote for more emphasis.
Re: [Patch] Longer pbs reservations
This looks very interesting. There are quite a few threads about signals that might or might not be useful to you. Here´s two of them that weren´t linked to yet in this thread:
Multi-Aspect Signals (MAS)
Long Reserve PBS signal

Multi-Aspect Signals (MAS)
Long Reserve PBS signal
If you want to make priorities (which would be the most useful purpose of this idea), they absolutely have to make the next reservation as soon as the block becomes available. However, if you just want the yellow signal state, you´ll be fine. Someone else will have to code it in such a way that it suits priorities.Gastje33 wrote:Only if the train requests a reservation, which is at the next signal.rbn2903 wrote: Let's say a train wants to reserve 2 blocks, but only can do one, because the second one is already busy. Would this train reserve the second block as soon as it's free again or only if the trains arrives at the upcoming signal.

Re: [Patch] Longer pbs reservations
Those seem very helpful. Thank you.el koeno wrote:This looks very interesting. There are quite a few threads about signals that might or might not be useful to you. Here´s two of them that weren´t linked to yet in this thread:
Multi-Aspect Signals (MAS)
Long Reserve PBS signal
My first goal is just a yellow signal state. I'm starting to learn the code a bit now, so maybe later I'll add thing like priorities.el koeno wrote:If you want to make priorities (which would be the most useful purpose of this idea), they absolutely have to make the next reservation as soon as the block becomes available. However, if you just want the yellow signal state, you´ll be fine. Someone else will have to code it in such a way that it suits priorities.
Re: [Patch] Longer pbs reservations
Sorry for not being clear. What I meant was the possibility of reserving blocks as fas as possible, with single entrances and exits. This would be up to a junction, or the next train.Alberth wrote:You seem to contradict yourself:Dappa wrote:Would it be possible to automatically reserve all the following blocks with one entreance and one exit? So we you would get greens from the train up to the next junction. This would indicate an incoming train long before it might enter the screen.Given that reservations mean that no other train can use the reserved blocks, how do you expect the second train to 'reserve all the following blocks with one entreance and one exit?' while the first train is on it?Dappa wrote:Yeah, but if there is a second train (and there usually is), it'll have to wait until the first train clears the entire track. And regular signals are just... always green, not only when a path is reserved.
I see no other solution than to have the second train wait until the first one is at the next junction, which is exactly what happens if you have no signals between junctions.
Edit: Added italics font to the quote for more emphasis.
Re: [Patch] Longer pbs reservations
I have stopped working on my original patch. It was too buggy. I've decided to use the patch in this topic as a basis for my intended additions. The patch can be found in the first post. I couldn't upload the Win32 build, I'll give it another try tomorrow.
Last edited by Gastje33 on 23 Dec 2009 01:59, edited 2 times in total.
Re: [Patch] Longer pbs reservations
That link you posted is to an image of the topic icon... 

Who is online
Users browsing this forum: No registered users and 8 guests