News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Recalibrating industry consumption and production.

Started by martin509, May 13, 2025, 09:09:26 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

martin509

Hello! If you have been following https://forum.simutrans.com/index.php/topic,23478.0.html, you may be aware I have been reworking the way industries are generated in Simutrans-extended to generate balanced supply chains, consumers-first - i.e., supply chains where the amount of production available more or less matches the amount of end-user consumption, instead of the current system where frequently, well-fed manufacturer industries do not even have 10% of their production capability in use.

As a result of this, running my test code on the current Britain-Ex pakset has revealed some... interesting behavior, particularly in the 1960-present portion of the timeline:
In this particular case, this circa-1990 world has generated covered almost head-to-toe in farm industries. Why? Well, the Supermarket consumer industry, which this world has generated with just four of, demands 150+ units/ month of supply of a wide array of goods. Compared to earlier consumers of agricultural products (such as grocers, butchers, etc) this is an order of magnitude higher than before, and there are four of these supermarkets in this 640x640, 20 cities, 20 consumer industries world.

This prompted me to snoop around in the pakset in general, where I discovered that there were a fair few industries who had production numbers that were either incongruous with reality (keeping in mind the balancing method where industries produce/consume goods in terms of real-time hours, not months) or were inherently arbitrary. I'll jump into the issues I've found, explaining the problem and detailing the solution I've implemented in my modified copy of the pakset. Where necessary, I have increased the number of fields allocated to farm industries, particularly late-game - while these industries are obviously intended to be very broadly distributed, late-game consumption escalates such that there may be 200+ farms of a given type to connect to a transport network, and the sheer number of roads generated by having a dozen+ small farms clustered together in one space is very ugly. As a result, I have changed some industries to smoothly ramp up the number of fields they have and often double the number of fields they have in their late-game end states.

I have also noticed some minor gaps in industry availability that I am not sure are intentional - paper mills stop appearing between 1970 and 1975, iron ore and coal mines between 1970 and 1972, and late-game steel mills do not have a 'range' value (to randomly vary the industry's productivity) set. One thing I will avoid doing however is changing distribution weights for anything, since that is obviously beyond scope and highly relevant to the overall historical feel of Britain-Ex.

If there is a positive reception to this post, I will put up a pull request to merge this onto the Britain-Ex GitHub - in the meantime, the relevant changes can be viewed here.

Arbitrary Changes

Supermarkets

As I mentioned above, supermarkets (particularly the large 1980s-onward 3x4 ones) have an absolutely ravenous appetite for goods, accepting up to 7 different goods and demanding well over 100 crates per month of all of them. This is massively higher than most predecessors like grocers/butchers/etc and can create odd relationships such as a single 3x4 supermarket being the sole consumer for no less than three entire grain mills' worth of flour and four pharmaceutical factories. None of this has a written justification in the .pak file and is certainly not realistic-feeling.

I do not have any particular sophisticated math to calculate a more realistic rate of consumption, but from experimentation, reducing the ratios for some goods to ~40-80% (or 10-20% for some goods like pharmaceuticals) and then having each supermarket type - convenience stores, 2x2 supermarkets and 3x4 supermarkets - each consume twice as much as the last type, produces fairly balanced results in-game that are not as sharp an escalation. As a result of these changes, 2x2 supermarkets consume 15-25 crates per month of most goods, and 3x4 supermarkets around 20-45 crates/month. This still drives a lot of agricultural production to cover a substantial portion of the smaller maps, but there is enough empty space to make running train lines and such an actually feasible task instead of totally hopeless.

Builders' yards

In-game, builders' yards are an abstraction meant to represent the construction industry in general. As a result, they do not have a calculated consumption rate based off reality in the .pak file comments and (I presume) are relatively free to modify for the sake of game balance. In their case, a problem with builders' yards is that they are sole consumers for two goods (cement and bricks) that are produced, as time goes on, in increasingly large quantities, to the point that a late-game brickworks theoretically requires around 70 or so builders' yards to saturate its production, which is impractical. This not only causes severe bottlenecks but also interferes with industry spawning as the algorithm I have working is weighted in terms of overproduction ratios, so a good that is 50:1 overproduced will naturally get more consumers allocated than, say, one that is 2:1 overproduced - resulting in worlds generating with a large number of builders' yards. This goes for every good that builders' yards consumes, except for planks (sawmills do not escalate nearly as drastically in production).

The solution I have implemented right now is to calculate how much of an InputFactor for a good would be required for a ratio of ~10 yards per factory, take the midpoint of that number and the current InputFactor, and use that. This results in the following adjustment which ends up consistently hovering around ~17 or so builders' yards per factory, instead of 60-70. Since this is somewhat complex, here are some graphs to explain:

In terms of what the final numbers are like, this ends up around 3-5 times as much consumption for every good except planks (for the sake of not completely filling the map with sawmills), which can also serve to represent the British construction industry shifting away from using wood as a structural material. I'm open to other suggestions - for instance, perhaps keeping the ratios the same but increasing overall consumption, or splitting the difference between that method and the one I propose - but I think this particular change would be a big help when it comes to eliminating bottlenecks in Simutrans-extended.

Car Dealerships

Currently, car dealerships in Britain-Ex average 16-24 or so cars per month in the later parts of the timeline, and lower sales still in earlier years. This is a bit of a compromise situation where the consumption is higher than would be strictly realistic, but still not high enough, as 1980s car factories can average 700+ cars produced per month. Going off of the higher numbers I've seen for number of cars a dealership will move in a given month (~200 or so), this averages out to ~5.33 cars per hour assuming a dealership is open 8 hours a day/7 days a week. This is even lower than in-game, but of course going off of per-month numbers would clearly be too high.

Ideally the planned feature of ports for export would help here since they could take quite a lot of inputs, but otherwise, since the current figures for car dealerships are already fairly arbitrary, I think ~doubling or tripling consumption (to 32 or 48 cars/month for late-game dealerships) would help a lot with car factory bottlenecks without meaningfully reducing the number of dealerships that get generated per factory in practice (since usually, even with the new industry generation, we only get 1-4 dealerships out of 60+ consumer industries).

That's it for the more or less arbitrary, balance-motivated changes I can suggest. As for the rest, well, let's jump into the biggest can of worms here:

Realism-based changes

Livestock industries

Currently, the two livestock industries (sheep and cattle farms) are a bit of an odd case. They both have realistic numbers generated with production of wool and milk in mind, but in-game, end up spawning in large numbers mainly to satisfy demand for livestock. Cattle farms are relatively decent for this (generating 10-20 head of livestock per month in the late game), but sheep farms in particular are quite underpowered, generating literally the bare minimum production (0.5 head and 2.0 sacks of wool/month) for the entire Simutrans timeline. This is due to the fact that, based on realistic calculations of wool yield, a sheep farm needs to cover 278 tiles to generate one sack of wool every 6.4 in-game hours (a month). Since none of the farms are that large, they are pinned to the lowest consumption rate there is and players have to link dozens of sheep farms to get adequate production of livestock and wool. For cattle farms this is also somewhat the case - realistic calculations arrive at a 32-tile cattle farm producing just under one unit of milk per month - but for some reason in-game cattle farms produce much greater yields than this. That said, if we were to make cattle farms strictly realistic as well, they would also be pinned to these very low yields.

But what if we, if not broke, then bent the 'Simutrans production should be scaled per-hour' rule, and based production from livestock industries off of real life per-month figures, instead of per-hour? To my surprise, this did not actually break the game's balance and still allowed for the overall feel - connecting lots of small farms to large manufacturers, farms with more fields producing more goods, etc - that Simutrans is aiming for. In addition to this change, I also found realistic numbers for livestock production - sheep farms typically cull around 15% of their flock every year, and dairy farms 30% - that allowed me to adjust the numbers for that critical output as well.

Along with drastically increasing the number of fields used by each farm in the late game (roughly doubling their footprint but reducing the sheer number of farms players will need to connect), the final yields I arrived at for 1975+ cattle and sheep farms are as follows: 0.3375 milk churns(x5) and 0.08 livestock per month per tile (with ~96-tile farms landing at 32.4 milk & 7.68 livestock per month) for cattle, and 0.21 sacks of wool and 0.25 livestock per month per tile (with ~64-tile sheep farms producing 13.4 sacks of wool and 16 livestock per month) for sheep farms. This still results in a large footprint of cattle and sheep farms on the map (usually dozens of each for a 640x640 map), but is much more reasonable to play with and allows larger farms to actually produce more than smaller farms (particularly in earlier parts of the timeline like the 1800s). I'd love some feedback on this, as while it is strictly speaking an unrealistic change I think it does improve these industries a lot, and technically the current system is also unrealistic due to the enforced minimum level of production (around 2.0 sacks of wool per month) being much greater than the 'realistic' number (which works out to ~0.043 sacks per month for a 1750 sheep farm with 12 tiles to its name).

Source for sheep cull rate: https://www.ontario.ca/page/measuring-sheep-flock-productivity
Source for dairy cow cull rate: https://agriculture.canada.ca/en/sector/animal-industry/canadian-dairy-information-centre/statistics-market-information/dairy-animal-genetics/culling-replacement

Vegetable farms

One thing I noticed when looking through the various industries was that vegetable farms skyrocket in production from 1945 to 1975, with yields increasing by nearly 7 times. Let's see what the real-life change in yields was like.

In real life, yields for various crops skyrocketed from the 1960s onwards - roughly doubling from 1945 to 1975 - due to the application of genetic engineering, new chemical fertilizers, and so on. I went and grabbed realistic numbers from Our World In Data for potato yields. Arriving at 31 tonnes/hectare for potatoes (other vegetables were even higher), this turns into roughly 50 tonnes/tile/year, which at 6.4 hours/month turns into ~50 crates per Simutrans month for a 1024-tile farm. Working backwards from there fitting the yields to the graphs Our World In Data provides, we end up drastically increasing vegetable yields for every time period except 1975 and up. For modern (1975 and up) farms, a typical farm should produce around 50 crates of vegetables per month, while going back in time quickly puts vegetable farms into the single digits, but not quite as low as currently (with 1945 vegetable farms in particular getting a large buff).

Source for potato yields over time: https://ourworldindata.org/grapher/potato-yields?tab=chart

Orchards

To my surprise, this is a case where Simutrans very drastically overestimates production for an agricultural industry with easily obtainable estimates of yields. Orchards are, at every stage of the game, extremely prodigious producers, putting out dozens of crates of fruit and cider every month well in excess of what other types of farms put out, with no particular justification I can find. In-game this manifests as even medium-sized maps only having one or two orchards on them, since any more is usually excessive to consumption. Real-life traditional orchards harvest around 30 tonnes of apples per hectare per year, with modern techniques enabling ~50 tonnes per hectare. Applied to Simutrans and scaled appropriately to Simutrans time scales, this gets us at 10 crates of apples per month for a 128-tile orchard. If we aim for as much cider produced as apples, 1 tonne of apples equals ~600L of cider, which works out to around a 3:1 ratio of crates of apples to barrels of cider. This means cider production takes up around ~1/4 of total apple yields if we aim for equal amounts of both output.

Overall, this results in a quite severe nerf to orchards in-game, with post-1975 orchards producing 15-20 or so crates of each good (when scaled up to ~256 tiles of fields instead of the current 128) and earlier orchards producing single-digit amounts of goods, with a massively higher number of orchards spawning compared to previously.

Source for apple yields: https://wikifarmer.com/library/en/article/apple-tree-harvest-yields
Source for cider yields: https://www.fruitandnut.ie/growingciderapples.html

jamespetts

Thank you very much for your comprehensive attention to this topic. The correct approach, I think, to looking at industry figures that appear to be incorrect is to do the research (and, where necessary, apply a process of deduction) to make them as close as possible to the things that they represent in the real world. If we start intentionally using made-up figures, then we are likely to find that this causes problems in other places, since the fundamental principle is that creating any new asset or system can always rely on the assumption that everything else is calibrated to real life values. This makes balancing manageable and realistic.

Supermarkets

With this in mind, I have been researching UK supermarket consumption. I could not find any direct data on supermarket sales by weight rather than price, so I have had to apply a process of inference. Data are available for annual per capita consumption of various foodstuffs, the proportion of food bought in supermarkets, and the number of supermarkets per capita, from which we can infer the probable rates of consumption for supermarkets. So, we have:

  • 54kg/year/person flour consumption in 2019/2020 (source);
  • 61kg/year/person meat consumption in 2022 (source);
  • 18kg/year/person fish consumption in 2022 (source); and
  • 108.1kg/year/person fruit consumption in 2022 (source).

The number of supermarkets per capita in the UK varies by region from 3.3 per 10,000 people in the least densely populated regions to 2.2 in London (source), but we can work with an assumed average of 2.75 supermarkets per 10,000 people. This means that an average supermarket serves 10,000 / 2.75 = 3,636 people, with a range of about 3,030 to 4,575 people.

The market share of food retailers other than supermarkets appears to be 3.3% (source), suggesting that 96.7% of food is bought in supermarkets.

From that, we can deduce that an average supermarket should sell:

  • 54kg * 3,636 people of flour = 196,344kg/year of flour;
  • 61kg * 3,636 people of meat = 221,796kg/year of meat;
  • 18kg * 3,636 people of fish = 65,448kg/year of fish;
  • 108.1g * 3636 people of fruit = 393,051kg/year of fruit.

The weights per crate of each of the above products are as follows:

  • flour: 840kg/crate;
  • meat: 410kg/crate;
  • fish: 410kg/crate; and
  • fruit: 730kg/crate.

That would thus suggest the following annual consumption of each commodity as follows:

  • 234 crates of flour;
  • 541 crates of meat;
  • 160 crates of fish; and
  • 538 crates of fruit.

Converting to in-game monthly consumption, we take the annual figure, divide by 365.24 for days, and divide again by 16 hours to get the hourly consumption, then re-multiply by 6.4 to get the in-game monthly consumption, giving us as follows:

  • 0.26 crates of flour;
  • 0.59 crates of meat;
  • 0.18 crates of fish; and
  • 0.59 crates of fruit.

However, for end consumer industries, there is another consideration, which is that the amount of space taken by each shop in the game, because of the way that the tile system works, is in excess of the amount of space taken by real shops, so consumption needs to be scaled up accordingly (effectively, reducing our supermarket per person figures).

The 1980 supermarket in game is 3 x 4 tiles. Each tile in the game represents 125m x 125m. 3 x 4 tiles thus represents 375 x 500 in size, or 187,500 square meters.

Measuring a real supermarket, I get 100m x 75m, or 7,500 square meters. 187,500 / 7,500 gives us a multiplier of 25. So, we multiply all of the values above by 25 to get:

  • 6.5 crates of flour;
  • 14.75 crates of meat;
  • 4.5 crates of fish; and
  • 14.75 crates of fruit.

Obviously, the game does not permit fractional values, but we can use the range figure. We need to use the input proportions to have different inputs have different proportions.

We will also need to consider whether to multiply these values by 96.7% to represent the fact that not all food consumed is bought in supermarkets.

Also important to calibrate is the visitor demand. This is because the actual number of products consumed will be based on the number of visitors for any end-consumer industry, and the number of visitors will be based on the visitor demand. The current population_and_visitor_demand_capacity is set to 1,100, which equates to 2,200 in-game. That means that 2,200 people have to visit the supermarket in an in-game month (6.4 hours) to consume the rated demand.

Assuming an average visit to the supermarket of 1.5 times per week per person, and assuming that this supermarket serves 3,636 * 25 (90,900) people, we can calculate the number of visits per in-game month thus: 90,900 * 1.5 = 136,350 visits per week; 7 * 16 (active hours) = 112 active hours per week; 112 / 6.4 = 17.5 (division factor); 136,350 / 17.5 = 7,791. This suggests that the 1980 supermarket should have an in-game visitor demand of 7,791, and thus that the pakset value should be 3,895.

Obviously, if we are recalibrating one end-consumer, we need to recalibrate all of them (or, at least, all of them of like type) for consistency, or else we will end up with unworkable anomalies (e.g. a large supermarket consuming less than a corner shop, etc.).

Agriculture

General
It is worth noting that we should be aiming for most of the countryside covered in farmland, as that is in fact how most of the countryside in the UK is used. It would not be realistic if most of the countryside were wilderness, and this would also not balance economically.

I believe that I did spend some time looking into agricultural production per unit of land and farm sizes some years ago, and I believe that the farm sizes and production rates are based on real figures, so I do not think that these should be changed unless anyone has better figures.

Livestock
It would be a very bad idea indeed to start distorting the real world numbers, as, once one distortion is introduced, anything (and possibly everything) else may break. The problem is not that the livestock industries are too realistic: it is that they are not realistic enough, in that they are too small. We need to have a realistic yield per tile and a realistic number of tiles to make livestock industries workable and for the economics to balance in the same way as real life economics balance.

As to unrealistic minimum production rates, we may need to look into modifying those - although, if the early livestock farms are too small, we may also need to make them larger.

Have you been able to find any data as to the size of individual cattle and sheep farms in the UK in the late 20th century and onwards?

Fruit and vegetables
Thank you for the research on this - that is most helpful. This looks as though it is worth incorporating so as to make the vegetable farms more accurate and balanced. Please do double check that you have calibrated correctly using the methodology described above insofar as it is applicable, however.

Builders' yards/merchants

These are intended as an abstraction of the construction industry - but they should still be calibrated based, not on demand of specific builders' yards or merchants, but the construction industry in general, so that they are an accurate abstraction of the construction industry. The same sort of technique as with supermarkets can be used.

Others

I have not gone through all of the industry types with the same depth as supermarkets, but the way that I have calculated how supermarket consumption should work should give an idea of how to approach any other recalibrations.

Conclusion

Thank you very much for your extensive work on this. I should be more than happy to incorporate any realism-enhancing modifications based on research (and, where necessary, mathematical inference from research) that you are able to come up with!
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.

209CATrus

I can't help but think that the industry in Extended should either:
  • Scale down its production according to consumers available. And by scaling down i mean whole chain, upstream included
  • Get smaller versions of factories. Realistically these should be less efficient, but in the case of a very small map you might have just a couple of builder yards, and the only cement works/brickworks factories available can support dozens at least
  • Export sink. Overseas export, land border export, "wholesale" points in industrial areas. These realistically shouldn't count for chain calculation, so the industry doesn't get tilted. But it might require some extensive discussion regarding balancing the inland consumption versus export. But hey, it's pretty realistic for capitalism industry to just start dumping the goods overseas if it gets profitable anyway


209CATrus

Also, i guess the consumer industry should be divided to essential and non-essential goods, and supermarkets and some other stores like chemists should turn into actual city-wide service.

 See, everyone wants to eat. Hell, even i want to eat now. Industries like supermarkets, builder yards and chemists should distribute the goods to rise the internal service quality value of the city, and otherwise act more like a buffer storage. Because, realistically, if there's just one supermarket (or other essential consumer industry) in the city, it's safe to assume that in real life the absolute majority will get there no matter how, because nobody wants to starve, die from sickness, etc.

Consumption rate of consumer industry should be directly affected by amount of citizens in the city. Cities should count the amount of citizens supplied with essentials, that will of course drop over time without suppliers, and the consumer industry itself should keep consuming the goods according to, for example, measures provided by James. Say, once the supermarket gets supplied with the nearest common denominator of goods versus people, either few crates per citizen or one crate per few citizens gets consumed and for the time being these citizens are satisfied. That is, until the need strikes again


It's 4AM, pardon if i didn't elaborate my idea in a sufficiently comprehensible way

jamespetts

209CATrus - this is probably not the place to discuss completely new ideas about industry features. The way that industry works now is that consumer industries attract visitors and consumption occurs when visitors actually visit (unless the visitor demand is set to zero, in which case the industry assumes that it supplies its customers without them visiting it and depletes its reserves in a time based system), so the consumption rate is (indirectly) affected by the local population density.

Integrating industry consumption with town growth is planned as part of a future town growth project - but I will need to finish the very large task of getting the 15.x branch to work before I start on that.
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.

robly18

Even if currently unbalanced, I would be very happy to play with these additions. I take it that it's not possible to do so yet?