What makes it loaded first

Get help, info, news and advice about the Transport Tycoon Deluxe patch.

Moderator: TTDPatch Moderators

SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

What makes it loaded first

Post by SHADOW-XIII »

I just wanted to ask someone (read: dev team)
what makes that (let's say) one train is loading first, before second one train is loaded ... how TTD choose train to load, by what stat ?
what are you looking at? it's a signature!
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

I haven't checked, but I'm pretty sure it'll be in the order in which the engines of the trains appear in the vehicle array. If you're looking at the unsorted train list, that would be the same order as well if I'm not mistaken.
User avatar
spaceman-spiff
Retired Moderator
Retired Moderator
Posts: 20634
Joined: 28 Jul 2002 07:08
Location: Belgium
Contact:

Post by spaceman-spiff »

Would it be difficult to load one train at a time :oops:
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Hello, here, I have looked into that code A LOT.
And we already discussed that on irc.

Here is a brief explanation how TTD loads a vehicles:
Each train is processed via a tick (ticks are given the order of vehicle array), if a train arrives at a station it goes into a load/unload mode.

Then each tick the train processing function loads / unloads cargo
(There is no general station "processor" for that!)

Old ttd was doing that: A train gets a tick a train grabs the cargo it needed.
So first train in the vehicle array at a station gets full loaded first.

TTDPatch Loadtime: Each train gets an amount of cargo in one tick
-> result each train gets processed

I have a irc chat log saved about it if there is more interest.
We already talked about ways to make it work train by train.

My statement was because I would need to add a new second array for stations, it's to hard for me todo currently.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Post by Hyronymus »

Maybe post a link to that chatlog, eis_os. It would make it easier (perhaps) for people to understand what is (im)possible.
Question to Patchman: do you consider it too difficult to realize too. Note that I'm not asking if you are gonna do it right now. Just interested in your 'appraisal' of this issue.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

It's not public because maybe people that I logged to don't wanna it public.
When Josef needs the log I will send him the log, I thought he was there at the time and followed the discussion...

In general it can be done, but currently I don't see any time to make such a big stuff. The last two times I added savegame arrays I need hours so it work right and don't break the savegame in pieces...

If somebody writes me an savegame array function of 12 words per Station (12 cargos) I can maybe do it.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Post by Hyronymus »

If I only understood what an array is and how to programma it I would. And about the chatlog: I forgot that IRC is non-public.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Ok, here is a cleaned log of it...
IRC log about Loading time wrote: [..]
[20:35] <eis_os> do you have a simple idea in mind how to load train by train with GRADUALLOAD

[20:37] <patchman> with gradualload? that's a totally different issue
[20:38] <patchman> you'd need a per-station per-cargo list of consists being loaded, and only load those until they're done
[20:38] <patchman> however you'd also need a mechanism where if a single consist can't be loaded fast enough, you load more than one
[20:38] <patchman> e.g. if cargo is arriving faster than it can be loaded into one train
[20:38] <eis_os> So trains gets full loaded then thy go to the next train

[20:39] <patchman> yep, it must be in the place where TTD decides whether to process the loadunload of a certain train

[20:39] <eis_os> it's currently by vehicle basis, not by train :(

[20:40] <patchman> it's on a per train basis
[20:40] <patchman> the loadunload is only called for consists, not individual vehicles

[20:40] <eis_os> called when one vehicle has been loaded/unloaded, and
[20:40] <eis_os> advances to next vehicle if any
[20:41] <eis_os> you write in loadtime

[20:41] <patchman> next vehicle in current consist, not next consist, or any next vehicle

[20:42] <eis_os> so I have to find the move to next load train function?
[20:42] <patchman> eis_os: yes
[20:43] <eis_os> ohh, no, each train loads by it's own..
[20:43] <patchman> eis_os: that's what I said!
[20:43] <eis_os> :(
[20:43] <RobC> can't you make a trian stop, just before it reaches the end of the station when another train is loading in it?
[20:44] * Hyronymus can't get a hold of the current discussion
[20:44] * GoneWacko is now known as GoneWacko|game
[20:44] <patchman> RobC: that's an idea, make it not go to Loading/Unloading state until the right time
[20:45] <eis_os> yep
[20:45] <eis_os> but
[20:45] <patchman> I'm away now for a while, back later (an hour or so)
[20:45] <eis_os> I need a entry in the station list
[20:46] <eis_os> than it would work
[20:46] <patchman> make a separate array, there's no space in the station struc

[20:48] <eis_os> but not all trains can load the same cargo
[20:48] <patchman> eis_os: make an array with the same size as current station array
[20:49] <eis_os> so I would to look if the train can load the cargo, if yes, do a sticky somewhere
[20:49] <patchman> then use add edi,[station2arrayofs] to get a pointer like Marcin for the town array
[20:49] <patchman> and make the "train being loaded" be cargo specific
[20:51] <eis_os> To make that work is impossible for me
[20:52] <Hyronymus> can't you add a line to whatever you are programming to check against cargi ID's?
[20:52] <Hyronymus> *cargo
[20:52] <eis_os> ?
[20:53] <Hyronymus> would you explain briefly what you're making Oskar
[20:53] <Hyronymus> I'm not a prgorammer but I do have good solutions sometimes :)
[20:54] <eis_os> Thinking what we could do so trains get full loaded at once
[20:54] <eis_os> So one train gets full loaded with gradulate loading
[20:54] <eis_os> and then use the next

[20:55] <Hyronymus> without dividing the load over both trains
[20:55] <Hyronymus> dos TTD keep track of time when trains enter a station?
[20:55] <eis_os> yep
[20:56] <eis_os> no
[20:56] <eis_os> it doesn't

[20:56] <Hyronymus> eis, TTd doesn't keep track of time of arrival but it does notice when a train reached its destination
[20:57] <Hyronymus> doesn't it
[20:57] <eis_os> ehm
[20:57] <eis_os> each train loads by it own...

[20:57] <Hyronymus> they load on their own, I know
[20:58] <eis_os> A image for you:
[20:58] <Hyronymus> oh cool :)
[20:58] <eis_os> Each train has some workers
[20:58] <Hyronymus> I hope my 56k line holds out
[20:58] <eis_os> you have to use your mind :p
[20:58] * Hyronymus thinks eis meant example ;)
[20:58] <testman57> I think it is a verbal image :)
[20:59] <eis_os> if they arrive they leave the train and go to the source, the source has a round and give you each round a certain amount of cargo
[20:59] <eis_os> Thats how it current works

[20:59] <Hyronymus> ok, i get that
[20:59] <eis_os> the round = is a ttd tick

[21:01] <Hyronymus> and you want that each supply by a round loads into train 1 and not into train 1 AND train 2
[21:01] <eis_os> yep
[21:01] <eis_os> so a train get's full loaded
[21:01] <eis_os> then the next and then the next and and...
[21:01] <eis_os> (And all this maybe only if there is not enougth cargo for all)
[21:02] <Hyronymus> TTD changes the destination bar when a train arrives at its destination
[21:02] <eis_os> yep
[21:02] <Hyronymus> so oviously some routine checks when a train arrives where

[21:03] <Hyronymus> train 1 arrives before train 2 and thus triggers a change in the destination bar before train 2 does
[21:03] <eis_os> no
[21:03] <eis_os> train thinks:
[21:04] <eis_os> I am at the station, hey start loadunload now if I am not non-stop
[21:04] * Hyronymus smacks Chris Sawyer
[21:04] <eis_os> I am full?, yes->go to next in list, no wait for next tick
[21:05] <Hyronymus> what about testing against other trains: as long as there is another train: don't load
[21:05] <eis_os> but if train 1 loads livestock, why should train 2 wait for it when it loads grain?
[21:06] <Hyronymus> check against trains that load same cargo ID
[21:06] <Hyronymus> carriages have their own ID for cargo do they?
[21:06] <eis_os> ok, other question, what train comes first?
[21:07] <Hyronymus> check against trains with carriages with the same cargo ID
[21:08] <eis_os> but what is when we have 1000 Tons waiting?
[21:08] <eis_os> enough for make to trains full?
[21:08] <Hyronymus> check against trains with carriages with the same cargo ID if cargo waiting is less than cargo capacity

[21:09] <eis_os> (even the part to find the vehicle on a other stationplatform isn't easy, I don't know any function to do that
[21:09] <Hyronymus> what reflects a passnger train in TTD? How is that coded or is that unknown?
[21:09] <eis_os> Hyronymus: you would not know which train come first
[21:09] <eis_os> the result, no vehicle would load when there isn't enough there
[21:10] <Hyronymus> does TTD check if the supply from one tick is loaded or not?
[21:10] <eis_os> no
[21:10] <Hyronymus> dang
[21:10] <eis_os> cargo stands there
[21:10] <eis_os> old behavior was this:

[21:11] <eis_os> Simple load as much as possible in the first train in veh struct
[21:11] <eis_os> so you have never seen this problem

[21:11] <Hyronymus> I remember from hw it used to be
[21:12] <eis_os> hw?
[21:12] <Hyronymus> how doest TTD know when a train is full?
[21:12] <Hyronymus> how, sorry
[21:13] <eis_os> a train checks if it's full and goes to the next destination
[21:13] <eis_os> if so
[21:13] <Hyronymus> and the next question: how does TTD know a train is loading
[21:13] <Hyronymus> just becasue the load order?!
[21:15] <eis_os> because the station order is right
[21:15] <Hyronymus> if it's just in the load order it would be logical to edit the coding of the load error to implement waiting for other trains. But I haven'tgot a clue yet how to implement that
[21:15] * Hyronymus goes for coffee

[21:29] * Hyronymus is revived again
[21:31] <Hyronymus> eis_os: can you give trains a priviledged status as soon as their orders change to a new loading order?
[21:31] <eis_os> no
[21:31] <eis_os> in general I can't
[21:32] <Hyronymus> and you cannot refer TTD to look into anew routine as soon as that happens either?
[21:32] <Hyronymus> or an additional routine?
[21:32] <eis_os> thats not the problem
[21:32] <eis_os> the problem is, you would to store something
[21:32] <eis_os> +need
[21:32] <Hyronymus> that's undefined?
[21:33] <eis_os> what?
[21:33] <Hyronymus> you would need to store something that's undefined?
[21:34] <eis_os> No, I need to store something somewhere in the station
[21:34] <eis_os> but the station has no room for it
[21:34] <Hyronymus> all romm used by other routines including new ones from the patch?
[21:35] <eis_os> In the station structure
[21:35] <eis_os> http://kufel.immt.pwr.wroc.pl/~mgrzegor ... hicleArray
[21:35] <eis_os> and in the doc: Station array (+250 entries), locations within each entry follow:

[21:43] <Hyronymus> TTD stores the amoun of cargo waiting at a station
[21:43] <eis_os> yep
[21:44] <Hyronymus> and TTD knows the capacity of a train
[21:44] <eis_os> the train knows it capacity
[21:44] <eis_os> not the station
[21:45] <Hyronymus> and the train also knows what it's loading
[21:46] <Hyronymus> and where also. Can it translate this info into the basics of a new routine?
[21:46] <Hyronymus> I eman, can it be used a s the basics of a new routine?
[21:47] * Hyronymus hates the Packard Bell Keyboard with its ridiculous FN key
[21:47] <eis_os> You don't know what other trains are doing
[21:48] <Hyronymus> but suggest all trains create a report once they arrive at a station. Is something like that possible?

[21:52] <eis_os> there is no workaround then try to add more space to a station
[21:52] <eis_os> list entry
[21:52] <eis_os> that means: 12 * 2 Bytes per Station needs to be stored
[21:53] <Hyronymus> and what is the solution once you have more store in the station array?
[21:54] <eis_os> if a vehicle finds out there isn't enough cargo it will it to the list with the cargo
[21:54] <eis_os> ehm, it will add it itself to the list
[21:54] <eis_os> :o
[21:54] <Hyronymus> how? by pressing a lever ;p
[21:55] <Hyronymus> :p
[21:55] <eis_os> when a train leaves a station it will reset itself in the list
[21:55] <Hyronymus> so the train has to check against station info
[21:56] <eis_os> if a train tries to load a cargo, it checks the list, if there is a train, a other train already request all cargo
[21:56] <eis_os> so it will wait for the next round
[21:56] <Hyronymus> so it checks against other trains in the current station loading list
[21:56] <eis_os> yep
[21:57] <Hyronymus> and no such loading lit exists right now
[21:57] <eis_os> when a listed train gets loaded it has to check if enough cargo is there, if yes, reset the list entry
[21:58] <Hyronymus> god luck ;)
[21:58] <Hyronymus> *good
[21:58] * Hyronymus gets bananas from the Packard Bell Keyboard
[21:58] <eis_os> "[20:51] <eis_os> To make that work is impossible for me"
[21:58] * Hyronymus still wishes eis good luck
[21:59] <Hyronymus> I'm off for a laugh. Might be around tomorrow again
[21:59] <Hyronymus> Good night
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

eis_os wrote:Then each tick the train processing function loads / unloads cargo
(There is no general station "processor" for that!)

Old ttd was doing that: A train gets a tick a train grabs the cargo it needed.
So first train in the vehicle array at a station gets full loaded first.

TTDPatch Loadtime: Each train gets an amount of cargo in one tick
-> result each train gets processed
That doesn't actually answer the question though. In what order to trains get their tick? That's what Shadow wanted to know.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Patchman wrote:
eis_os wrote:Then each tick the train processing function loads / unloads cargo
(There is no general station "processor" for that!)

Old ttd was doing that: A train gets a tick a train grabs the cargo it needed.
So first train in the vehicle array at a station gets full loaded first.

TTDPatch Loadtime: Each train gets an amount of cargo in one tick
-> result each train gets processed
That doesn't actually answer the question though. In what order to trains get their tick? That's what Shadow wanted to know.
And to be sure, the tick to vehicles isn't changed, so even with TTDPatch this will stay the same.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

eis_os wrote: So first train in the vehicle array at a station gets full loaded first.
in other words:
vehicle which is first in order list (not sorted list) will be first loaded ?
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Yep, but with TTDPatch only a certain amount will be loaded at each train, so all trains get serviced...
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

hmmm ...
TTDPatch makes all serviced in one moment
so FIFO would require some de-evolution of TTDPatch :lol:

maybe it is possible to force TTDPatch to use something other while loading than vehicle array
what are you looking at? it's a signature!
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

I thought the idea of holding the second train in the station without actually arriving might have some promise. I gather that there is an "Arrival at Station" fuction call. Maybe that could be extended to see if there's another train already full-loading the same cargo, and if so, then it rejects the arrival, but stops the train, until the next tick?
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

The idea behind the array, each train registers cargo specific. (thats why 12 word) if It's full or finished loading it will deregister itself from the list and the next train can register itself....
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

No doubt that would work, I was just wondering if the other way would be easier, is all.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

People would start complaining why their mixed cargo train isn't loaded, why trains with different cargo stops and and and...
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

Yes, I think you are right. I almost never used mixed cargo trains, except for mail/passengers for which this doesn't apply.
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

I have another question ... what about 2 trains waiting for green signal light ... when green appears .... which train enter first the junction? does it works the same as stations?
what are you looking at? it's a signature!
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Yes.
Post Reply

Return to “General TTDPatch”

Who is online

Users browsing this forum: No registered users and 22 guests