Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Feb 28, 2017 2:36 pm

All times are UTC




Post new topic  Reply to topic  [ 43 posts ]  Go to page 1 2 3 Next
Author Message
PostPosted: Wed Dec 02, 2009 1:13 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
This is a small patch that closes the level crossings on parallel tracks if a train is approaching, should make them a little safer for road vehicles.

note: this is a prototype, and known to break if you try too hard.

Update: New feature: road vehicles ignore closed crossings if they are already on a closed crossing (leads to fewer death traps, but you need to put path signals further away to allow more time for the crossing to clear)


Attachments:
adjacent_crossings_3_r22664.diff [4.2 KiB]
Downloaded 356 times

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Last edited by Eddi on Thu Jul 14, 2011 11:35 am, edited 1 time in total.
Top
   
PostPosted: Wed Dec 02, 2009 4:12 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Jul 17, 2007 1:36 am
Posts: 1231
Skype: moonray_zdo
Location: Teh matrix, duh.
Or, build a bridge for epic efficiency. :D

_________________
Formerly known as Sapphire United.

Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?


Top
   
PostPosted: Wed Dec 02, 2009 12:34 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Sep 16, 2005 12:23 pm
Posts: 1517
Skype: the_gremnon
Location: /home
Or tunnel.
But there are times when I'd prefer to use level crossings.
Problem still remains that RV's still get caught once in a while though, but a little fancy signalling solves that one.


Top
   
PostPosted: Wed Dec 02, 2009 12:49 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4517
Location: /home/sweden
I've looked at the code and to me it looks reasonable. Nice that you loop away from the current crossing so that it is not just the adjacent track but also the track adjacent to the adjacent track and so forth. Until bended crossings appear which could form cycles that is probably safe.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Wed Dec 02, 2009 12:56 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
Well, i know how to break it, even with existing crossings ;)

I'm not entirely sure how to handle map edges...

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Wed Dec 02, 2009 1:06 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4517
Location: /home/sweden
An additional condition in the for-loop? Eg && < map edge. If you instead of using the direction from the current tile (t), use the direction of the tile (function argument) tile, you could before the for loop cache which edge to check for and have just one edge-check. Or keep the robustness of the current code for future bending crossings and check for all four edges.

Code:
+   for (TileIndex t = tile; !is_forced && IsTileType(t, MP_ROAD) && IsLevelCrossingTile(t); t = TileAddByDiagDir(t, AxisToDiagDir(GetCrossingRoadAxis(t)))) {
+      is_forced |= CheckLevelCrossing(t);
+   }



Hmm, now I see each level crossing look around in the neighborhood if they should be forced to show red. Initially I though that a crossing looped over the neighbors and forced their barred status on the neighbors. That does however not really change anything fundamental.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Wed Dec 02, 2009 1:12 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
the first two loops look left and right, if any of the level crossings would be closed with the current check, then in the later two loops, it sets all level crossings to that state. [all closed if any should be closed, or all open if none should be closed]

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Wed Dec 02, 2009 8:55 pm 
Offline
Tycoon
Tycoon

Joined: Thu Apr 02, 2009 10:43 pm
Posts: 3008
Location: Massachusetts, USA
Sapphire united wrote:
Or, build a bridge for epic efficiency. :D

Eddi knows what he is doing, so making a patch like this has a reason.


Top
   
PostPosted: Sat Jul 31, 2010 1:56 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Is it planned to do sth with that kind of trap?


Attachments:
Przechwytywanie.PNG
Przechwytywanie.PNG [ 11.96 KiB | Viewed 12900 times ]

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Top
   
PostPosted: Sat Jul 31, 2010 4:17 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
needs road vehicles ignoring closed level crossings, if they are already on a closed level crossing.

i haven't digged that deeply into it yet, but it should be doable.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Sat Jul 31, 2010 10:08 pm 
Offline
Engineer
Engineer

Joined: Sun Feb 11, 2007 9:10 pm
Posts: 72
Location: Rotterdam, Netherlands
Eddi wrote:
needs road vehicles ignoring closed level crossings, if they are already on a closed level crossing.


It is very needed, because long trucks, buses and trams will then always be the loser. They do not fit between 2 rails.


Top
   
PostPosted: Tue Nov 30, 2010 7:59 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Thu Feb 26, 2009 9:17 am
Posts: 332
Skype: Aron Bogdan Silviu
Location: Torino, Italy
any update?

_________________
I was in:
Austria,Belgium,Brazil,China,France,Germany,Holland,Hungary,Italy,Luxemburg,Norway,Panamà,Poland,Romania,
Saudi Arabia,Slovenia,Spain,Switzerland,U.K.,Ukraine,U.S.A.


Top
   
PostPosted: Tue Nov 30, 2010 8:05 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
no, it would be announced here

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Thu Jul 14, 2011 11:36 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
i am pleased to announce an update at this time, which allows road vehicles trapped inbetween closed crossings to leave that crossing.

(patch in first post)

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Fri Jul 15, 2011 10:26 am 
Offline
Engineer
Engineer

Joined: Sun Aug 14, 2005 5:24 pm
Posts: 57
Effectivly making the crossing act like AHB/AOCB? You can't/shouldn't enter it, but you can leave it.


Top
   
PostPosted: Fri Jul 15, 2011 11:23 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
yes. this should help the issue that Kogut posted.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Fri Jul 15, 2011 4:25 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
I like this. Would be nice to have in trunk :D

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
PostPosted: Tue Jul 19, 2011 12:32 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6897
i promise i submit this for review as soon as some useful testing results come in ;)

savegames should be trunk-compatible (backwards and forwards)
(except some odd crossing being wrongfully closed, or some road vehicle crashing if it is unattended ;))

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Jul 19, 2011 11:15 pm 
Offline
Engineer
Engineer

Joined: Sun Aug 14, 2005 5:24 pm
Posts: 57
Since we can do lever things with level crossings and PBS (incuding making massive snaking tracks crossing competitor roads and taking possession over every crossing at once), can we get it to go the other way, if you have a vehicle on a crossing, ie stopped/broken down,it will set the signal to danger until it has cleared. This'd work quite well with the suggestions before of having yellow signals and braking distances.
There'd still be some risk of collision,but it would help reduce the occurance and make them act a bit more like AOCR which they seem to be emulating.


Top
   
PostPosted: Sat Jul 23, 2011 9:35 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4517
Location: /home/sweden
Here is a windows 32bit binary. Hope it helps for anyone who want to try out this patch and provide feedback to Eddi.


Edit: Updated the zip file, now including the actual exe file! :oops:


Attachments:
File comment: Only needed to read dump files when/if the binary crashes.
openttd.pdb.zip [3.72 MiB]
Downloaded 146 times
File comment: Win32 build using Visual Studio 2008, this time including the openttd.exe file! (that I forgot - see later posts)
adjacent_crossings_3_r22664_win32.zip [4.62 MiB]
Downloaded 152 times

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Last edited by Zuu on Mon Aug 01, 2011 4:17 pm, edited 1 time in total.
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 43 posts ]  Go to page 1 2 3 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.