Path Based Signalling!!! (pbs v080)

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
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Path Based Signalling!!! (pbs v080)

Post by Hackykid »

I've been working on path based signaling (a brilliant idea from the ttdpatch people) recently and i decided to post the patch here so people can test it, and help a bit with finding bugs of course :wink:

Path based signaling will allow more then 1 train on a junction at a time, provided their paths don't cross. This works by letting the trains 'reserve' the path they are planning to take. Reserved tracks are shown darker as normal tracks. (see screenshot)

You build such a PBS-junction by making all signals (entrance and exit) to that junctions PBS signals, you do this by ctrl-clicking 4 times on a normal signal.

For this patch to work, you need to put nsignalsw.grf (made by Michael Blunck) in your /data directory.
Get this file at Michael's site -> Download -> nsignalsw.zip , or in the 'new graphics' section at the TTDPatch Website.

Its best to only use 2-way signals at dead end exits, like terminus stations.

Also, PBS needs NPF (new pathfinder) enabled, otherwise it won't work.

Known bugs:
  • - the darkened track don't display 100% correctly on all tiles (not really a bug, just a gfx glitch)
    - [fixed] a crashed train wont release the tracks it has reserved
If you find any other bugs, post here or contact me at IRC.
Attachments
pbs8.zip
Windows build, based on r2470 (v080)
(1020.73 KiB) Downloaded 1759 times
pbs8.diff
The .diff, based on r2470 (v080)
(65.97 KiB) Downloaded 1421 times
Last edited by Hackykid on 21 Jun 2005 22:19, edited 58 times in total.
DopeFish Lives!!!
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Post by Horse »

Wow that seems great.

Maybe a new great featuere for this great game. :D
User avatar
Zahl
Engineer
Engineer
Posts: 27
Joined: 23 May 2004 13:19
Location: Germany
Contact:

Post by Zahl »

Could anyone compile it for win32? :)
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Post by Hackykid »

I have added a build for windows, see first post.
DopeFish Lives!!!
User avatar
Zahl
Engineer
Engineer
Posts: 27
Joined: 23 May 2004 13:19
Location: Germany
Contact:

Post by Zahl »

Thanks!

First impression is very good, this really could revolutionize railbuilding ;)
It seems in some cases reserved track won't be released after a train
used it. Most time this happened on big junctions/stations (used older
savegames), but I got this bug appear on a small junction,
see screenshot. The train will wait there forever.
Attachments
pbs-bug.png
pbs-bug.png (29.8 KiB) Viewed 37000 times
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Post by Hackykid »

hmm, yes, i see

Unfortunately i cant really see what would cause that from the screenshot.

Did you have NPF enabled? ( i forgot to mention this at first, but it is really needed)

Otherwise, i cant really see what could have caused this...

Hmm, i'll try building a similar setup and see if it happens to me too...

EDIT:
ok, i think i know what caused this

the problems started with the pieces of straight track between the station and the junction. because it has semaphores on each end, its treated as a pbs-block, and that setup can cause grid-locks.
This will lead to a train timing out at a signal and reversing, and reversing is not properly handled yet.

So, what you can do, it place a normal signal on those straight tracks, or remove the semaphores on the straight tracks.

Also demolishing a square (with the dynamite) and then rebuilding the track will reset the 'reserved' status.
Last edited by Hackykid on 12 Mar 2005 02:20, edited 2 times in total.
DopeFish Lives!!!
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

looking good, can't wait to try this out :mrgreen: (I'll wait until development is almost finished, I like my subsidiaries patch :oops: )

btw any hopes of getting this merged into the trunk when it's done? :roll:
Uncle Dex Says: Follow the KISS Principle!
tecxx
Engineer
Engineer
Posts: 106
Joined: 23 Jun 2003 19:31
Location: Tirol/Austria
Contact:

Post by tecxx »

hackykid, are the semaphore signals just for style or are they necessary? :=) (in other words: can i use normal signals?)
to everyone who's coding on openttd: YOU ROCK !!!
User avatar
StavrosG
Traffic Manager
Traffic Manager
Posts: 202
Joined: 13 Dec 2004 21:13
Location: Rodos, Greece
Contact:

Post by StavrosG »

I've noticed that, on a busy pbs block, if the (only)line a train entering the block is blocked (red signal at the exit), the train will go somewhere else, instead of just waiting, reverse when it has the chance, and come back to the junction.

Here's a pic:
The grain train on the junction is going to the left exit. When it entered the block, the signal was red because of the livestock train on the left, so the grain train went straight ahead. Shortly after, the signal went green so the train changed its path to go where it should. But if the track wasn't freed quickly enough, the train would continue to the wrong direction.
I should add that they don't go very far off to reverse, but still, its anoying.
Attachments
weird path
weird path
pbs-block.png (22.43 KiB) Viewed 36897 times
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Post by Hackykid »

hmm, yes, that is indeed a problem....

Ok, I've thought of a way too fix this, but it'll be a bit of work, I'll probably start working on it today.

Until its finished, I'll add this to the known bugs list.
DopeFish Lives!!!
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

tecxx wrote:hackykid, are the semaphore signals just for style or are they necessary? :=) (in other words: can i use normal signals?)
now here's something I would like to know aswell :roll:
Uncle Dex Says: Follow the KISS Principle!
User avatar
Zahl
Engineer
Engineer
Posts: 27
Joined: 23 May 2004 13:19
Location: Germany
Contact:

Post by Zahl »

OK, with normal signals on the track it works. Maybe tracks
with just 1 exit (2 ends) should never be treated as pbs junctions...
I also realized that removing reserved track does not work
(at least sometimes..) In the savegame from the example, I
tried to remove the dark track. I heard the removing-sound,
but the track was still there (only on the screen). when I
tried to remove it again, it said there is no track to remove.
Only demolishing works.

EDIT:
Got a similar problem to that of StavrosG. Same junction as
above, with signals on the straight track. One train coming from
the bottom wanted to go to the station. As the exit semaphore was red
because of another train on the track, the train reserved the track
to the exit top right. Just in that moment, the exit semaphore to the
station turned to green, so the train changed its way, but did not release
the old track.

Maybe a little workaround would be to auto-release reserved tracks after
let's say 30 seconds.

EDIT2: I was not able to reproduce this bug, maybe there were some
other circumstances.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Dextro wrote:
tecxx wrote:hackykid, are the semaphore signals just for style or are they necessary? :=) (in other words: can i use normal signals?)
now here's something I would like to know aswell :roll:
Currently you use Semaphore signals to identify a PBS block. So yes, they are neccessary!

When it's done it'll be merged.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Hackykid wrote:hmm, yes, that is indeed a problem....

Ok, I've thought of a way too fix this, but it'll be a bit of work, I'll probably start working on it today.

Until its finished, I'll add this to the known bugs list.
One algorithm that helped with this in TTDPatch PBS was to call the pathfinding twice, once the regular pathfinding, and once ignoring reserved pieces and red one-way signals. If the second call gives a much better (shorter) route, I tell the train to wait before entering the PBS block until this route becomes available, instead of taking the worse route right away.

Not sure if that's still feasible with OTTD's pathfinding, but it might be an idea to try.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Post by Hackykid »

Zahl wrote:Just in that moment, the exit semaphore to the
station turned to green, so the train changed its way, but did not release
the old track.
hmm, when a train changes its way, it should defenately release all tracks it had reserved previously, are you sure this is what happened?

I know about trains going the wrong way when the only singal leading to where they go is red, and I'm almost done with a fix for that, I'll probably post it tonight.
DopeFish Lives!!!
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

Darkvater wrote:
Dextro wrote:
tecxx wrote:hackykid, are the semaphore signals just for style or are they necessary? :=) (in other words: can i use normal signals?)
now here's something I would like to know aswell :roll:
Currently you use Semaphore signals to identify a PBS block. So yes, they are neccessary!

When it's done it'll be merged.
great, can't wait to get my subsidiaries with this :mrgreen:

It's a pity you need to use semaphores though, but I can understand why :?
Uncle Dex Says: Follow the KISS Principle!
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Post by Hackykid »

UPDATE:
new version (v050), the bug where trains would go the wrong way when the way they wanted to go was red, is fixed now,

look at the start post for the .diff and the windows build


btw, this version changes my implementation quite a bit, and has not been tested as extensively, so there *may* be more other bugs introduced by it.....
DopeFish Lives!!!
markr
Engineer
Engineer
Posts: 39
Joined: 05 Feb 2005 16:04

Post by markr »

Just tested this.

Looking good, but if a train breaks down at a certain point, the next train crashes straight into it.

In this savegame, the train on the LHS of the screen is just about to go through a red light, find a free path (which is covered by a broken train) and crash.

Mark
Attachments
test-pbs-3.sav
(70.31 KiB) Downloaded 675 times
User avatar
Hackykid
Traffic Manager
Traffic Manager
Posts: 157
Joined: 22 Nov 2004 16:04
Location: Eindhoven de Gekste!!! (ongeveer ;P)
Contact:

Post by Hackykid »

ah, well, your problem is not that trains are breaking down, but that they enter a pbs block without reserving tracks when they cant find a route to their destination.

You placed one of your signals the wrong way, which meant the train could not find a path.

I have now fixed this, trains who cant find their destination wont enter PBS-blocks. (v051)

The .diff and the windows build are in the start post.
DopeFish Lives!!!
User avatar
StavrosG
Traffic Manager
Traffic Manager
Posts: 202
Joined: 13 Dec 2004 21:13
Location: Rodos, Greece
Contact:

Post by StavrosG »

I've been suffering from a very nasty bug in v050, which ends in an Assertion fail:

Code: Select all

[16:06]stavrosg@lorien trunk$ ./openttd
openttd: train_cmd.c:2943: TrainCheckIfLineEnds: Assertion `trackdir != 0xff' failed.
Ακυρώθηκε
[16:50]stavrosg@lorien trunk$
Savegame + config file in archive: Watch Train 14.
Attachments
pbs_error2.tgz
(372.95 KiB) Downloaded 599 times
If ain't broken, don't fix it. | JabberID: stavrosg@jabber.org

Hello, I am a signature virus. Please copy me to your signature to help me spread.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 0 guests