loading time long trains?

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

Post Reply
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

loading time long trains?

Post by HackaLittleBit »

I like to play with long trains and I do like to see them slowly crawling through the landscape.
But loading them at a station takes ages.
In economy.cpp you can find the following code that treats trains that are to long for the station platform.

Code: Select all

01350   if (v->type == VEH_TRAIN) {
01351     /* Each platform tile is worth 2 rail vehicles. */
01352     int overhang = Train::From(v)->tcache.cached_total_length - st->GetPlatformLength(v->tile) * TILE_SIZE;
01353     if (overhang > 0) {
01354       unloading_time <<= 1;
01355       unloading_time += (overhang * unloading_time) / 8;
01356     }
01357   }
I was wondering if the code is treating long trains fairly.
We have now long trains big maps and long stations.
I do not mind to make a station of 50 tiles long but that is not possible.
So would it not be possible to deminish the punishment in case you use the maximum station length?

For my self I take out the code but that is cheating.

I could make a patch about this but first I would like to hear some opinions


FlySpray 3622


Regards HackaLittleBit
Attachments
loading_time_r19125.patch
FS#3622
(1.46 KiB) Downloaded 91 times
Last edited by HackaLittleBit on 14 Feb 2010 20:16, edited 2 times in total.
as
Transport Coordinator
Transport Coordinator
Posts: 281
Joined: 07 Mar 2007 20:13

Re: loading time long trains?

Post by as »

hackalittlebit wrote:I do not mind to make a station of 50 tiles long but that is not possible.
It is possible, you just need to increase max station spread setting.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: loading time long trains?

Post by HackaLittleBit »

Really I´ll check that tonight and if so forget this post :oops:
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: loading time long trains?

Post by Nickel_Plate »

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

Re: loading time long trains?

Post by HackaLittleBit »

whoehaaaa , good one Nickel_Plate.

I searched for long trains and nothing came up.
I had some second thoughts because increasing loading area slows down the game.
Maybe I´ll have a crack at it. But then again people should make suggestions.
I my self think that a train should be penelized if longer than platform but in a more reasonable fashion.
Maybe we should allow bulk goods like coal and iron ore to be handled with less penalty?
That would be easy to do since this part of the code is only runs when train arrives at station.

thanks HackaLittleBit
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: loading time long trains?

Post by SirkoZ »

I'd say the penalty is good as it is now, however, one could make a patch for long trains to unload wagon-section by wagon-section.
This would enable trains several times longer than the station (if the patch was enabled in Adv.Settings) that only the wagons actually fitting on the station would unload, then train would
move forward till all the wagons on the station were full and then unload those too.
It could be called partial unloading patch. :-)

Of course such an unloading station would have to be a RO-RO, but that's no inconvenience merely a request for a feature that brings in so much realism.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: loading time long trains?

Post by Eddi »

SirkoZ wrote:then train would
move forward till all the wagons on the station were full and then unload those too.
as explained previously, that is impossible with the current system, as for trains to unload, the front vehicle must be on a station tile. so to achieve this behaviour would need a major rewrite...
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: loading time long trains?

Post by HackaLittleBit »

Attached find spreadsheet that explaines current calculations and desired calculations.
You can fill in and experiment for a second and you will find out that current line of code give values out of proportion.

the new line of code is a one liner and should be:
unloading_time = (unloading_time + (unloading_time * ((overhang / st->GetPlatformLength(v->tile)) + 1)) ) * 2;

the 2 in the line is the penelizer.
not tested can't compile here in the office :(

Pls yexo have a look at the spreadsheet.

Penalty should be bigger for passengers and spoilable goods and non bulk cargo(catle grain). and less for bulk goods (shugar , rubber, coal).

EDIT: and my station rating goes comletely down while loading big train and lots of cargo are not loaded, and stay on the platform :( (very anoying )

Regeards Hackalittlebit

P.S exel 2000 compatible
tonight I will submit patch to flyspray

Edit: See patch fist post
and it's not a one liner :)
Attachments
loading.xls
(8 KiB) Downloaded 143 times
Hirundo
Transport Coordinator
Transport Coordinator
Posts: 298
Joined: 27 Jan 2008 13:02

Re: loading time long trains?

Post by Hirundo »

How does your patch interact with newgrfs that add or override cargo types?
Create your own NewGRF? Check out this tutorial!
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: loading time long trains?

Post by HackaLittleBit »

Hirundo wrote:How does your patch interact with newgrfs that add or override cargo types?
It does not, nor am I familiar with how that is done :cry:
But what I tried to do is giving a framework to calculate penalties.
So if there are more exceptions they just have to be filled in as "penalty" in the patch.
The way the patch works is that no penalty is given for the part of the train that is on the platform.
then part that is not on platform is divided by the available platform length to come to a total amount of platform lengths that would have been necessary. that is multiplied with the waiting time and then the penalty is applied.
Only trains that carry in all wagons the same cargo type and have bulk cargo are treated more lenient.
Passenger trains and for example live stock should be treated more severe.
The patch is most probably not ready but it is a push in the direction.
I would be grateful for suggestion and hints for improvements.

It was submitted to flyspray see first above post.

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

Re: loading time long trains?

Post by HackaLittleBit »

PikkaBird wrote:Whoosh!
Ahh I see, not so easy as I thought.
This will take some investigation :(

Regards
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google [Bot] and 26 guests