YAPP - Yet Another PBS Patch (now in trunk!)

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

User avatar
Beardie
Tycoon
Tycoon
Posts: 2029
Joined: 12 Apr 2008 19:38
Skype: rbeardwell91
Location: Buckshaw Village, Lancashire, UK

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Beardie »

Rubidium wrote:
phil88 wrote:I'm not really sure what the negatives are of including it in trunk to be honest. It's not like it's an option that you HAVE to use, you can still use the regular old signals if you so please.
One is using 10+% more CPU than a build without YAPP on a map with lots of trains that do not use YAPP signals. Progress is great, but does it warrant making OpenTTD run that much slower when you don't use the signals?

Another thing is the desync issue that some people mention. My current hypothesis is that this is a cache mismatch in YAPF between the client and the server. I haven't had the time to actually look into that though.
You telling me that OpenTTD uses a lot of CPU, because i didn't think it did and if it doesn't 10% more percent CPU usage is not A LOT.

I don't really know if that effects gameplay and peoples computers, but you would think it wouldn't.
Previously Known As Beardie27
Check out my UPDATED! Screenshot Thread
Check out my Railway Photography and Deviant Account


Image
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Rubidium »

Beardie27 wrote:You telling me that OpenTTD uses a lot of CPU, because i didn't think it did and if it doesn't 10% more percent CPU usage is not A LOT.
Tell that to the people complaining on an almost daily basis that they can't connect to some server because they are 'too slow'. There are furthermore many savegames that do not run smoothly on my computer and adding another 10% extra CPU usages makes both groups grow.

And 10% CPU is actually an awful lot more CPU wastage with respect to any other feature that is not used.
phil88
Transport Coordinator
Transport Coordinator
Posts: 267
Joined: 25 Jan 2007 23:26

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by phil88 »

Why is the CPU usage so high if you don't use the signals? Would disallowing YAPP in a patch setting stop it? That way the YAPP stuff is only loaded and used iff the user wants it, if the user doesn't want it, then only the code that we have at the moment is used. Or are the changes to the code to spread out to simply turn it on/off.
- Phil
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by planetmaker »

Beardie27 wrote:You telling me that OpenTTD uses a lot of CPU, because i didn't think it did and if it doesn't 10% more percent CPU usage is not A LOT.
We have regularily games on our server which cannot be joined anymore by people who don't have the latest gaming hardware, e.g. a processor with very fast cores (only the speed of one core matters!). Try out a map with 1000 trains - it fills one core of a 2GHz core2duo easily. An additional 10+% would make even looking at that game impossible.

So I agree with Rubidium that speed is definitely an issue - especially, if a patch affects the speed, even if it is not in use.
Kolbur
Engineer
Engineer
Posts: 29
Joined: 19 Sep 2007 09:20

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Kolbur »

We're playing for some time on the openttdcoop PS with this nice patch now and we had a few crashes (the server exited).
I'm posting a screenshot and a savegame, where train 67 meets a green PBS signal that should be red and crashes into another train (marked by the red circle). This situation made the server exit, on single player the train crash just happens without a game crash.
When loading the autosave from half a minute before the crash, it does not happen. I hope that helps.

PS: the assert was:
...ottd/yapp/src/train_cmd.cpp:2431: void FreeTrainTrackReservation(const Vehicle*, TileIndex, Trackdir): Assertion `IsFrontEngine(v)' failed.
You need the ottdc_grfpack for this save from http://www.openttdcoop.org/wiki/GRF.
Attachments
right before the crash
right before the crash
pbs_crash.png (99.16 KiB) Viewed 1674 times
assert.sav
the crash save
(733.87 KiB) Downloaded 166 times
User avatar
Dave
Moderator
Moderator
Posts: 17249
Joined: 26 Dec 2005 20:19
Location: North London

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Dave »

Regards YAPP, and knowing that there's now a system for a train to create a path for itself, how possible would it be to allow two trains to pass signals into a single platform, as long as there was enough track for it to safely enter the station? Having seen the system work, trains won't move until they can reserve a free path, so surely the problems of train crashes can be avoided?

Obviously we have the problem of trains becoming deadlocked against each other, but players can create waypoints to stop that occurring. Increases station capacity and reduces the amount of platforms required.

For a real life example of platforms used by two trains, see Birmingham New Street.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Eddi »

Dave Worley wrote:Regards YAPP, and knowing that there's now a system for a train to create a path for itself, how possible would it be to allow two trains to pass signals into a single platform, as long as there was enough track for it to safely enter the station? Having seen the system work, trains won't move until they can reserve a free path, so surely the problems of train crashes can be avoided?

Obviously we have the problem of trains becoming deadlocked against each other, but players can create waypoints to stop that occurring. Increases station capacity and reduces the amount of platforms required.

For a real life example of platforms used by two trains, see Birmingham New Street.
while i'd really like to see that feature, i'd say this is beyond the scope of this patch

this patch should get feature locked and focused on getting into trunk

usage of partial platforms is more of a shunting operation and should get in a separate patch [probably building upon YAPP reservations], but there are more problems involved than just "reserve half a platform"
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by michael blunck »

Dave Worley wrote:how possible would it be to allow two trains to pass signals into a single platform, as long as there was enough track for it to safely enter the station? [...] Increases station capacity and reduces the amount of platforms required.
Something like this can be easily done w/o PBS/YAPP by using non-track tiles like this:
slopestation.png
slopestation.png (24.72 KiB) Viewed 4363 times
regards
Michael
Image
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by cmoiromain »

I believe that he wants to make it possible for two trains to enter the same platform from two side, but also to just drive through the station. With your layout this is not possible. Or else you need two different types of platforms but it makes the whole station more complicated.

Dave Worley's idea could be done IMO if each tile of the station was considered as a block, except the trains would enter any free tile even if the remaining space is too sort for it to fit, blocking the station entrance and creating a jam...
I am little, ugly, and nasty. How do you do?
User avatar
Dave
Moderator
Moderator
Posts: 17249
Joined: 26 Dec 2005 20:19
Location: North London

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Dave »

cmoiromain wrote:I believe that he wants to make it possible for two trains to enter the same platform from two side, but also to just drive through the station. With your layout this is not possible. Or else you need two different types of platforms but it makes the whole station more complicated.

Dave Worley's idea could be done IMO if each tile of the station was considered as a block, except the trains would enter any free tile even if the remaining space is too sort for it to fit, blocking the station entrance and creating a jam...
I was under the impression that under YAPP the train knew it's length? Or maybe not, I don't know.

But yes, you're right - there are so many terminii platforms required that a station that might usually be a four platform station becomes a ten platform one, and so on.

EDIT: That said, if you had a "standard length" of trains, you could easily make sure that stations were twice as big as that, or you could have waypoints to dictate where certain length trains should go - you can order longer trains through one waypoint/station, and shorter trains through the other.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by fabca2 »

Rubidium wrote:
phil88 wrote:I'm not really sure what the negatives are of including it in trunk to be honest. It's not like it's an option that you HAVE to use, you can still use the regular old signals if you so please.
One is using 10+% more CPU than a build without YAPP on a map with lots of trains that do not use YAPP signals. Progress is great, but does it warrant making OpenTTD run that much slower when you don't use the signals?
and if noAI consume 10% CPU more, will you refuse to merge it into the trunk ? I think no, and it's ok for me (I guess it will use more than 10% btw)
people want faster playing ? ok, lets them begin to use smaller map first ? no ?

if paying 10% for having this great feature that a lot of us are waiting for, for me it's ok.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Yexo »

fabca2 wrote:
Rubidium wrote:
phil88 wrote:I'm not really sure what the negatives are of including it in trunk to be honest. It's not like it's an option that you HAVE to use, you can still use the regular old signals if you so please.
One is using 10+% more CPU than a build without YAPP on a map with lots of trains that do not use YAPP signals. Progress is great, but does it warrant making OpenTTD run that much slower when you don't use the signals?
and if noAI consume 10% CPU more, will you refuse to merge it into the trunk ? I think no, and it's ok for me (I guess it will use more than 10% btw)
people want faster playing ? ok, lets them begin to use smaller map first ? no ?

if paying 10% for having this great feature that a lot of us are waiting for, for me it's ok.
Ofcourse with some advanced AIs NoAI will consume more CPU, but the big difference is that NoAI won't take any CPU as long as you don't start an AI. Apparently this patch does. And *that* is a big disadvantage.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Rubidium »

fabca2 wrote:and if noAI consume 10% CPU more, will you refuse to merge it into the trunk ? I think no, and it's ok for me (I guess it will use more than 10% btw)
people want faster playing ? ok, lets them begin to use smaller map first ? no ?
If NoAI without running any AIs consumes 10% more CPU than trunk without AIs NoAI will not be merged.

I don't care if YAPP takes 1000% more CPU when you start actually using YAPP, i.e. building YAPP signals. My main problem is that the YAPP patch introduces 10% more CPU when the signals are not used.

It's like paying 10% more for cellular bill when the cellular company starts implementing a new network with more features (4G?), even when you do not intend to use the features. When someone else wants to use those new features and has to pay 50% more I don't care, as long as I don't have to pay 10% extra when I do not use it.
_Robbie_
Engineer
Engineer
Posts: 49
Joined: 23 Feb 2008 09:52
Location: Norway

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by _Robbie_ »

What if YAPP was YAPO (Yet Another Patch Option ;))? Would it still consume CPU time while deactivated? Though I don't know if it is so simple to actually make it an option, since it changes quite much of existing code, doesn't it?
Robbie
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by DaleStan »

_Robbie_ wrote:What if YAPP was YAPO (Yet Another Patch Option ;))? Would it still consume CPU time while deactivated?
Yes. Every time YAPP code might be executed, you'd first have to check whether or not YAPP is on and that check would consume CPU time.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by cmoiromain »

one check is probably less than all the checks yapp has to perform though... Or maybe the check could be done once, at the beginning, and depending on the result it either sends to the code that does normal signals or to the part that does the yapp code. But I don't know how the patch and the game work internally, so maybe my vision of things is a little utopic...
I am little, ugly, and nasty. How do you do?
User avatar
YukonRob
Transport Coordinator
Transport Coordinator
Posts: 290
Joined: 31 Jul 2007 00:58
Location: North of 63

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by YukonRob »

And isn't there already 3(?) pathfinders to choose from, they already must have handled these somehow.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Rubidium »

Seems like trains unreserve paths they are still running (rather waiting) on them. See the attached savegame.
Attachments
YAPP-crash.sav
(102.17 KiB) Downloaded 149 times
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by Ammler »

Small glitch:
halftile.png
halftile.png (15.05 KiB) Viewed 3592 times
razielanarki
Engineer
Engineer
Posts: 20
Joined: 08 May 2002 05:01

Re: YAPP - Yet Another PBS Patch (New version 8 out!)

Post by razielanarki »

YukonRob wrote:And isn't there already 3(?) pathfinders to choose from, they already must have handled these somehow.
yes, but yapp extends two of those to handle path reservations.

and DaleStan is right: yapp code is all around in them (and some other places) in little snippets, so making a patch option could actually make things worse.
also yapp extends gameplay by introdoucing new signals (which you don't use if you don't want to), and does not modify it, so a making it an option is rather pointless imho.

i hope Michi_cc can find and optimise the bottlenecks in the code to elimiate that pesky 10% (which is a lot) this maybe the hard, but i'm sure he's got some ideas :)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests