News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Industry spacing

Started by jamespetts, February 03, 2014, 09:46:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

There has been some discussion in the thread relating to the current Bridgewater-Brunel online game about the spacing of industries from one another in the chain, which currently seems to be very high. The maximum space of industries apart from each other can be set in simuconf.tab: it is currently set at 33% of the size of the map, which, in a large map, can be very big indeed. There is also an option to set it as an absolute value, which is not currently used. There is no means currently of this changing either with industry type or over time.

What are people's views on a sensible value for these figures, bearing in mind that it would be a great shame for cargo aircraft later in the game to go unused? Would it be worthwhile spending quite some time coding a new feature allowing these values to be set per industry?
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.

The Hood

Surely the longer term answer (especially for experimental) is to have distances depend on possible travel times, so in early ages it's not far and with aircraft it can be the whole map...

ӔO

is it possible to vary this number as the timeline progresses?
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

jamespetts

Hmm - the trouble is that calculating "possible" travel times, as opposed to actual travel times, is no easy thing: certainly, there is no code for it at present. Would one try to calculate possible travel time for a particular location (a remote island with no space for an airstrip, for instance), or a minimum theoretical travel time assuming the best transport infrastructure currently supportable? How this would work with aircraft would get very complicated; in reality, they are only economic for long journeys and can only start and end in a few fixed places (airports), but trying to calculate the time taken to get to airports and work out whether a journey would ever realistically be made by air (a 70 mile journey over land almost certainly would not be, for example) is almost unimaginably complicated.

If anyone can think of a simple but reliable way of doing this, that would be most worthwhile.
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.

Sarlock

I don't think the code was working to begin with, if I recall from previous testing with the same map (and didn't work in standard either).  I have several chains that are almost the entire length of the map, from the far island to the far island.  Very profitable, but the trips take 70+ game hours to make (which is 11 months).

Check out colliery, [96,926] linked to coal merchant [6812,689].  You can pretty much open any industry and look at the bottom (furthest) connection and see that it is generally well over 33% of the map.

I think that setting a map percentage limit would work fine... you can always change it according to the size of map that you generally play.  If this map was limited to 33% these chains would be much easier to connect up.
Current projects: Pak128 Trees, blender graphics

jamespetts

Ahh, this does not work? Hmm, that is a bug that will need to be fixed, in that case. Moving this thread...
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.

Sarlock

This topic was the initial discussion on this subject and may contain some insight to assist.
Current projects: Pak128 Trees, blender graphics

jamespetts

Thank you for spotting 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.

AP

#8
Slightly rambling post, but bear with me...  ???

If you assume that in 1750 the maximum radius desirable for industry chains is 'small' (without defining that, yet), and that in 1850 it was 'bigger' and in 1950 'even bigger'; that suggests the radius should (somehow) increase with time. Whereas at present we have a fixed unchanging radius.

How you make it increase depends on how complex you want it to be. Given that an accurate representation of thee 'increase in potential travel time/distance' seems to be a complex computational task by itself (even if you can agree a method),  a crude approximation would be better than nothing. But it might need constraining in some way...

Consider something basic like
(year-1749)/10=x

1750 yields 1
1850 yields 10
1950 yields 20
2050 yields 30

I'd be interested to see some data, but given that we now routinely ship oil and products halfway around the globe, I'm not sure if that kind of multiple is a bit too conservative.  I suspect a logarithmic function would be a closer approximation.

However, if you consider the sort of industries we have, there is no way the same radius is appropriate for iron ore as for milk. Consider the industries split into two 'families' - one is sensitive to time, the  other cares not at all.

I'm half wondering if there should not be any radius restriction on a bulk non-perishable commodity like grain or iron ore, even in 1750. But if we start spawning bakeries only taking exotic grain, it would be odd. There needs to be a decent amount of interlinking amongst industries near to each other.

I think a related issue is that  the game rewards us for transporting things long distances even if the same goods is available nearby. This would be worth fixing. But some commodities ARE scarce, and so should be worth transporting long discances. We need both. Perhaps the game code should decide (at the start) what is scarce on any given map, and make longer than normal routes for it.

The only way I can see to fix the pricing issue would involve each consumer industry paying a different price for goods - a crude representation of the market e.g.  capping the amount it would pay for e.g. coal at a figure calculated using the ratio of the distance the coal was carried vs the distance of the closest colliary (with surplus). So if you go 10x further than necesssary, you get 1/10th the amount you would now. But if the nearby colliarys are at capacity, going further afield would be worthwhile...   I have no idea if that kind of mechanism is even possible.

Here endeth the ramblings.  :)

The Hood

Quote from: jamespetts on February 03, 2014, 09:59:17 PM
Hmm - the trouble is that calculating "possible" travel times, as opposed to actual travel times, is no easy thing: certainly, there is no code for it at present. Would one try to calculate possible travel time for a particular location (a remote island with no space for an airstrip, for instance), or a minimum theoretical travel time assuming the best transport infrastructure currently supportable? How this would work with aircraft would get very complicated; in reality, they are only economic for long journeys and can only start and end in a few fixed places (airports), but trying to calculate the time taken to get to airports and work out whether a journey would ever realistically be made by air (a 70 mile journey over land almost certainly would not be, for example) is almost unimaginably complicated.

If anyone can think of a simple but reliable way of doing this, that would be most worthwhile.

Standard used to calculate speed bonuses by determining the average speed of vehicles available for purchase at that time. I wonder if you could reuse that code to calculate a typical speed and then use that to multiply by some acceptable transit time to get a spacing?

jamespetts

This is potentially a vastly complicated issue. Firstly, the (probably insurmountable) difficulty with ideas based on time or straight line distance is that neither takes account of the actual transportability of goods from the particular origin to the particular destination: goods that can go by air, for example, might be transported orders of magnitude upon orders of magnitude faster than goods that must go by sea over the same straight line distance, even in the same era. Would it make any sense for a dairy farm to open on 1985 on a small island with only a port whose customer is 600km away merely because, if the island happened to have an airport and there was a direct air link, the milk would be transported within reasonable time? Conversely, if we assume ship speeds for everything, air freight (and long distance road and rail haulage) will be unusable. We cannot base the distances on actual travel times, since there usually are not actual travel times until the industries are built and players actually link them.

As to the same goods being available nearby, the idea (originating in Standard) is that industries have particular contracts with particular industries, so that the people who run the industries, not the people transporting the goods, decide which industry's goods to buy. In principle, at least, this is realistic and desirable. The trouble is in finding a realistic way to make the selection.

Incidentally, as to industries paying prices for goods, one must be careful not to conflate the price of the goods themselves with the price that the transport company is paid for hauling them: the former affects only the end purchaser of the goods, not the transporter. The fares for goods in the game are currently based on actual (relative) prices charged by 19th century railway companies.
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.

Sarlock

I had to take a long road trip last week (700km round trip) and I spent a lot of time thinking about this very issue: the nature of industries and the freight systems that connect them.  This applies both to modern freight systems and those of earlier eras: the fundamentals remain the same, it's just the technology and economics that have changed over time.

There were hundreds of long haul trucks on the road, hauling all manner of miscellaneous freight.  I tried to determine what freight they were hauling, where it was likely from and where it was going to and how that applies to a Simutrans simulation.

What one quickly determines is that goods are flowing in every direction, almost in a random fashion, and sometimes even the same good is passing by each other on route to the opposite destinations.  Logs go by one way, bound for a sawmill, then logs go by the other way, bound for a sawmill.  Different quality of wood, different type of wood, etc.  One sawmill demands one type, another demands a different type.  To Simutrans these are all "logs"... and perhaps we have simulated this complexity correctly: one sawmill demands logs from forests A, B and C.  Another sawmill demands logs from C, D and E.

The difficulty we are running in to is one that is a recent phenomenon in regards to Simutrans.  Running a game on a 7000x2000 map wasn't something that was done just a couple of years ago.  Computer speeds have advanced to allow us to play on such maps with surprising performance (1,800 convoys on a 7000x2000 map and my system can still accelerate to 30-40x speed, which is amazing).  What was once not an issue on a smaller map, industry spacing, becomes apparent on a massive map such as this one.  But remember: industry chains that are linked across 4,000 tiles are only 500km apart.  Certainly well within the realm of reasonability as far as freight distances go.  Once we have faster convoys, this journey becomes much quicker.  It's just that right now, with a maximum ship speed of 15km/h, this distance is massive... and with a game running at normal speed, the waiting time for a turnaround trip is huge (24 real life hours for some round trip journies).

Having the industry spacing maximum working would limit this spacing to 33% (as per current settings) which would mean they are only ~2,500 tiles apart at maximum.  This would work extremely well with this map and eliminate all of the cross-world freight runs that we currently have.  It would also limit the profit potential significantly as well.  Long freight runs are much more profitable than short runs: with operating costs nearly negligible, you want to run as long of a distance as possible to maximize your revenue.  A short run can turn around faster and uses less ships but your per cargo unit revenue goes way down... and since we are limited not by convoy number but by factory production rate, we want to maximize our cargo revenue as much as we can - thus picking the longest possible freight route.  Reducing these down to 33% maximum map distance would significantly reduce huge freight profits.

We could consider a mechanism to increase the maximum spacing as years wear on, but this may not be worth the coding required to do this.  Although perhaps once the spacing code is working correctly this is an easy thing to implement.  The good thing about a limit to spacing is it reduces the overall number of convoys required to service a map.
Current projects: Pak128 Trees, blender graphics

Vladki

I'd like to contribute to this interesting discussion. I think the distance should not be capped by max value. What about using different random function that is defined by max probability but allows extremes in both ways. I dont remember the name but the graph is the bell shaped curve. This would put most of industries at a defined distance either km, tiles or %. But it would allow for a few industries close to each other as well as far far away.

Moreover the optimum distance could be a function of time - shorter in earlier times and of speed bonus - shorter for higher bonus. Perishable goods usually travel shorter distance while bulk can go anywhere.

Sent from my GT-I9000 using Tapatalk 2


Sarlock

The trouble is that as long as there is one long distance route available, the player will nearly always pick it as it is the most profitable... thus the maximum.
Current projects: Pak128 Trees, blender graphics

jamespetts

Thank you for your very interesting thoughts, both Sarlock and Vladki. That is most useful. There are two further difficulties, I think, that make simply fixing the industry spacing to work with reconnexions as well as newly built industries problematic. Firstly, in the later game, air freight would be of little use with industries limited to 33% of the map's width. Secondly, we still have the issue of farms and perishable freight, which it really does not make sense to allow to be hauled even 15% of the map in 1750.

One thing that might work slightly better is to have a maximum distance specified individually for each industry, although this would still give rise to considerable difficulty, especially in the later eras when high maxima take no account of topography or transport infrastructure. I should add, however, that making this work with reconnexions as well as with newly built industries might be very difficult indeed.
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.

Sarlock

I had a realization that freight should really behave more like passengers: each piece of freight produced should, if we're modelling reality, be given a destination that it wants to reach from the list of connected industries.  I'm sure this would be a huge challenge to code, however (and may have gameplay balancing issues-or maybe not, it would just completely change how we handle freight)... so maximum distances will have to work for us.  We could set a "maximum factory distance" for game start and gradually move in a linear fashion to 100% by a set year, like 1950.
Current projects: Pak128 Trees, blender graphics

Vladki

Perishable goods like food have usually high speed bonus. We could use it to reduce the max or optimum distance accordingly.

For reconnection one could run the random function and search within that distance. However i'm not sure how reconnections really work.

Sent from my GT-I9000 using Tapatalk 2


AP

Quote from: Vladki on February 05, 2014, 04:59:24 PM
Perishable goods like food have usually high speed bonus. We could use it to reduce the max or optimum distance accordingly.

If you rely only on the speedbonus, you risk industries spawning that it could never be profitable to link (for many years). E.g. milk farm and dairy in 1750. If the income drops quickly to nil, only a novice would connect two very distant industries using a slow sailing ship. Everyone 'in the know' would wait until air freight became available before touching that industrial pairing. Which means you're essentially cluttering the map with useless entries.

sdog

Even if quite a lot of work would be put in an improved industry spacing code, it would still be an extremely crude and inaccurate representation of the real world distribution of industries.

With that amount of work, one could instead create a resource based industry model, which would solve spacing in a more realistic way.

When placing a steel mill one would try to place it as close as possible to the resources it requires, namely coal mines, ore mines. It also had to be near a sufficiently large river and a settlement to provide labour. The absolute travel times would not matter however, only the fact it is optimized, as all competitors would have the same difficulties when sourcing their resources, in turn market prices would increase (in the restricted economic model simutrans assumes beyond what is actually simulated, ie consumers consume until saturated)*.

This leads to a simple optimization problem. The two constraints, city at a navigable river, reduces the number of possible options quite a bit.


It does not work however, when coal mines and ore mines are scattered randomly over the map. As more than one mine is required of each kind. Optimizing for the nearest would produce rather arbitrary and random results. Optimizing for the average position of the mines would just end up with being close to the centre of the map.

To solve this either clustering (i) rules for mines or a resource map layer (ii) would be needed.

(ii) A rough way to get a convincing one is to select a random point on the map define the area within a random radius around it as base resource zone. For mines form the differential of the height, when it is above a minimum value it is sufficently rough to count as hills. Such zones, when within the resource radius zone and above sea level become flaged as resource zones. This flag then becomes a constraint when randomly placing mines for that resource.

This would require either a table where resource zones are listed, or another word for map tiles.


(i) Alternatively, could isidoros water affinity and city clustering code be abused for primary resource industry placement? To create clustered coal mines, averse of water?


tl;dr
Don't overcomplicate a system that still remains artifical, arbitrary and crude.
Travel time does not matter at all, only optimum distance to resource industry is required (closed markets, no definition of price of products)


*example: late stone age silex industry distributed products over whole of europe, likewise early bronze age with copper axes. Travel times in the range of months or years.

jamespetts

These are some very interesting ideas; but the labour to develop them is not available currently: there is currently a large backlog of work. A per industry radius might be quicker to code and little enough work to make it into a reasonably soon version, however.
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.

zook2

I'm pretty sure that in the Middle Ages, grain was already shipped from eastern Europe to Britain. In the 19th century (and probably the 18th, too), grain was shipped from India to Britain. The sailor's wages were probably negligible and you get the wind for free; maybe the cost of capital for a long journey was actually the decisive factor which determined profitability. As far as realism is concerned, I'm not sure if such a distance cap would be the way to go.

Vladki

That is why i suggest changing the distribution function so that there is no cap but an optimum. At any time in history there was a cargo traded around the globe, just the amount was small before the advent of railways and steamships. Think of silk road and trans siberian railway.

Sent from my GT-I9000 using Tapatalk 2


Sarlock

Quote from: zook2 on February 06, 2014, 07:19:21 AM
maybe the cost of capital for a long journey was actually the decisive factor which determined profitability

The biggest risk was the loss of the ship and the cargo within.  In fact this is the origin of the modern corporation as we know it - to spread out the cost of loss of a ship and limit the liability of the shareholders.

A long distance haul only makes sense if the market value at the destination is worth the journey cost.  If the resource is scarce at the destination, you can command a good spread on goods' value to cover your costs (and profit).
Current projects: Pak128 Trees, blender graphics

jamespetts

Quote from: Vladki on February 06, 2014, 07:43:07 AM
That is why i suggest changing the distribution function so that there is no cap but an optimum. At any time in history there was a cargo traded around the globe, just the amount was small before the advent of railways and steamships. Think of silk road and trans siberian railway.

That is an interesting suggestion - how do you envisage that working mathematically?
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.

Sarlock

Had a thought tonight, a simple way to help address this issue with minimal coding required and not having to delve in to fixing the maximum industry distance/spacing which I think may be a bit trickier than it seems on the outside.

Why not have the "new industry link" function search for several potential candidates instead of just one?  And then pick the closest of that bunch.  You can set it to reduce the number of searches in later years, if desired, to have longer links start appearing in later years.  You could, say, do 3 or 4 searches from 1750-1850, maybe 2 in 1850-1925 and then just a single search (as it does now) after 1925.  This could be a configuration/setting option.  In a larger map like the online game, 3 or 4 searches would reduce the average distance drastically.  There would still be the odd long link but the majority of links would be within a tighter radius.

This accomplishes distribution of industry links that is biased towards nearby industries, still has a few longer links and requires (I think) very little additional coding.
Current projects: Pak128 Trees, blender graphics

jamespetts

This is an interesting thought - I will have to consider that. However, the current system is far from random: consumer industries are generated first, and supplier industries are linked based on identifying unfilled demand. It has been a while since I wrote the code, so I cannot recall all the details now, but I seem to remember there not being much scope for further choice beyond the parameters already imposed.
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.