Signals in tunnels and on bridges V3.02 r24031

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

Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: signals in tunnels V12 r15755

Post by Eddi »

you're probably searching for the "chunnel" patch.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15755

Post by HackaLittleBit »

simplexio wrote: Any idea where to find patch that enables tunnels under sea. It would be much better idea to build tunnels under sea that those slow bridges.
http://www.tt-forums.net/viewtopic.php? ... 75&start=0

The patch was split in three see first message.
You can find instructions in the above link.

Updated patch to trunk

Regards HackaLittleBit
User avatar
Kanibal
Traffic Manager
Traffic Manager
Posts: 159
Joined: 25 Jan 2005 20:08
Contact:

Re: signals in tunnels V12 r15755

Post by Kanibal »

If thats included in the version up for download at the moment (in the zip) then I must be doing something stupid because I copied that exactly and, nothing. It just builds the 3 tile tunnel to the sea edge.
Image
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15755

Post by HackaLittleBit »

Kanibal wrote:If thats included in the version up for download at the moment (in the zip) then I must be doing something stupid because I copied that exactly and, nothing. It just builds the 3 tile tunnel to the sea edge.
:oops: Your right, last release does not include that feature .
Give me some time (dinner time) and I will correct it.
Sorry for the inconvenience.

EDIT check first page for latest update

Regards.
User avatar
Kanibal
Traffic Manager
Traffic Manager
Posts: 159
Joined: 25 Jan 2005 20:08
Contact:

Re: signals in tunnels V12 r15833

Post by Kanibal »

No inconvenience, I just thought I was going a bit loopy for a while there.

You're patches are the most notable ones out there, your work is much appreciated and seems brilliantly stable, calling them hacks doesn't change their brilliant addition to the game. I hope you keep it up, and that someone keeps posting windows binaries so I can test them out, or posts nice detailed instructions how I can complie them on my linux computers.
I'd love to help test out new patches of yours, really great leaps forward.

Looking forward to more,

~Kan
Image
User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Re: signals in tunnels V12 r15833

Post by Timitry »

...or posts nice detailed instructions how I can complie them on my linux computers.
http://wiki.openttd.org/Coding_Tools#Linux
User avatar
Kanibal
Traffic Manager
Traffic Manager
Posts: 159
Joined: 25 Jan 2005 20:08
Contact:

Re: signals in tunnels V12 r15833

Post by Kanibal »

I must be having a bad couple of days, how come I never found that before, dunno. Thanx for the link though, much appreciated.
Image
Iguanna
Engineer
Engineer
Posts: 100
Joined: 21 Nov 2007 00:06

Re: signals in tunnels V12 r15833

Post by Iguanna »

I would like to use this in a network I'm building since there are places where I need like 5 or more tunnels to allow traffic to pass under something, and with this I can use just one. But as it is now I can't because the presignals don't work through the tunnels if it the patch is enabled. A lot of the time, if I'm making something complicated, there's no option except to run presignals through tunnels, as you can't put bridges over other bridges or stations etc.

Would it be possible to allow presignals to 'see' through the tunnels as the do normally?

Also one other thing I noticed, it seems the option setting is not saved and loaded with the save games, which I think you would want, since things aren't going to run very well if someone loads made with the patch and the setting off. Is this just disabled for now to keep the savegames compatible?

BTW It's exciting to think how much smaller it will be possible to build stuff using this patch, thanks for putting it together, I'm looking forward to playing around with it :)
Roye
Engineer
Engineer
Posts: 2
Joined: 25 Mar 2009 16:13
Location: Aurskog, Norway

Re: signals in tunnels V12 r15833

Post by Roye »

Does this patch work on 0.7.0?
Does it work on prev savings, cant make the trains to go in a tunnel without the first has exited :cry:
Am I doing anything wrong?
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15833

Post by HackaLittleBit »

IguannaB wrote: Would it be possible to allow presignals to 'see' through the tunnels as the do normally?
IguannaB Do me a favor and post a picture of your track situation.
I am still testing and yes in a way it is possible to look through the tunnel.
If you look at the code in signal.cpp you can see that I changed this line to avoid a loop while building a tunnel in a rail circle

Code: Select all

					if (_settings_client.gui.simulate_signals_in_tunnel && IsTunnel(tile)) continue;  // avoid loop
if you would take that line out your request would be honored. The thing is that I do not know an other way of preventing that loop.(nice way)
Kanibal wrote:the option setting is not saved and loaded with the save games
No not in experimental feature.
Roye wrote:Does this patch work on 0.7.0?
Don´t know I work with trunk.
Roye wrote:Does it work on prev savings, cant make the trains to go in a tunnel without the first has exited :cry:
Am I doing anything wrong?
Are you using block signals?
Did you enable the patch?
Tell me more about that one please.

regards
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: signals in tunnels V12 r15833

Post by Wolf01 »

hackalittlebit wrote: if you would take that line out your request would be honored. The thing is that I do not know an other way of preventing that loop.(nice way)
I don't remember it well, but Owens (not ORudge) might know a nice solution, he played around with "not" signals (signals being green when the next signal is red) and he found that circular loops are a bad idea in this kind of experiments
I think he limited the number of signals to look through, but I might confuse it with the solution I suggested him
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15833

Post by HackaLittleBit »

Thanks Wolf01

Am banging my head already a while on that one. (waiting for the eureka, but it did not come yet :cry: )
The code without that line is much nicer but I would like to avoid a ugly counter and extra global var.
Iguanna
Engineer
Engineer
Posts: 100
Joined: 21 Nov 2007 00:06

Re: signals in tunnels V12 r15833

Post by Iguanna »

hackalittlebit wrote:If you look at the code in signal.cpp you can see that I changed this line to avoid a loop while building a tunnel in a rail circle

Code: Select all

					if (_settings_client.gui.simulate_signals_in_tunnel && IsTunnel(tile)) continue;  // avoid loop
if you would take that line out your request would be honored. The thing is that I do not know an other way of preventing that loop.(nice way)
What is the problem with the loop?
When I commented out this line it behaved normally and I couldn't find any problems (program hanging or otherwise). The way the combo signals stay green if they can 'see' themselves due to being in a circle of track is normal, and can also be useful (example of this being used in pic at bottom).
Attachments
Looping presignal through tunnels.PNG
Looping presignal through tunnels.PNG (79.51 KiB) Viewed 6160 times
Example of something using combo in loop.PNG
Example of something using combo in loop.PNG (83.83 KiB) Viewed 6157 times
Roye
Engineer
Engineer
Posts: 2
Joined: 25 Mar 2009 16:13
Location: Aurskog, Norway

Re: signals in tunnels V12 r15833

Post by Roye »

hackalittlebit wrote:
Roye wrote:Does this patch work on 0.7.0?
Don´t know I work with trunk.
Roye wrote:Does it work on prev savings, cant make the trains to go in a tunnel without the first has exited :cry:
Am I doing anything wrong?
Are you using block signals?
Did you enable the patch?
Tell me more about that one please.

regards
I am a very big noob :) on patch use in general, and theres is so much to read and search through to find answers, so I just downloaded the file and placed it in"data"-folder in my openTTD and hoped it would work :).

Can you please tell me how to make it work?

Thx.
Roye
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15833

Post by HackaLittleBit »

IguannaB wrote:What is the problem with the loop?
See pic
loop2.png
loop2.png (9.8 KiB) Viewed 6148 times
IguannaB

Will give more comprehensive answer, give me time to test etc.

Tested this and that works.
Train stops in front of pre signal until other train left station.
presignal.png
presignal.png (38.52 KiB) Viewed 6149 times
Regards
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15833

Post by HackaLittleBit »

Roye wrote: I am a very big noob :) on patch use in general, and theres is so much to read and search through to find answers, so I just downloaded the file and placed it in"data"-folder in my openTTD and hoped it would work :).

Can you please tell me how to make it work?
Hmmmmm scratch scratch.

Copy OPENTTD folder to let say "test" folder
unzip the zip file and copy content over your "test" folder. should work
(windows OS)

Regards. :mrgreen:

EDIT changed IguannaB in Roye
sorry IguannaB
Last edited by HackaLittleBit on 07 Apr 2009 10:26, edited 2 times in total.
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: signals in tunnels V12 r15833

Post by Wolf01 »

IguannaB wrote:
hackalittlebit wrote:If you look at the code in signal.cpp you can see that I changed this line to avoid a loop while building a tunnel in a rail circle

Code: Select all

					if (_settings_client.gui.simulate_signals_in_tunnel && IsTunnel(tile)) continue;  // avoid loop
if you would take that line out your request would be honored. The thing is that I do not know an other way of preventing that loop.(nice way)
What is the problem with the loop?
When I commented out this line it behaved normally and I couldn't find any problems (program hanging or otherwise). The way the combo signals stay green if they can 'see' themselves due to being in a circle of track is normal, and can also be useful (example of this being used in pic at bottom).
Ehm, I don't want to be too much pernickety, but placing signals that way is enough aleatory, you can make "memory" cells so signals stay red without being connected to a piece of track with a train on it
This might be achieved in various ways, I let you the pleasure to discover all of them, and I think this is a bug of the signalling system.
Attachments
signal_bug.PNG
signal_bug.PNG (42.75 KiB) Viewed 6036 times
Iguanna
Engineer
Engineer
Posts: 100
Joined: 21 Nov 2007 00:06

Re: signals in tunnels V12 r15833

Post by Iguanna »

hackalittlebit wrote:
IguannaB wrote: I am a very big noob :) on patch use in general, and theres is so much to read and search through to find answers, so I just downloaded the file and placed it in"data"-folder in my openTTD and hoped it would work :).
Can you please tell me how to make it work?
Um, that was Roye that said that not me, actually I'm not that big, more kinda skinny ;)

hackalittlebit: Yeah, I should have tested with train running in the loop, it hangs without that line I see. The code went a bit over my head, but I did notice it was ok if using 2way signals in place of tunnel entrance and exit, so wondered what is different between the 2 scenarios, or if the tunnels could be made more like the signals to avoid the issue.
Would using a recursive function where the list of tile+trackdirs already visited is passed as an argument instead of a while loop help solve the endless looping problem? Just an idea - I don't really understand what's going on so can't help much, sorry. If you would like to explain it some more, maybe I can though.

Wolf01: Thanks for your advice, it's always welcome and I don't think you're being pernickety (I had to look that word up, and aleatory too, damn it) :).
In the case above, it's not memory cells I'm using the combo in a loop for, but a timer. It's setup so you can spin the exit signal and stop the timer, however problems arise if the green presignal 'pulse' from the timer is interrupted (turns red) too soon as trains elsewhere stop at signals which they would otherwise have passed. The combo in a loop holds the presignal output green until the timer train enters that part of the timer where the 'pulse' would be red, preventing this problem, so you can spin the exit signal to stop it any time. I don't see this behavior as a bug - combos are red if all presignals they can see (including them selves) are red, otherwise they're green, which makes logical sense to me.
Attachments
test.PNG
test.PNG (36.68 KiB) Viewed 5991 times
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels V12 r15833

Post by HackaLittleBit »

Wolf01 wrote:Um, that was Roye that said that not me, actually I'm not that big, more kinda skinny
Yeah saw it and changed it. Sorry about that one.

Solved loop problem.
Expresso wrote:Isn't it better to make a tunnel have signals in it by letting the player build a signal on the tunnel entrance?
see http://www.tt-forums.net/viewtopic.php?p=754430#p754430

Now that is possible.
Very experimental just pretend your building signal on tunnel or bridge entrance
will set bit class 9 m5 bit 5 now the tunnel bridge will behave as if it has signals.
remove signal from entrance will revert this behavior.

please give suggestions and find bugs.

This is experimental code and most probably I will remove the signal bridge simulation.
But it is for you to get a taste of what is possible.

Happy Easter everybody

HackaLittleBit
Attachments
signaltunnel_V15_r16034.patch
(20.13 KiB) Downloaded 210 times
bridgesig.png
bridgesig.png (41.7 KiB) Viewed 5783 times
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: signals in tunnels and on bridges V16 r16138

Post by HackaLittleBit »

Hello folks.

My patch is starting to become ready to go to flyspray.
I have no known bugs.
The patch starts to have a solid feeling :D (thanks Smatz)
Now you can designate individually a bridge or tunnel with signal simulation.
Just use the signal building tool and click on the tunnel, bridge entrance.(cost is length / 4)
Image
distance.png
distance.png (12.49 KiB) Viewed 5491 times
just to give you an idear of the distance 8 tiles.
The patch is designed to take as little processor time as possible.
I have been thinking about the developers and I am hopeful that they include my patch.
In the future when real signals will be possible I think that it will be more processor demanding so this is a nice alternative.
It leaves a minimal footprint on the signal code and non on the pathfinding code.

Before I submit I would like to know any of your wishes and suggestions.
See my wiki for a more detailed descriptionhttp://wiki.openttd.org/User:HackaLittleBit
In my first post you can find win binary and latest patch.

Have fun and regards
HackaLittleBit
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 38 guests