Mashinky

Mashinky

View Stats:
Zapp Sep 19, 2021 @ 1:05am
"load balancing" or why one train isn't fully loaded before the next starts to load
(I'm slowly copying across discussions from the Mashinky subreddit since it seems the dev team is much more active here.)

I would be happy to be corrected but to me I see nothing useful in how stations doesn't focus on loading one train fully (so it can leave the station making room for a new train), before cargo is starting to load on a second train.

This to me inexplicable behavior means that you can get situations where three iron trains wait around for more coal and iron ore (instructed to "fully load" at this station), all three trains half loaded on its own platform...

... but the station only has three tracks, so all the iron and coal trains are waiting behind for a train that will never leave.

In other words, the supply chain deadlocks itself.

Had the loading algorithm made sure to give all cargo to the train with the least amount of empty space first, i.e. the train closest to be fully loaded, this situation would be less prone to happening.

But before I call it a bug, I would be interested to know if there is a rationale. Perhaps another race condition is avoided through the current implementation I don't know about?


Sincerely yours,
Zapp

PS. The way you avoid the deadlock described above is to always make sure you reserve at least one station platform for unloading trains only. That is, making sure there's always at least one track available for trains that come with cargo, that trains that take cargo away cannot access/occupy.

However, this is inefficient usage of the station in general and that track in particular. More importantly, it's kind of a "newbie trap" - which is regrettable since just tweaking the algorithm would have easily ameliorated it.

Another way of avoiding it is to count the number of trains that "fully load" at the station in question, and make sure there are at least one more station platform than this number. So if the station has four tracks and you have three trains "fully loading" iron or whatever, you're good. But that's obviously only good advice for low-capacity loops. As soon as you want/need six or eight trains that take away cargo (perhaps because the destination is far away) you can no longer build stations with more tracks, so you have to use the previous solution mentioned above instead.
Last edited by Zapp; Sep 19, 2021 @ 1:12am
< >
Showing 1-9 of 9 comments
Zapp Sep 19, 2021 @ 1:16am 
I can add that even when there's no deadlocking going on, it's still somewhat frustrating to see three trains sitting around loading... and then getting topped off almost at the same time, leaving the station at the same time, and of course blocking each other trying to get onto the same main track to the destination.

Had the loading algorithm prioritized one train at a time, one train would have been fully loaded and left the station, and then the next, and then the next - not getting in each other's way, and distributing the traffic over the line more evenly.

Cheers
hektor Sep 19, 2021 @ 5:58pm 
I see your point but even if this was a thing you would not avoid deadlocks. Deadlocks always come down to lack of queue space, signaling, or the spacing for junctions.
You already now have trains leaving at different times which is the rough equivalent of this idea.
jtrucker.jt Sep 22, 2021 @ 7:22pm 
Originally posted by Zapp:
I can add that even when there's no deadlocking going on, it's still somewhat frustrating to see three trains sitting around loading... and then getting topped off almost at the same time, leaving the station at the same time, and of course blocking each other trying to get onto the same main track to the destination.

Had the loading algorithm prioritized one train at a time, one train would have been fully loaded and left the station, and then the next, and then the next - not getting in each other's way, and distributing the traffic over the line more evenly.

Cheers

Yeah, it is frustrating. Dunno if that'll get changed but many people ask for it. Jan is very busy working on mp, so there is no time currently to do such fixes, but there is hope for the future.

Anyway, just a comment - if your station is so busy, that you need 5+ outgoing trains, I'd assume there is enough goods produced that you don't need "load fully command".. And surely SOMETIMES it would so happen that one train will go not completely full, which would be preferable than deadlock of course.

It is "rule" always have one platform more than number of "load fully" trains (as you've wrote above), and if I need more output trains (and I do sometimes), I use a few WITHOUT this command, which solves the problem.
But again, lets hope for the future. It frustrates me too, seeing several half-loaded trains in the station.
Zapp Sep 25, 2021 @ 12:29am 
Originally posted by jtrucker.jt:
Yeah, it is frustrating. Dunno if that'll get changed but many people ask for it. Jan is very busy working on mp, so there is no time currently to do such fixes, but there is hope for the future.
Thank you.

I didn't realize it was a large fix. Thought it would be something as simple as changing the sort order of the trains present at the station. That is, I kind of just assumed the game already uses some consistent criteria for which train to give a chunk of cargo. Even if I can't quite figure it out.

But maybe the current game just pseudo-randomly chooses which train to load each "tick", and fixing this would mean writing a whole new sub-routine inspecting the trains and calculating how much cargo space they have left...

(I'm not really asking a question here, just thinking out loud)
Person012345 Oct 1, 2021 @ 10:58am 
I would not like sequential train loading and it doesn't make much sense. Your problem is trivially easy to fix with just a little thought put into how to set up your system - you can say the solutions aren't "efficient" but it's more efficient than gridlock.

If you "need 6 or 8 trains to take away the goods" then why are they sitting there waiting for a full load and for more supply to come in anyway? In a situation with truly high volumes that "require" that many trains I don't see why you'd even designate waiting for full load. Maybe it's just because I haven't gotten there yet but can you articulate the benefits and rationale to doing so?
jtrucker.jt Oct 1, 2021 @ 8:41pm 
I can speak only for myself...
I, too, have trains waiting for full load. Especially at the early game, when resources and money are scarce. You see, train waiting at the station DOES NOT consume any fuel. So having only half-full trains running around, they would eat through your fuel reserve with very little profit and that might be difficult before your infrastructure is up and running and you have plentiful of everything.
Also, while I usually have surplus at the stations, sometimes it happens that the resource train is a bit delayed with some traffic issue, so I see no problem for the product-train to wait a bit longer.

Another thing is the supply / resource train. I for one like using mixed trains. It is more fun. (For example - for foundry - I prefer two identical trains with both coal and iron ore cars in each, running in the loop with both mines and foundry, rather than one train running coal only and second train iron ore only. As long as the terrain and resource spawn allows for reasonable path of course. If the mines spawn half-map away from each other then I have separate trains of course.
Anyway, when using combined trains, I calculate the ratio of each resource and set the wagons in the train matching that ratio. But of course, that would work ONLY if all wagons are full. So for these trains the load fully command is necessity, or the train might leave before is full from one or the other mine and you'd have surplus of one resource at the foundry.

And I believe that other players would have other reasons. There are always reasons for and also against using this or that in the game.
The greatest benefit of Mashinky (in my opinion) is the fact that you cannot play it wrongly. Every way is the correct one, just different and your own.
Person012345 Oct 5, 2021 @ 2:06pm 
Originally posted by jtrucker.jt:
I can speak only for myself...
I, too, have trains waiting for full load. Especially at the early game, when resources and money are scarce. You see, train waiting at the station DOES NOT consume any fuel. So having only half-full trains running around, they would eat through your fuel reserve with very little profit and that might be difficult before your infrastructure is up and running and you have plentiful of everything.
Also, while I usually have surplus at the stations, sometimes it happens that the resource train is a bit delayed with some traffic issue, so I see no problem for the product-train to wait a bit longer.
Ok but OP is talking about big stations maxed to their capacity using "wait for full load". Your early game scenario is quite different and doesn't sound like it's an unsolvable problem in the game mechanics, it just sounds like your fledgling company is growing faster than your resources can keep up with which is kind of normal? In that case it's not a question of maximum efficiency and you could keep a platform open for a delivery train right?

Another thing is the supply / resource train. I for one like using mixed trains. It is more fun. (For example - for foundry - I prefer two identical trains with both coal and iron ore cars in each, running in the loop with both mines and foundry, rather than one train running coal only and second train iron ore only. As long as the terrain and resource spawn allows for reasonable path of course. If the mines spawn half-map away from each other then I have separate trains of course.
Anyway, when using combined trains, I calculate the ratio of each resource and set the wagons in the train matching that ratio. But of course, that would work ONLY if all wagons are full. So for these trains the load fully command is necessity, or the train might leave before is full from one or the other mine and you'd have surplus of one resource at the foundry.
I simply don't understand why this is a problem. Stations have a per-resource capacity, it doesn't matter if you have a station full of coal at your foundry, just means it matters less if there's an interruption to coal delivery. In fact, unless you get just perfect timing ratios it's almost inevitable to happen if you DON'T use mixed trains and have dedicated coal/iron trains.

And I believe that other players would have other reasons. There are always reasons for and also against using this or that in the game.
The greatest benefit of Mashinky (in my opinion) is the fact that you cannot play it wrongly. Every way is the correct one, just different and your own.
I mean, yes and no? This isn't really an issue of "playing it wrongly", the OP is asking for a change that will increase his "efficiency" at the cost of forcing said change on to people who don't necessarily want it. (Edit: And to be clear I'm not saying I staunchly oppose the change I just am looking for an explanation of the situation). But I don't see how he is arriving at the situation he is in at all, which is what I am asking about. I don't see how you have a large station maxed to capacity with maximum efficiency and still have trains waiting around for resource delivery trains. Additionally he already knows of more than one potential solution for his problem but he doesn't want to use them because they reduce his efficiency, which is what it's about, not "right or wrong" so that efficiency thing is key for me to understand.
Last edited by Person012345; Oct 5, 2021 @ 2:12pm
jtrucker.jt Oct 5, 2021 @ 8:46pm 
I'm kinda lost here now. Dunno much what you would like to hear.
I don't have the problems which OP has, because I NEVER EVER UNDER NO CIRCUMSTANCES have the number of trains with full load command equal to the number of platforms. Period. No reasoning and situations will ever make me to do that / to have that. I always have one more platform than number of trains with full load commands, no exceptions. The max of platforms is 7 (one row is needed for the buildings), (it is actually 9 in late game with another extension in 6th era, but 7 from the start). I was never in situation when I'd need 7+ trains with full load command at any given station, but if that happened, I'd split it into two stations... So yes, NO EXCEPTIONS from the above rule.
But that is MY game and I'm not telling anyone how to play, there is as many play styles as there are players.
You wanted rationale why to use full load command at all, and I merely wrote why I AM using them. Not that anyone else must be using them the same way.

I'm using mixed trains. I LOVE having mixed trains = trains with different cargo. There is never situation where you "must" have them, everything can be always solved with single cargo trains. But I have mixed trains because I like them... By the same token I DO NOT LIKE having surplus of iron ore or coal at the foundry. There is nothing wrong with having it there, it is me personally who doesn't like it. So to prevent that you "must" use full load command otherwise it will inevitably happen that there will be one or the other resource in lesser amount than the train load at the arrival. But again, it is solvable by having the station storage overflowing with resources... On the other hand, if I have overflowing resources, why not to send another train and make a bit more iron? You see, it is magic circle and you can solve it by different ways, mine solution is to use full load command. Not that you have to do it. The rationale is ALWAYS very subjective and this is my personal one. You need to find your own or not use the command, which is also OK.
Zapp Oct 9, 2021 @ 3:11am 
There's no reason to argue. There's no reason to discuss different play styles. They're all good - it's a sandbox game with no losers after all. :)

However, the loading algorithm just isn't good. The game would be noticeably improved if the game loads one train fully before starting to load the next.

- If you run so many trains that you notice it, then the game is better for you.
- If you don't, and don't notice it, the game remains the same for you.
- There is no case where things get worse.

All that is left is to hope this isn't a huge coding effort which could mean it cannot be done given the realities of the project.

Cheers
< >
Showing 1-9 of 9 comments
Per page: 1530 50

Date Posted: Sep 19, 2021 @ 1:05am
Posts: 9