Wait for Full Load - Until another train arrives

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

Is this a good idea for a patch?

Poll ended at 08 Sep 2005 10:50

No, useless
9
17%
Yes, selectable per vehicle/shared order list like full-load
24
44%
Yes, selectable per station
13
24%
Yes, as a global on/off patch option
8
15%
 
Total votes: 54

boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Wait for Full Load - Until another train arrives

Post by boekabart »

I have (and implemented and tested) an idea to modify the current Wait Until Full behaviour.
Often, I have a station where i want to have a train loading cargo at every time. In order to do this, I enable Full Loading (with the patch), and make sure that there are enough trains running to have always at least one waiting at the station.
Now i was wondering, isn't it better if the first train leaves the moment the next one arrives at the station, even if it's not full yet? This way, cargo is delivered as quick as my trains can carry it. Trains are on the go a lot more and never standing still.
2 Questions.
1) Do other people think this is actually beneficial to your profit? (since cargo is delivered more quickly)
2) How to implement this NICELY. Currently, i made a fn 'ShouldTrainLeave' that returns true when another train with space for the same goods is waiting at the station. This only when the loading patch is turned on.
I check this function where also the OF_FULL_LOAD is checked.
I actually think this just replaces the load patch, since now never an 'older' train for the same cargo will be waiting at the station.
I also wanted to be able to turn off this behaviour per train, so i now used the nonstop flag in the orders to enable this (since i don't usually need nonstop on my trains) but of course, this is not the right way.
Please, your thoughts about this!
btw: is there a good reason that ottd is c and not c++? portability?
Attachments
FullLoadUntil_alpha1.diff
How I did it now; only works for trains if they have non-stop turned on; only works with improved loading on.
(6.2 KiB) Downloaded 277 times
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i think i liked the way it worked before better.
if a train leaves as soon as 1 arives, then if theres a trafic jam on a large network, all 10 trains could arive at once, and leave instantly because the others come in, only the last 1 gets filled, then the station is sat there for a year with no trains.

its not something i'd want to use. although, others might.

if 1 train full loads before another starts loading anyway, which it does, then if 2 arive at once, 1 full train will leave before the next starts loading, giving a constant even stream of trains, if you want them to load faster, just remove a carrage or 2...
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

I agree that it will only work nice if the trains are evenly spaced.
Question is, will they ever get evenly spaced with my patch running, like they do with the old patch running.
How to improve the patch so that we retain the 'train distribution' effect of the improved loading patch; yet avoid having too many trains waiting at the station (possibly blocking it for other cargo too...) Leave only the emptiest 2 trains?? I have to try this, to see if this is better.
Nanaki13
Traffic Manager
Traffic Manager
Posts: 151
Joined: 08 Jan 2005 16:08

Post by Nanaki13 »

I think it would be better like this:

A station has 4 platforms.
There are 4 trains in it, full loading
When train nr 5 is waiting to enter the station then
train nr 1 leaves making room for it.
When train 6 comes, train 2 leaves and so on.
That way the station is always full but never locked.
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

yes, that is a better idea. but how does train 1, or whatever know when theres a train trying to get in?
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

@Nanaki13: I think that is very hard to code.... Maybe better to do it then when all platforms are full?
Pixel du Rezo
Engineer
Engineer
Posts: 22
Joined: 11 May 2005 09:10
Location: Rueil-Malmaison (IdF, France)

Post by Pixel du Rezo »

I've started to code such a patch a few weeks ago...
It works fine, but there was no GUI... All settings where made in the source code, and since the first patch, I never had some time to continue this project...

The difference was that I also add a minimum load-percent before the train should leave.

So, evene if a new train with the same cargo arrives at the station, the first one won't live until the minimum load-percent.

What I must add to make my patch useable is the GUI..
But those days, I can't find times to make it... maybe, you could add this idea to your patch.
Nanaki13
Traffic Manager
Traffic Manager
Posts: 151
Joined: 08 Jan 2005 16:08

Post by Nanaki13 »

boekabart wrote:@Nanaki13: I think that is very hard to code.... Maybe better to do it then when all platforms are full?
That's what i meant.
When all platforms are full and there is a train waiting to get in, the first one that went into the station should leave. FIFO.
Or let's just say, the one with the most cargo should leave, coz it's going to be the first one most of the time anyway.
Manar
Engineer
Engineer
Posts: 8
Joined: 11 May 2005 06:43

Post by Manar »

But it's very hard for the program to know when there's a new train which wants to come into the station. A simple compromise is to have the most fully loaded train leave once a train rolls into the last free platform. Not entirly optimal, as you'd be keeping a single free platform open for whenever a new train arrives, but you'd get a steady flow of trains, and it would work for any size of station.

Ehm, except single platform stations, I suppose. Or too large stations where having a single platform open isn't enough to handle the flow of incoming trains. How about leaving the train orders as they are, and setting on the station how many platforms should be kept open?
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

Manar wrote:How about leaving the train orders as they are, and setting on the station how many platforms should be kept open?
This actually sound like a good idea, put a flag in the stations (i guess there's already some room for this in code) that there should always be a platform kept free. This also solves a probably well known problem: 3 goods trains waiting at a station, but no goods available because the grain train cannot come in :-(

I'm going to take a look at the feasability and workability of this. Any suggestions on which train should leave first? The fullest or the one with the least empty space? What in case there are 2 coal trains and 1 ore train waiting, always let a coal train leave or just the fullest even if that is the ore?
Manar
Engineer
Engineer
Posts: 8
Joined: 11 May 2005 06:43

Post by Manar »

A bit complicated, but this should work in all cases:

1. For every cargo-type, add up the total cargo loaded.
2. Select the cargotype of which the most has been loaded.
3. Select all trains which can carry that type of cargo.
4. Select the train with the least total remaining space.

I think this is the most balanced for loading of different types of cargo, and sends on the train which is closest to achieving the profit it would get otherwise. In the last step you need the least total remaining space, so trains carrying several types of cargo won't always leave first.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

There is already a more configurable patch done, it just needs updating:
LINQ.
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

I found out myself that in some cases the thing with 'the fullest of 3 trains leaving' is not good, especially when they are trains which are waiting for manufactured cargo. I had 3 steel trns waiting in a station, and a lot of ore coming in (more than 3 trains full in fact) so the steel trains should have stayed and wait, but didn't, so a train ran almost empty and steel was left waiting.. Not good. Maybe i just should tweak the trains lengths...
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

Anyone who wants gui's doing or anything post your patch, and i'll see if i can implement one for you
We Am De Best

Host of ThroughTheTube site
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Well - Sacro - please update the patch I had linked in the upper post and post the update in its topic. :)
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i'll ring him when i get home.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

Right, i've got your patch, and the latest nightly, so i'll take a look and see whats going on :) , is there anything in particular needs doing?
We Am De Best

Host of ThroughTheTube site
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Well - I just thought if you could bring it "up to speed" - make it compatible with the latest nightly and fix some potential issues in code, if there are any... When updated, it'll be included in the latest "Integrated nightly" build. 8)
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

SirkoZ - i can do that for you.

Pixel du Rezo - would you like to post your patch, and then maybe that can be used as well
We Am De Best

Host of ThroughTheTube site
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests