YAPF & PBS Question
Moderator: OpenTTD Developers
- Jim Starluck
- Traffic Manager
- Posts: 135
- Joined: 26 Jun 2005 20:12
- Location: Cincinnati, OH
- Contact:
YAPF & PBS Question
A: Would it be possible to make all YAPF signals use PBS by default? This would allow players to specify which PBS signals are and aren't pre-signaled, which would make a lot more interesting combinations possible.
B: How easy/hard would this be? I am not a coder and do not pretend to understand how it works, but I'm aware that some things are easier than others...where does this fall on the scale?
Edit: I just realized this might be more appropriate in the Suggestions forum...if a Mod feels it belongs there, then feel free to move.
B: How easy/hard would this be? I am not a coder and do not pretend to understand how it works, but I'm aware that some things are easier than others...where does this fall on the scale?
Edit: I just realized this might be more appropriate in the Suggestions forum...if a Mod feels it belongs there, then feel free to move.
If at first you don't succeed, get a bigger locomotive and try again.
- StopRightThere
- Chief Executive
- Posts: 761
- Joined: 18 Dec 2005 20:10
- Location: United Kingdom
PBS was removed from the main trunk because of bugs. Until the rewrite is done, I doubt they will put it back in...
Bye Bye OpenBVE 
Official TT-Hot young ginger Doctor Who assistant FanClub
Formerly known as AdditionalData

Official TT-Hot young ginger Doctor Who assistant FanClub
Formerly known as AdditionalData
That was not his question.gamezguy wrote:PBS was removed from the main trunk because of bugs. Until the rewrite is done, I doubt they will put it back in...
A: I think that it would be possible, although I don't think that it would happen.
B: I will probably be as hard as actually implementing PBS. All the signals will just behave as PBS signals on default.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone







Re: YAPF & PBS Question
Don't forget that there are eight different types of signals; Normal, pre, pre-exit, combo, PBS, PBS-pre, PBS-pre-exit and PBS-combo. Hackykid's choice not to use the latter three types in no way forces KUDr to make the same decision.
Until PBS has the same requirements (including memory and processor-power requirements), limitations, and number of bugs as the non-PBS, the option to have non-PBSed junctions must remain.
Until PBS has the same requirements (including memory and processor-power requirements), limitations, and number of bugs as the non-PBS, the option to have non-PBSed junctions must remain.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
hackykids choice was made because in hacykids implementation, PBS entrance signals ignored any Pre-signal status(actually, PBS ignores the signal state, so, you'd completly mess up the pre-signal junction if it were used.), however, what he didn't consider is that you might want to use pre-signals on the exit block, which did actually work.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
Well - with good pathfinder, which YAPF looks like being, comparing to NPF, one doesn't need any special/"PBS" signals.
Normal signals can easily act like "PBS"-implementation, but I guess that would be a suggestion for the YAPF topic...
Normal signals can easily act like "PBS"-implementation, but I guess that would be a suggestion for the YAPF topic...
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
- Jim Starluck
- Traffic Manager
- Posts: 135
- Joined: 26 Jun 2005 20:12
- Location: Cincinnati, OH
- Contact:
...that was pretty much what I was asking about.SirkoZ wrote:Well - with good pathfinder, which YAPF looks like being, comparing to NPF, one doesn't need any special/"PBS" signals.
Normal signals can easily act like "PBS"-implementation, but I guess that would be a suggestion for the YAPF topic...
If at first you don't succeed, get a bigger locomotive and try again.
I may be mistaken, but I don't believe I've actually seen KUDr say one word about PBS in relation with YAPF. When I asked directly, several people answered, but KUDr himself did not. Not even to comment on if he was planning on implementing PBS himself. This makes me believe that right now any information on the future of PBS is nothing but a rummor. The one thing he did say about NPF is that it WAS well designed, it was just slow.SirkoZ wrote:with good pathfinder, which YAPF looks like being, comparing to NPF, one doesn't need any special/"PBS" signals.
Now, if anyone has had a chat with KUDr on IRC or something, I'd love to hear about what he had to say himself.
-Hazelrah
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
PBS defintiyl will come, there are too many people wanting it for it to just die, its all just a matter of time.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
From what i can remember (which isn't usually that much!) KUDr started work on a shiny new working PBS implementation, and then gave up, due to the problems with NPF, I seem to recall him saying he was going to code a new pathfinder, which would be a solid foundation for the new PBS.
We Am De Best
Host of ThroughTheTube site
Host of ThroughTheTube site
- webfreakz.nl
- Director
- Posts: 627
- Joined: 11 Aug 2005 08:22
- Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
- Contact:
Exactly, and this new pathfinder has been called YAPF (Yet Another Path Finder)Sacro wrote:From what i can remember (which isn't usually that much!) KUDr started work on a shiny new working PBS implementation, and then gave up, due to the problems with NPF, I seem to recall him saying he was going to code a new pathfinder, which would be a solid foundation for the new PBS.

# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
sacro knew that, sacro is just a bit of a frube.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
Hazelrah: KUDr himself is not always watching IRC (not 24/7). Also if people already answered your questions why should i repeat it again and again? I guess that everybody who is really interested about PBS must already know the story. But, OK. I will recapitulate it here from very beginning step by step how it happened:I may be mistaken, but I don't believe I've actually seen KUDr say one word about PBS in relation with YAPF. When I asked directly, several people answered, but KUDr himself did not.
- i found OTTD
- i started to play OTTD instead of TTDP
- i have learned what PBS is
- i used PBS heavily as i love it
- it started to crash my trains and caused other troubles like unreversible trains and so on
- PBS was removed from the trunk due to such problems
- this event made many people (including me) unhappy
- so i started to work on it to repair some bugs
- i have learned that it contains lot of conceptual mistakes (not just bugs in the code)
- started to rewrite it (or more think about new design)
- learned that people want to have it NPF independent as NPF is slow
- learned that NTP is unusable for such feature
- after discussion with developers i decided to start with new pathfinder that will be PBS-able but faster than NPF
- after many many hours spent on it YAPF is finally in the trunk
- reopened discussion with Celestar and other people about PBS concept
- agreement that PBS should be common behavior of all signals
- agreement that we need to change the signalling concept from "driven by train movement" to "driven by train route plan" first
- now i am playing OTTD and thinking more about this concept
Current task is to change the signalling concept to reflect future needs and to avoid load balancing problems like two trains deciding for the same lane when the segment is free and then one of them enters it and another one must stop immediatelly. If train can open his path by talking to the next few signals (like "I would like to pass. Can I?") then we should have solved at least load balancing (and unrealistic train stops) and prepared ground for full PBS support in the near future. Then the biggest change from the user perspective will be, that the default signal state will be red and it will change to green only if train is comming.
I'm still trying to figure this one out, because TTDPatch is still using OPF (Original ...) to support PBS, and I would assume that NTP would be better the OPF, since it was implemented after OPF.KUDr wrote:12. learned that NTP is unusable for [PBS]
Am I incorrect in assuming that NTP is better than OPF[0], or have I made some other faulty assumption?
[0] This makes no sense either, though.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
DaleStan: I don't know how PBS is implemented in TTDP (i would like to know, but TTDP is one big magic for me). Anyway IIRC there were some limitations like max. number of crossings inside the block and that OPF was invoked multiple times to reserve path through all those crossings.
Simply: I don't want to implement new feature with such limitations. If using PBS signals would slow down the game signifantly (by invoking NTP many times) then it will be good candidate to be rewritten soon. I am not sure if it makes sense to develop such feature(s) and/or if developers would add such feature(s) into trunk. It could be good as proof of concept, but not as regular development task.
btw: if you know some background info how PBS is done in TTDP, I would appreciate some lesson (thanks in advance).
Edit: to your question if NTP is better than OPF: I guess so. As it always finds the proper path (if it exists).
But what is still missing there is the route recorder so the only information it returns is the next trackdir to be taken. Then i could imagine why PBS would need to call it multiple times to reserve one route. Changing NTP to be more flexible (whether to use or not to use PBS reservations in cost calculations, whether to record the path or not), then you probably would need to do it modular and the result will be another NPF. Believe me, i didn't want to reinvent the wheel.
Simply: I don't want to implement new feature with such limitations. If using PBS signals would slow down the game signifantly (by invoking NTP many times) then it will be good candidate to be rewritten soon. I am not sure if it makes sense to develop such feature(s) and/or if developers would add such feature(s) into trunk. It could be good as proof of concept, but not as regular development task.
btw: if you know some background info how PBS is done in TTDP, I would appreciate some lesson (thanks in advance).
Edit: to your question if NTP is better than OPF: I guess so. As it always finds the proper path (if it exists).
But what is still missing there is the route recorder so the only information it returns is the next trackdir to be taken. Then i could imagine why PBS would need to call it multiple times to reserve one route. Changing NTP to be more flexible (whether to use or not to use PBS reservations in cost calculations, whether to record the path or not), then you probably would need to do it modular and the result will be another NPF. Believe me, i didn't want to reinvent the wheel.
Talk to patchman. I can tell you what happens, but (with a few exceptions) not how or why it works.KUDr wrote:DaleStan: I don't know how PBS is implemented in TTDP (i would like to know, but TTDP is one big magic for me).
...
btw: if you know some background info how PBS is done in TTDP, I would appreciate some lesson (thanks in advance).
No. The limit is that no path can cross more than seven junction tiles. You can have as many junction tiles as you want in one block. And that is enough for the vast majority of junctions.KUDr wrote:Anyway IIRC there were some limitations like max. number of crossings inside the block
AIUI, twice. Once as-is (with red signals red and reserved paths reserved), and once optimal (all signals green and no paths reserved.) This is offset by the fact that OPF does not get called in a PBS junction; the saved path is simply played back.KUDr wrote:and that OPF was invoked multiple times to reserve path through all those crossings.
I would guess that patchman just tacked one on to OPF, but I don't know for sure.KUDr wrote:But what is still missing there is the route recorder
OPF's algorithm is a search of all possible paths from the current location. A path ends when one of the following is reached: 1) the destination, 2) the eighth junction tile, 3) the 65th tile, or 4) a red two-way signal[0]. The best path that gets to the destination, or failing that, the path that gets closest to the destination, is the path taken.
[0] A red two-way only ends the path if it is the first signal on that path, though.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
hello,
even if you need to perform deep change internaly. I think it would really be a bad idea to change visual aspect of signal.
it look so strange to have red signal every where, and the train arrive near the next signal, so it become green (?!) and stay green till the train reach next signal. and the next train will stop a green ?!
step 1
----####A-----[1]---------[2]--------
train A arrive to signal [1](become green). signal [2] is red.
step 2
-------#[1]###A----[2]-----
train A is passing on signal [1] (stay green)- train on same tile as [1]
but if now another train arrives near signal [1], signal is *green* but train must stop.
it's so strange....
I'm not a dev, I know you gives so much to this projet, KUDr, but sorry to say I find this idea a little bit weird.KUDr wrote:Then the biggest change from the user perspective will be, that the default signal state will be red and it will change to green only if train is comming.
even if you need to perform deep change internaly. I think it would really be a bad idea to change visual aspect of signal.
it look so strange to have red signal every where, and the train arrive near the next signal, so it become green (?!) and stay green till the train reach next signal. and the next train will stop a green ?!
step 1
----####A-----[1]---------[2]--------
train A arrive to signal [1](become green). signal [2] is red.
step 2
-------#[1]###A----[2]-----
train A is passing on signal [1] (stay green)- train on same tile as [1]
but if now another train arrives near signal [1], signal is *green* but train must stop.
it's so strange....
I think that KUDr meant that signals won't switch back to green if there isn't a train comming. LoMo does it this way too IIRC, it looks a bit weird at first but after a while it makes sense.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone

OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone







Conceptually, it's very simple. Call the pathfinder upon approach to the PBS signal, and record the route it finds if any. Then call it again ignoring reserved pieces and compare both routes; if the second is substantially cheaper we wait for those pieces to become available.DaleStan wrote:Talk to patchman. I can tell you what happens, but (with a few exceptions) not how or why it works.KUDr wrote:DaleStan: I don't know how PBS is implemented in TTDP (i would like to know, but TTDP is one big magic for me).
...
btw: if you know some background info how PBS is done in TTDP, I would appreciate some lesson (thanks in advance).
Then there are some decisions based on whether the PBS signal is red: if it's red, we wait if we couldn't find a route, if it's green we reserve any route through the block.
And that's just a limitation of TTD's original pathfinder implementation and could be fixed if needed. So far, there hasn't been a need.No. The limit is that no path can cross more than seven junction tiles. You can have as many junction tiles as you want in one block. And that is enough for the vast majority of junctions.KUDr wrote:Anyway IIRC there were some limitations like max. number of crossings inside the block
Indeed, that wasn't particularly hard either, it's about 5% of the total PBS code. Much more code is needed to reserve/unreserve pieces for all possible tile types, check their reversedness and so on.I would guess that patchman just tacked one on to OPF, but I don't know for sure.KUDr wrote:But what is still missing there is the route recorder
Who is online
Users browsing this forum: Google [Bot] and 13 guests