News: Portal
Our Simutrans site. You can find everything about Simutrans from here.

Some small producers fail to deliver goods to the stations

Started by Octavius, June 12, 2022, 12:55:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


This happens on a the version I updated and compiled today, but it has been present for longer and I took some time to investigate this.

The issue is that some producers (arable farms and cattle farms on my map, playing around the year 1810) may fail to deliver goods (vegetables and livestock in this case), even when consumers of those goods run out of stock. It's not that max_transit has been reached, as some arable farms and sheep farms (sheep farms have a higher production of livestock than cattle farms, which may be relevant) continue delivery of the same goods and indeed max_transit as reported in the consumer's infobox (but there is an inconsistency between the max_transit reported there and the one reported under connections for the producer) hasn't been reached and the max_transit as reported by the consumer matches the consumption multiplied by the reported lead time.

But there definitely is a dependency on max_transit. Initially this issue appeared on both livestock and vegetable deliveries on my map. Some arable farms never delivered anything and neither did the cattle farms, so that the first market connected always ran out of vegetables and the slaughterhouse ran out of livestock (and consequently the market out of meat). But after I connected a second market for delivery of vegetables, the issue disappeared for the arable farms. They all started regular deliveries. I can't say for sure they all started deliveries to both markets. The markets still occasionally ran out of vegetables, because the production of all arable farms combined was less than consumption of the markets combined.

After a while however I noticed that my line of wagons moving vegetables from some of the farms to the market (and from there by narrowboat to the other market) didn't have enough capacity. Boxes of vegetables remained at one of the pickup stations for a long time, until capacity of the pickup station was reached, inflating lead time. Lead time increased to over 100 hours, although actual travel time after pickup was only about 25 hours. The max_transit appears based on the lead time of the slowest delivering supplier (that's what I get from the source code), so this inflated lead time leads to an inflated max_transit, which could never be fulfilled as storage capacity at stations was too small and at most stations pickup was pretty fast.

When I increased capacity of the line of wagons, the lead time dropped a lot, so did the max_transit and some arable farms again stopped delivery. So it appears that the issue disappears when max_transit is much larger than in_transit (or max_transit+max-(transit+stored) is much larger than 0). Also, I've only seen it happen for small producers, producing less than 1 unit per month.

I've been wondering whether this might be some rounding issue. Looking into the source code, it appears there's a lot of scaling going on between the numbers shown to the user and those used internally, I assume to prevent such rounding errors, but maybe something goes wrong there.

Another interesting observation is that the issue disappeared the moment I set just_in_time to 0. When I changed just_in_time back to 1 (or 2, 3, 4), the issue reappeared for the cattle farms, although not for the arable farms. But they haven't fully stabilised yet.

In the screenshot you can see a slaughterhouse with in_transit showing as 6/48, so it should order new livestock. One of the sheep farms, which reports the slaughterhouse's in_transit as 6/6, makes regular deliveries, but the cattle farm, also showing 6/6, has full stock and never delivers anything. I can't see anything regular in the inconsistent max_transits. An arable farm reports its consumers at in_transits of 4/13 and 31/31, whilst those markets themselves report 4/18 and 31/63. Maybe this inconsistency is related.

Edit: One of the cattle farms, the one at (473,65), makes occasional deliveries, but it still delivers less than it should. And for some reason, delivered, produced and the changes in stock don't add up at this farm.


Thank you for the report. I am struggling to understand the problem precisely enough to reproduce it. You refer to there being occasions when the consumer industries run out of raw materials - but the slaughter-house at 394,51 in the uploaded saved game never runs out of materials. Is the saved game after you made changes that fixed the problem? If so, I will need a saved game where the problem can in fact reliably be reproduced at a specific industry in order to try to fix this. Ultimately, I will need precise instructions on how to reproduce a very specific issue at a very specific location in a specific saved game.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.


This is exactly the game where the slaughterhouse doesn't get the livestock it needs. I let it run for a bit longer now (no changes) and attached a new screenshot and save. The slaughterhouse gets about 7 units of livestock per month, only from the sheep farms, which is insufficient. The cattle farms don't send any livestock there,1 although they are fully stocked and connected. And you can see the in_transit at 3/78, which should trigger sending some more units of livestock to my stations. With just_in_time set to 1 and stock at 0/4, the farms should submit livestock until I have 82 in transit.

The higher deliveries about a year ago were during an experiment when I had set just_in_time to 0. During that experiment cattle farms were behaving as expected. The experiment was inspired by line 2602 in, which tells that the distribution of goods is different when just_in_time!=0. I suspect the error is caused in that part of code or in some function called from there, but I have some difficulty understanding what exactly is going on. Maybe there's a problem with needed or needed_base_units as calculated a few line above there.

The arable farms, which showed the same problem, appear fixed for the moment. I thought a description of their behaviour may provide a lead to where the problem is located. When needed is large enough, it all works, but when it gets close to zero, deliveries stop. This suggests this is a rounding-to-zero error.

In case it matters, I downloaded and compiled the program and pakset today around 11:20 UTC and run it on Ubuntu 21.10.

So, none of the cattle farms connected to the slaughterhouse at (394,51) deliver livestock, although at the slaughterhouse stock is 0/4 and in_transit is 3/78.

1: The cattle farm at (473,65) is behaving a bit strange. In the past 12 months it produced 1 unit of livestock and it actually delivered 2 units, the only cattle farm delivering, yet its stock increased from 1 to 4. I don't know if this is a related issue. If unrelated, it's less important.


Hello, i am glad i managed to login and make here my first post. As a player, I hope i will not need to post often but my difficulties raise fast. I like the game because finding optimal solutions is challenging and hard or, likely, almost impossible to be found. I will try to attach my save file (no it is too large unfortunately) where one faces a wagon that fails to load vegetables. Many reasons can cause that but i try several days to find what might happen. It seems relevant to present post but, in my case, changing the just_in_time variable does not make the 4 vegetables in store to be loaded to wagon. I had once "No sufficient demand" but got rid of it by adding one more passengers line toward the relevant market. It is very hard to investigate where in a long chain might be the problem but i have tried all i could think and conclude that it is as far i can get. The chain in my mind is 'customers(passengers)-market-wagons to dock-ship-wagons to farm-workers(passengers). Finishing, i present my last thought and, if you please, try to correct me and explain the Axle values.

My wagon weights 1.0t (1.0t)  (what is in parenthesis?)
Axle load is 1.0t (I believe it is the max load of each Axle before it breaks)
[Each Axle, front and rear, has 2 wheels and number of wheels is irrelevant to the game]
I play, from 1750, in 1755 year. All, but the smallest, options to transfer vegetables have 2 axels and all have 1.0t Axle load. So, max weight per wagon is 2*1.0t=2.0t. That means, all wagons can carry up to 1.0 tone of vegetables because their weight is already 1.0t. But 4 crates of vegetables, that farm has to deliver, weight 4*0.7t=2.8t > 1.0t that all wagons can carry without axel break. So, wagons with capacity 4 or 6 crates cant load all 4crates of vegetables and it seems game does not let wagons to load only 1 crate in that case.
The other option is to use the small cart with 1 axle and 1t Axle load that has capacity of only 1 crate. The problem is that it weights 1t itself so, theoretically, with only 1 axel it cannot carry anything.
That might explains the problem. If i am right, to have a cart unable to transport anything seems a bug. Also, it seems very limiting the 4crate capacity wagon to carry only goods that weights less than 1000/4=250Kg per crate and  the 6crate capacity wagon to carry even less as 1000/6=166.67Kg per crate.

I didn't know how to test variables in a saved game. Now that I learned i can use "i" key, i checked just_in_time variable and upload is indeed possible only when it gets the 0 value. So, **my case is identical to Octavius case**. Also, changing the enforce_weight_limits to 0 does not solve the problem. So, except that I didn't understood how the weight and Axle load is working, Axle load is irrelevant to our case.

I had a disconnected chain. After fixing, vegetables start to upload even with just_in_time=3. After a while the same problem appeared. So, may be it is just a matter of how one handles the needs for customers that every "customer" industry has. In my case in every end customer chain i create stop for passengers and emails too. Even so, after 4 or 5 years it seems my market loose almost all their customers, so no uploads to wagons. In Octavius case, i see that the market in his most populated city is not connected to passengers stop. Pressing 'v' shows that there is coverage everywhere in the map but it is misleading. This market has no non walking passengers. Actually the 3 markets of his, lose all their customers in just a month. In my case, happens the same but takes much longer with a feeling that the  game can be saved. I would expect that customers would walk form nearby to buy vegetables but it is not the case. Since the mechanics of the game are scattered in so many posts it is difficult for some to have clear thinking of what is happening and what could be his right goals. Octavius, i think we must understand how the customers can be handled better.
Anyway, the Axle and weight relations in game  remain as questions in my mind, as many other things that need a search to posts first.
In the present case i start to believe that there is luck of information about passengers as customers and not a bug. In my case, i will start from scratch another try, hoping for the best. If end industries need passengers and passengers need population that needs industries, this time i will develop both at once with heavy use of pause or slower time because, till i make my mind and complete a chain, time passes and the initial boost or tuning of the game is lost.


Axle load is used to determine on which types of roads/rails a vehicle can travel. Only with bridges the total weight is the limiting factor. Hover the mouse over a road or bridge and the tooltip will tell you the maximum (although the tooltip does not point out that these weights are different for roads and bridges).

BTW, the number in parentheses is the weight of the current payload.


I am also having the issue where cattle farms don't send livestock to slaughterhouses, but sheep farms do.

unknown (1).png

In addition, I can't seem to get spinners to send their finished textiles to clothing shops.