Page 1 of 1
loading time long trains?
Posted: 10 Feb 2010 14:09
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
Re: loading time long trains?
Posted: 10 Feb 2010 14:38
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.
Re: loading time long trains?
Posted: 10 Feb 2010 15:02
by HackaLittleBit
Really I´ll check that tonight and if so forget this post

Re: loading time long trains?
Posted: 10 Feb 2010 15:05
by Nickel_Plate
Re: loading time long trains?
Posted: 10 Feb 2010 15:31
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
Re: loading time long trains?
Posted: 10 Feb 2010 17:53
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.
Re: loading time long trains?
Posted: 10 Feb 2010 18:57
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...
Re: loading time long trains?
Posted: 12 Feb 2010 15:31
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

Re: loading time long trains?
Posted: 14 Feb 2010 16:13
by Hirundo
How does your patch interact with newgrfs that add or override cargo types?
Re: loading time long trains?
Posted: 14 Feb 2010 17:33
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
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
Re: loading time long trains?
Posted: 15 Feb 2010 11:03
by HackaLittleBit
Ahh I see, not so easy as I thought.
This will take some investigation
Regards