YAPF - Testers needed!

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

frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Post by frosch »

There is a problem with relocating waypoints:
1. Two parallel tracks. One with a waypoint.
2. Now remove the waypoint, and place it on the other track, so it takes over the sign.
3. All trains that were heading to the waypoint now still head towards the tile, where the waypoint was before. When they pass through the tile they skip to the next order. (Attachment 1)
4. But if you remove the track (Attachment 2) the train gets lost. It will continue searching the waypoint even if it directly passed through it.
5. You can even rebuild the removed track, and the train will again go through the old waypoint tile, and go to the next order.
6. The train works correctly again, if you skip the waypoint order. Next time in the loop it will choose the correct way.

Note: This problems applies both to YAPF and NPF, but not for the original pathfinder. So I think this is a YAPF problem. The problem was reported before in http://www.tt-forums.net/viewtopic.php?t=19212, but I think it was not understood.
Attachments
The train passes through the new waypoint without recognising it
The train passes through the new waypoint without recognising it
waypoint_after2.png (174.6 KiB) Viewed 892 times
The train chooses the path to the old tile of the removed waypoint
The train chooses the path to the old tile of the removed waypoint
waypoint_after1.png (182.12 KiB) Viewed 914 times
KUDr
OpenTTD Developer
OpenTTD Developer
Posts: 219
Joined: 11 Jan 2006 21:36
Location: Czech Republic

Post by KUDr »

frosch: thanks. Fixed:
[00:41:28] <CIA-1> KUDr * r7519 /trunk/waypoint.c: -Fix: [YAPF] Cache was not deleted when waypoint was built or removed (frosch)
User avatar
Dan
Route Supervisor
Route Supervisor
Posts: 472
Joined: 11 Oct 2003 19:26
Location: Georgia, U.S.A.

Post by Dan »

I think ths project is great, it really helps the load on my older computers and works fine 99% of the time, good work!

I also found some settings that are better suited to realistic acceleration off if anyone is interested:

Code: Select all

rail_slope_penalty = 600
rail_curve45_penalty = 100
rail_curve90_penalty = 200
╔═════════════════╗
║░ГЯΔИ$PØЯГ Г¥¢ØØИ!░║
║▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒║
║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓║
║▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒║
║░░░░░░░░░░░░░░░░░║
╚═════════════════╝
Ertai_Wizard_Adept
Engineer
Engineer
Posts: 5
Joined: 18 May 2004 23:47
Skype: Ertai_Wizard_Adept
Location: Ceska Trebova (CZE) or Madison (USA)
Contact:

Train not going to depot

Post by Ertai_Wizard_Adept »

I'm not sure if this is a YAPF problem, but I think it is. Or maybe YAPF works differently, in which case I'm probably gonna have to go read some docs to see how to make this work the right way.
I have a train that was last serviced more than a year ago (not_going_to_depot2.png). It is approaching a side line that has a depot on it and then joins the main line (for the purpose of not slowing down the main line, but that's off topic). But the train, even though it should be serviced cause the 120-day servicing interval has long expired, zooms past this side line and keeps going on the main line (not_going_to_depot3.png).
This doesn't happen if I turn off YAPF for trains. You can try it in the attached savegame. The train has number 44.

So, is this a YAPF problem or is YAPF working differently and my strategy with depots on sidelines isn't gonna work?
Attachments
After
After
not_going_to_depot3.png (203.75 KiB) Viewed 814 times
Before
Before
not_going_to_depot2.png (199.54 KiB) Viewed 836 times
Not Finding Depot.sav
The savegame
(397.24 KiB) Downloaded 411 times
KUDr
OpenTTD Developer
OpenTTD Developer
Posts: 219
Joined: 11 Jan 2006 21:36
Location: Czech Republic

Post by KUDr »

Ertai_Wizard_Adept: try to make the line for entering depot bit shorter. There is built-in limit for distance when searching for depot set to 16 straight tiles (any curve makes it virtually longer).
Ertai_Wizard_Adept
Engineer
Engineer
Posts: 5
Joined: 18 May 2004 23:47
Skype: Ertai_Wizard_Adept
Location: Ceska Trebova (CZE) or Madison (USA)
Contact:

Post by Ertai_Wizard_Adept »

Tried that and it fixed the problem for that case. I think it was 17 tiles. I knew about the 16-tile lookahead, but wasn't sure how much diagonal tracks were, whether one tile or half-tile. Anyway, here's another save (train 33 this time) where the same thing happened. The distance is definitely <16 tiles here. The train is about 60 days overdue for service.

[Edit]Darkvater: deleted attachment.
Last edited by Ertai_Wizard_Adept on 10 Jan 2007 22:59, edited 1 time in total.
Ertai_Wizard_Adept
Engineer
Engineer
Posts: 5
Joined: 18 May 2004 23:47
Skype: Ertai_Wizard_Adept
Location: Ceska Trebova (CZE) or Madison (USA)
Contact:

Post by Ertai_Wizard_Adept »

Tried that and it fixed the problem for that case. I think it was 17 tiles. I knew about the 16-tile lookahead, but wasn't sure how much diagonal tracks were, whether one tile or half-tile. Anyway, here's another save (train 31 this time) where the same thing happened. The distance is definitely <16 tiles here. The train is about 60 days overdue for service. And again, if I turn off YAPF, the train goes to the depot. With YAPF it doesn't.

I should probably mention I'm using RC3. Forgot to say that in the previous post.
Attachments
No depot 2 maybe.sav
The save. Train 31 this time.
(400.71 KiB) Downloaded 335 times
KUDr
OpenTTD Developer
OpenTTD Developer
Posts: 219
Joined: 11 Jan 2006 21:36
Location: Czech Republic

Post by KUDr »

same problem. Shorter than 16 if you count only tiles. But you must add 6 tile penalty for 2 uphill tiles. And remember that train tries to locate the nearest depot once per day. So if it is too far away one day it can miss the choice because of this period. Probably i will need to make this distance longer for you :)

Or maybe different servicing algorithm (try it on choices instead of every day..)
Ertai_Wizard_Adept
Engineer
Engineer
Posts: 5
Joined: 18 May 2004 23:47
Skype: Ertai_Wizard_Adept
Location: Ceska Trebova (CZE) or Madison (USA)
Contact:

Post by Ertai_Wizard_Adept »

same problem. Shorter than 16 if you count only tiles. But you must add 6 tile penalty for 2 uphill tiles. And remember that train tries to locate the nearest depot once per day. So if it is too far away one day it can miss the choice because of this period. Probably i will need to make this distance longer for you
Alright, so an uphill tile really counts as 4 (1 for tile and 3 for penalty). Then the sideline leading to the depot has length 17, grrr :-) What other penalties do I not know about? Or rather where can I find them so I don't need to ask every single time? I'll grep through the code to see if I can find it, but any pointers where I should look are welcome. I assume these penalties are not present in NPF which is why trains found the depots in that case. So if I start my sideline on a hilltop, it should be alright. Similar to a hack, but it should work :-)

I think 16 is alright. If you make it more, trains might start leaving ro-ro stations to get serviced. That would be very annoying.
As for checking once a day, I didn't take that into consideration. I made a couple tests though. A maglev train at full speed travels 13 or 14 tiles a day with the slowest maglev engine (so multiply by 1.5 for the fastest one). If this is uphill, the probability that a depot on a hilltop is missed is about 2/3 even if it's right next to the main line. See attached savegame. The train is on its way to the station on the hilltop, is due for service and will miss the depot.
Or maybe different servicing algorithm (try it on choices instead of every day..)
I'm not sure what you mean by that. Is this some config setting I can change?
Attachments
Depot_YAPF_Test.sav
(11.53 KiB) Downloaded 305 times
Quark
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 20 Sep 2006 11:36
Location: Russia, Moscow

Post by Quark »

«trains might start leaving ro-ro stations to get serviced. That would be very annoying.»
Better to make patch «disable servicing while on station» and don't decrease reability while loading (or even add some).
Image
Bot_40
Engineer
Engineer
Posts: 105
Joined: 27 Jan 2005 18:56
Contact:

Post by Bot_40 »

I've had some strange behaviour when using YAPF in the attached savegame. When the game is loaded, a train comes down the main line from the north-west (Train 59). It's supposed to turn off and go to the station but instead it just continues along the mainline.

I think it may be caused by the train that exits the station just as it reaches the main line junction.

You can follow the route it takes after it misses the station...it goes half way round the map just so it can approach the station from one of the other entrances.

The problem doesn't occur if YAPF is turned off. The bug is in 0.5.0 but I also tried it with r8927 and it's still there.
Attachments
YAPF Bug.sav
(589.58 KiB) Downloaded 262 times
KUDr
OpenTTD Developer
OpenTTD Developer
Posts: 219
Joined: 11 Jan 2006 21:36
Location: Czech Republic

Post by KUDr »

Bot_40: thanks for the report.

I noticed this problem in the past. But then i wasn't able to reproduce it. Sometimes it makes wrong decision just for the first time. When you stop/reverse the train just after it makes this mistake and move it back, the next time it makes correct decision. I was unable to find yet. There is probably some mysterious problem inside YAPF (maybe i used more of my magic power than my knowledge). I will need to deal with it somehow.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests