Patch: another pbs for r11923

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

wolfc
Engineer
Engineer
Posts: 20
Joined: 27 Dec 2007 19:11

Patch: another pbs for r11923

Post by wolfc »

So here's my second patch: my version of path based signaling for rev 11828.
This is not the official PBS! For that look in the other thread.

It's very rough, so it needs a lot of testing. Do not use it for real play.

CHANGELOG:
0.2:
- better terminal handling (see pshemko-653484)
- depot servicing

0.3:
- more depot fixes (but it lead to regression)

0.4:
- improved handling of depots

TODO:
- patch setting
- pbs debug flag
- fixing routing problems
- old version save games
- tunnels & bridges (the trackcircuit is probably broken)
- stopping and reversing must clear block reservations
- forbid placing signals in reserved blocks (the easy solution :-) )

Start a new game if you want to try it out. There is no code yet to convert from an old save game (hence the train crash on the main menu :P ).
Attachments
pbs-0.2.patch
Path Based Signaling 0.2 rev 11760
(59.14 KiB) Downloaded 172 times
pbs-0.3.patch
Path Based Signaling 0.3 rev 11828
(63.98 KiB) Downloaded 163 times
pbs-0.4.patch
Path Based Signaling 0.4 rev 11923
(65.29 KiB) Downloaded 221 times
Last edited by wolfc on 19 Jan 2008 11:41, edited 8 times in total.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: another pbs for r11760

Post by Tekky »

That patch sounds interesting :) Is my assumption correct that your patch implements the old PBS system which only worked with NPF? Does your new PBS patch only work with NPF or also with YAPF?
wolfc
Engineer
Engineer
Posts: 20
Joined: 27 Dec 2007 19:11

Re: Patch: another pbs for r11760

Post by wolfc »

It's an extension of YAPF. Mostly it's an exercise to see how YAPF works and if YAPF is truly finished. :-D

It silently disables most of NPF and ordinary YAPF functions, because it doesn't contain a patch configuration button.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: another pbs for r11760

Post by Roujin »

okay, first off - i'm very happy to see someone working on PBS.

I tested your patch and found that trains sometimes drive on a track which has one way signals facing away from them, ignoring those signals completely. Is that maybe what you referred to as "routing problems"?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
wolfc
Engineer
Engineer
Posts: 20
Joined: 27 Dec 2007 19:11

Re: Patch: another pbs for r11760

Post by wolfc »

Nope, that's an actual feature as I read it from the PBS wiki.

In this patch trains try to find a stopping point (a signal or end-of-track) somewhere along the line. This can be through one-way signals (although at a penalty). So stations should not use entry/exit signals. Note that the platform itself is considered a shunting signal and thus has no route reserved to it (but to the signal or end-of-track after the station).
It takes some getting used to.

You can now also create a single line with two-way signals with one (or more) passing tracks. A train will only enter the single track if it can stop at the passing track (either by following another train or waiting for the coming train to pass).

Try to make your signaling as realistic as possible, forget about how current signaling is implemented.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: another pbs for r11760

Post by Tekky »

wolfc wrote:Nope, that's an actual feature as I read it from the PBS wiki.
Yes, I was the one who wrote that wiki article and in that article I also wrote that there should be some other way to mark track as one-way. Otherwise, there will be chaos if track cannot be marked as one-way :-) Maybe one could introduce a new single type with a "no-entry" sign on the other end to mark the track as one-way?

wolfc wrote:Note that the platform itself is considered a shunting signal and thus has no route reserved to it (but to the signal or end-of-track after the station). It takes some getting used to.
I like that idea. That means stations can be smaller because they don't require an additonal tile for the signal. Maybe one could also change the station graphics to display a red or green signal at both ends of the station platform?

wolfc wrote:You can now also create a single line with two-way signals with one (or more) passing tracks. A train will only enter the single track if it can stop at the passing track (either by following another train or waiting for the coming train to pass).
It was also possible to create single lines with passing tracks using the traditional OpenTTD signalling. However, this was done with single and not double signals. In what way do you use double signals for such layouts? I would appreciate it if you could post a screenshot of such a layout.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: another pbs for r11760

Post by Roujin »

Well i have read the wiki page now, but i still run into some problems.

appearently some reservations are not deleted properly, e.g. when there's a deadlock (yes, that happened in my test game. okay, maybe due to my poor signalling) and i reverse a train to try to clear it.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: another pbs for r11760

Post by Yexo »

Very good you picked up pbs. I would love to see pbs working in recent versions of OTTD. There are however still a few bugs in this patch. Two of my trains crashed when using a track like in the pbs wiki (link somewhere above), but that could also be because I don't understand how to place signals.
wolfc wrote:Nope, that's an actual feature as I read it from the PBS wiki.

In this patch trains try to find a stopping point (a signal or end-of-track) somewhere along the line. This can be through one-way signals (although at a penalty). So stations should not use entry/exit signals. Note that the platform itself is considered a shunting signal and thus has no route reserved to it (but to the signal or end-of-track after the station).
It takes some getting used to.

You can now also create a single line with two-way signals with one (or more) passing tracks. A train will only enter the single track if it can stop at the passing track (either by following another train or waiting for the coming train to pass).
Can you give an example image of such a layout?
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: another pbs for r11760

Post by Roujin »

ok, this seems to be very sensitive at the moment... i get the feeling that when i change something (add/remove signals) while trains are running, everything gets broken beyond repair
There should be some way do unreserve all paths (i think TTDPatch has a sigh cheat for that)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: another pbs for r11760

Post by Roujin »

After some more testing i have found out that tunnels and bridges will break things.

Here are three savegames for illustration.

How-To:
1) Load savegame
2) Click on depot
3) Click on "start all"- green flag
4) follow the trains and watch what happens

The three savegame are the same except for the fact that i've removed the tunnels for the second one, and tunnels and bridges for the third one. When there are no more tunnels and bridges, it works. But with tunnels and/or bridges everything after the first train gets stuck for some reason.


loaded newgrfs:
Total Town Replacement Set
DBXL Set
Attachments
PBStest_broken.sav
Savegame 1: trains get stuck
(378.57 KiB) Downloaded 138 times
PBStest_notunnel.sav
Savegame 2: tunnels removed, trains still get stuck
(379.2 KiB) Downloaded 151 times
PBStest_notunnel_nobridge.sav
Savegame 3: tunnels and bridges removed, now no more stuck trains
(380.11 KiB) Downloaded 138 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
pshemko
Engineer
Engineer
Posts: 104
Joined: 24 Sep 2004 02:43
Location: Aotearoa (New Zealand)

Re: Patch: another pbs for r11760

Post by pshemko »

I think, that trains should be allowed to crash when you remove signals - all the reservations should be made invalid and the trains should start straight away. Exactly the same behaviour can be seen with existing signals. Adding signals on a path that is already reserved should be forbidden - 'can't place signals here - train in the way' message would be perfect in such situation.

I started testing the patch, and I didn't manage to get even the simplest setup going. See attachments below.
In img1 everything looks ok.
img1.PNG
img1.PNG (40.2 KiB) Viewed 7638 times
In img2 for some reason trains A got green light entering for entering the station, which clearly shouldn't happen.
img2.PNG
img2.PNG (41.53 KiB) Viewed 7632 times

In img3 train B patiently waits for train A to crash into it :?
img3.PNG
img3.PNG (40.02 KiB) Viewed 7635 times
The reservation should be cleared after some time. I've noticed that if trains crash the reservations don't get released, the only way to get it sorted is to demolish the track and build a new one.

It looks very promising. Keep up the good work.
wolfc
Engineer
Engineer
Posts: 20
Joined: 27 Dec 2007 19:11

Re: Patch: another pbs for r11760

Post by wolfc »

pshemko wrote:I started testing the patch, and I didn't manage to get even the simplest setup going. See attachments below.
In img1 everything looks ok.
img1.PNG
In img2 for some reason trains A got green light entering for entering the station, which clearly shouldn't happen.
img2.PNG

In img3 train B patiently waits for train A to crash into it :?
img3.PNG
LOL, it's because I force trains into terminals. Probably it's the one tile in between the signal and the station that chokes it.
The logic is: find end-of-block, if end-of-block != signal && trackcircuit = !occupied => green. Problem is that that single tile probably constitutes a trackcircuit.

There are some weird things in YAPF for handling stations, for I don't get all station tiles back from the pathfinder. Thus I can't thrust a reservation in a station. (As a bonus it means stations are shunting points :-) )
wolfc
Engineer
Engineer
Posts: 20
Joined: 27 Dec 2007 19:11

Re: Patch: another pbs for r11760

Post by wolfc »

Tekky wrote:
wolfc wrote:Nope, that's an actual feature as I read it from the PBS wiki.
Yes, I was the one who wrote that wiki article and in that article I also wrote that there should be some other way to mark track as one-way. Otherwise, there will be chaos if track cannot be marked as one-way :-) Maybe one could introduce a new single type with a "no-entry" sign on the other end to mark the track as one-way?
I was thinking more in the lines of an "limit-of-shunt" indicator. Image It is not really the same, but will serve it's purpose for now.

Currently passing a reverse signal has the look-ahead penalty, so a train won't prefer that way. If you have long pieces of track you'll see what I mean. You need a couple of trains stopped on the other track before the reverse line is being used.
Tekky wrote:
wolfc wrote:Note that the platform itself is considered a shunting signal and thus has no route reserved to it (but to the signal or end-of-track after the station). It takes some getting used to.
I like that idea. That means stations can be smaller because they don't require an additonal tile for the signal. Maybe one could also change the station graphics to display a red or green signal at both ends of the station platform?
Usually you won't see any signals on a platform, any that you see are considered main signals. On modern stations there is however an indicator that shows whether a train is allowed to leave (mostly for the conductor, so he knows to close up shop). This indicator is however a repeating signal of the main signal. So I would not put any graphic there.
pshemko
Engineer
Engineer
Posts: 104
Joined: 24 Sep 2004 02:43
Location: Aotearoa (New Zealand)

Re: Patch: another pbs for r11760

Post by pshemko »

Ok, I did some more testing. This time I removed the additional tiles between the signals and the station. And it helped, but not entirely: the train next to the depot gets green light to drive into the station:
img2-1.png
img2-1.png (39.79 KiB) Viewed 7566 times
and then turns into the train that's leaving the station:
img2-2.png
img2-2.png (37.03 KiB) Viewed 7564 times
I've also attached the savegame. No additional grfs required.

There also seems to be a problem with depots. Leaving trains don't seem to take the existing reservation into consideration.
Attachments
pre-crash.sav
(170.7 KiB) Downloaded 131 times
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Patch: another pbs for r11760

Post by Draakon »

wolfc wrote:YAPF works and if YAPF is truly finished
YAPF if finished!
wolfc
Engineer
Engineer
Posts: 20
Joined: 27 Dec 2007 19:11

Re: Patch: another pbs for r11760

Post by wolfc »

Draakon wrote:
wolfc wrote:YAPF works and if YAPF is truly finished
YAPF if finished!
I beg to differ. If it were finished I wouldn't have had to change it.
First of all YAPF does not provide a complete path. It directs the train towards it's destination and counts on the signaling mechanism (which has very old style path following) to actually route the train.
Second some of the YAPF templates are not extendable. That's an easy change though. There are some extra functions required as well.
Third YAPF has some quirks when it comes to stations. Instead of properly designating the end of a platform as a destination it's hacked into the track follower.

Maybe it's because I had expected a router, but got a (limited) path finder. Anyway the point is moot as such, because I got an (almost working) router now. ;-)
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Patch: another pbs for r11760

Post by Draakon »

I beg to differ. If it were finished I wouldn't have had to change it.
Everything in the trunk needs to be changed in order to make something to work.
First of all YAPF does not provide a complete path. It directs the train towards it's destination and counts on the signaling mechanism (which has very old style path following) to actually route the train.
Thats the point of YAPF
Second some of the YAPF templates are not extendable. That's an easy change though. There are some extra functions required as well.
A feature does not work if it is missing something in order for it to work.
Third YAPF has some quirks when it comes to stations. Instead of properly designating the end of a platform as a destination it's hacked into the track follower.
Train needs to know a route back to station A too.
Devs and other members have said it too that YAPF is done.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: another pbs for r11760

Post by Roujin »

wolfc: have you read (and maybe confirmed) my last post?
Roujin wrote:After some more testing i have found out that tunnels and bridges will break things.
anyone else tried out something with bridges/tunnels and ran into problems aswell?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
pshemko
Engineer
Engineer
Posts: 104
Joined: 24 Sep 2004 02:43
Location: Aotearoa (New Zealand)

Re: Patch: another pbs for r11760

Post by pshemko »

Yeap, I have an issue here:
img3-1.PNG
img3-1.PNG (107.1 KiB) Viewed 7081 times
Train be B will remain in front of the signal forever. If I remove the cross-over after the bridge (and restart the whole setup) the train gets stuck regardless. The only way to fix it is to shorten the bridge and put the signals behind the cross-over where B is stuck, so the bridge is not part of the 'reserved' zone.

The same situation occurs with tunnels:
img3-2.png
img3-2.png (123.51 KiB) Viewed 750 times
Train A gets stuck in front of the signal. The only way to help the situation - place signals in spot '1'.

Savegame attached (no additional grfs required)
Attachments
t2.sav
(67.26 KiB) Downloaded 150 times
squishycube
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 05 Oct 2003 14:51
Location: Amsterdam
Contact:

Re: Patch: another pbs for r11760

Post by squishycube »

Keep up the good work, I can't wait for PBS to get in to trunk!
I heard the stories that they tell of how they labored for this company which sold it's soul to hell

It's my alter ego in my avatar, not me!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 24 guests