Road Vehicles constantly take the "Unsafe route".

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Road Vehicles constantly take the "Unsafe route".

Post by Invisble »

At the moment in one of my games, I have 2 fairly large cities whoch have started to merge, I have running between them a fairly decent bus and mail service, and inbetween the two cities I have a series of rail tracks that hold A LOT of traffic.

Now because I dont want to lose any vehicles, I have built bridges over the tracks (of which I have about 6 running parrallell), but the town councils are building roads to each other, crossing the tracks.

N9ow my bridges are set at such a posistion as to make the crossing over the tracks from one stop to the other quickly and safely, but my busses and mail trucks keep on using the town council roads that cross the tracks, with predictable results. I lose on average 4-5 busses/trucks a year, which is rather annoying.

Now I understand there is a penality for the slope on the bridge, that I have no propbles with, because that just stops you building stupid bridges that dcross nothing, however when it comes to a situation as described above, is it possible to add a "safety" penality where the more tracks a road crosses, the higher the penalty, which would force the busses to use the bridges? Unless of course there is a 2nd "safe" route which has no slopes or rail tracks and is still in the right direction?

I would attempt to do this myself, but what I know of C is next to nothing and it would probably take me about a year to get up to the required standard to be able to program in such a feature.
User avatar
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

Well you are in luck, peter1138 made a patch that does exactly this. I will give him a shout to come and tell you more. :D

Here is a link to his test version, I am sure he won't mind me posting it here (if you do Peter, errr, it wasn't me!):
http://petern.bucks.net/ottd/npf_crossing_penalty.diff

So just apply that, compile and enjoy!
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1771
Joined: 30 Mar 2005 09:43

Post by peter1138 »

We're tweaking the value of the penalty at this moment... 800-1000 seems to work better...
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Post by Invisble »

lucaspiller wrote:Well you are in luck, peter1138 made a patch that does exactly this. I will give him a shout to come and tell you more. :D

Here is a link to his test version, I am sure he won't mind me posting it here (if you do Peter, errr, it wasn't me!):
http://petern.bucks.net/ottd/npf_crossing_penalty.diff

So just apply that, compile and enjoy!
Just one little problem, for some reason I cannot compile the source (not even the latest version), this is despite the fact that I am following the instructions in the Wiki to the letter.

When I tell it to make, well it compiles everything BUT openttd.exe, it stops on that saying there is 1 error.

Before that it goes "linking to openttd.exe" and then has a series of errors to do with saveload.c

what I get is as follows

Code: Select all

===> Linking openttd.exe
saveload.o(.text+0x10ed):saveload.c: undefined reference to `inflateInit_@12'
saveload.o(.text+0x115e):saveload.c: undefined reference to `inflate@8'
saveload.o(.text+0x11ca):saveload.c: undefined reference to `inflate@8'
saveload.o(.text+0x120b):saveload.c: undefined reference to `inflateEnd@4'
saveload.o(.text+0x1266):saveload.c: undefined reference to `deflateInit_@16'
saveload.o(.text+0x12f2):saveload.c: undefined reference to `deflate@8'
saveload.o(.text+0x13b4):saveload.c: undefined reference to `deflateEnd@4'
saveload.o(.text+0x13f4):saveload.c: undefined reference to `deflateEnd@4'
collect2: ld returned 1 exit status
make: *** [openttd.exe] Error 1
and no openttd.exe is produced (this is being compiled without any diff's installed or any changes made to the makefile.config apart from to make sure it looks like that of the wiki).
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Seems you didn't install the zlib library properly... are you sure you have it?
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Post by Invisble »

seems I may have mis installed the zlib files. Just did a re-install of them and it works fine now. cheers.
User avatar
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

The best values we found for npf_crossing_penalty in the openttd.cfg are:
- 601 to take a 4 tile detour to go over a bridge
- 801 to take a 6 tile detour to go over a bridge
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1771
Joined: 30 Mar 2005 09:43

Post by peter1138 »

I'm going for 601 now, as if it is a double track (which is most often ime) the combined penalty will make it go quite a way off.

On the another hand, this is handy as double crossings are also more dangerous (mmm, queued broken down vehicles...)
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1771
Joined: 30 Mar 2005 09:43

Post by peter1138 »

Here's an updated version for current SVN. It renames the parameter to be more meaningful as well...
Attachments
npf_level_crossing_penalty.diff
NPF level crossing penalty
(1.71 KiB) Downloaded 103 times
User avatar
latinoloco
Transport Coordinator
Transport Coordinator
Posts: 315
Joined: 24 Apr 2005 23:06
Location: Sydney, Australia

Post by latinoloco »

It would compile it, but i dont know how. But even if i could get it to work, id have to have 2 versions of ottd, one for multi, and one for single. But i sure hope it gets into the next version of ottd, with options about the penalties...
MEMBER 6772
Image
ledow
Engineer
Engineer
Posts: 32
Joined: 08 Sep 2004 10:36
Contact:

Post by ledow »

This is just one of the reasons that I wanted this feature request to be implemented:

http://ledowopenttd.blogspot.com/2005/0 ... -tile.html
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 0 guests