News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

Simple transportation from industry A to industry B

Started by jimishol, August 03, 2022, 06:22:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jimishol

I started a new game some days ago.
On first day i thought 'well, the game basically asks from me to transport goods from A to B multiple times. How should i react so as not to fail fast?'.
I had some thoughts, i made some notes.
This process, that i consider as game play time, was fun, at least for me.
I am about to continue with the main game process. This means, i will press the "Power" button on my PC to power it on.
I hope you will find right my idea to share 16 pages of notes with this forum.
If it seems 'Too Long to Read', there is no need for a reply. I share my notes as ".pdf" file and as a ".tex" for those that would like to correct, edit, delete or create their own notes, not starting from scratch.
I am not in any way specialist on the subject. I am just a player.
For this reason
there is no warranty of any kind for the rightness of my notes on the subject. The entire risk as to the quality and accuracy of my writings is with you. Should be my notes prove defective on your game play, you assume the cost of all frustrations and necessary servicing, repair or correction of your, because of my notes, ruined game.  ;) 
 
P.S.
I renamed from_AtoB.tex to from_AtoB.txt in order to be able to attach it here. Rename it back to ".tex". It can be edited by any program that uses latex.
pdf is here AtoB.pdf

KneeOn

I don't understand much of what was there and I'm sure others who know how the game engine works will be able to contribute a lot more however it was interesting to read just how complex the units are.

Balancing all of the costs Vs the revenue is hard enough without having to do it against time and distance. 

I hope others will be able to pick apart what you've written, it might prove to be invaluable in determining balancing guides!

jimishol

#2
Come on!
All I wanted was to create few simple notes for simple transportation of goods from A to B. I did not expected that such a task could be proved so complex!
I started, at last, my real game and, upon deciding what industry to take care first, I run upon "apothecary".  So, for the kind of completeness, I am forced to postpone my game again.
Apothecary
In my notes, the assumptions was that one can not be payed for more than the production or more than the consumption. On dealing with "demand" the assumption was 'do not let production or consumption stop'. Thus one would transfer the maximum of possible products and maximize his rewards.
Apothecary has storage zero!. So, production will stop anyway once products are delivered (and continue after all products are consumed). So, if production will stop, don't bother at all. Why the game introduced apothecary without storage? It is not only that production stops just after delivery but it will not start till all previous delivered products is consumed. Additionally, with no products in stock, consumption stops as soon as production starts and will remain stopped until next delivery.

Let schedule on 100% load a convoy with capacity 'cp'. I created a table, to follow what happens, with time, vegetable storage, apothecary storage and cargo on convoys, all just after examined times. The assumption on which I worked was that upon returning the convoy to farm after delivery, there was still products to be consumed.

It turns out that no matter what is the capacity of convoys, the power of them to carry goods per month is always consumption*production/(consumption+production).  They will be paid only for that and not for the whole consumption, as it should be falsely assumed in the first place. The average velocity would be such that distance "l" is covered in
L=cp/2*consumption*production/(consumption+production) months

The revenue per month is
Revenue=consumption*production/(consumption+production)*l*(ppd-2*n*cpd/cp)-n*cpm

I trust the above formula only with the assumptions I mentioned and when n=1. That is when the above final flow of consumption*production/(consumption+production) per month is below the capabilities of my convoys and I do not need more than 1 to achieve it.

Lets start play! :D

P.S.
My apothecary needs 4crates per month, 5 farms produce 0.7, 0.7, 1, 1, 1.8 vegetables per month. But they do not produce their sum 5.2 per month actually.
If the above formula for power is applied to each of the line and sum the results, the final result is that the farms produce 4.03 vegetables per month. As the apothecary demands. It can not be coincidence. It is coincidence. Anyway, I believe that the object of the game is so complicated that formulas should be considered tools and not spoilers. That is why i dared to suggest some. Thank you.

PJMack

There are some formulas related to game-play scattered throughout the forum which I agree would benefit consolidation into a single place, however in some cases the formulas are were done with older versions of Simutrans or Simutrans extended so one must double-check with the actual code. 

The apothecary is not supposed to have a storage capacity of zero, that is probably a bug somewhere, and for that case I would recommend saving, switching to public player (There is a known intermittent issue with the GUI when switching players), deleting the offending apothecary, then switch back to the "default" player.

As for calculation of industry shipment, there is some entropy, feedback loops, and rounding involved.
Industry production is at a fixed rate per month, but production does stop when an industry lacks requisite goods, lacks staffing (except for rural producers), or the output goods are full.  Consumers only consume goods in proportion to customers, but manufacturers consumer goods as goods are produced.  Goods are only shipped when there is an cargo route between the origin and destination.  How much goods are shipped per month depends on the average estimated lead time between the producers to the consumer per good type.  The estimated lead time calculation is ridiculously complex but an oversimplification of it is the sum of all expected wait times and expected journey times.

jimishol

Thank you PJMack
Formulas can be game related or theoretical, such as v=l/t or that a vehicle can carry half his capacity per time (https://forum.simutrans.com/index.php/topic,21826.0.html) as i claim in my notes. So, update might need only the first ones. In any case, all can benefit from knowing them.

I read in posts that many experienced players chose to destroy 'harmful' industries. I do not understand exactly why, if the is no line connecting them. Is it because they will be targets of destinations in any case and alter harmfully some indexes the game uses to calibrate the world?

I understood clearly your last paragraph but i want to ask something that puzzles me. Say an industry needs 5 suppliers to satisfy 100% of her needs. If player chooses to connect only 3 of them and satisfy the 60% of industry needs. What will happen in future. Will the 60% satisfaction stay stable? If industry drop her needs to 60% and split it to 5 suppliers again, the 3 active suppliers will sent lower and lower products and production will eventually stop. If she splits her new 60% nneds only to the 3 connected suppliers, the production will be stable at 60% of the initial one.

PJMack

Deleting a useless industry does allow for more (potentially useful) industries to be created.  Currently, the industry code will introduce up to four new chains per month if the the number of industries per capita is too low.  The industry generation code sometimes places industries that would never be profitable to service, or outright impossible.  An example of the former would be a vegetable farm in the middle of a desert island which would require creating a road up to the farm (destroying expensive farmland tiles), to the shore with a dock and creating a depot just for a vehicle to get from the farm to the dock to be sailed to the mainland.  Another example is where a fishing port is on the coast to a different sea than the fishing grounds.  A more debatable scenario is where a player would be 90% of the way to completing a high speed rail line and an industry just happens to appear right where he/she was about to lay the final tracks.

As to under-supplied consumers, they will remain stable at the reduced supply.  As new suppliers become active, they will supply the consumer until the original demand is met.  The only reasons that demand would reduce below the original would be if the industry upgrades to one that needs less of that particular good.

jimishol

#6
The main concept in my pdf file, even somehow complex, seemed small in my head. I didn't like the idea that took 16 pages to be written.
I decided to rewrite it, removing any collateral but essentially irrelevant reflection. New version is much more comprehensive with more strict and clear approach. For those that are bored to read it, this is a summary. The final formula for revenue per month is what one could easily suggest without any theoretical approach. The intermediate result though, that the transportation that a convoy creates, is created only by the half of his loaded cargo, is anti-instinctive. Because of that I, and probably many new players, on the start of their game play used convoys with half the capacity than that they actually needed.
The new edition of pdf is here
I attach his .tex file as .txt. If you download it, rename it to .tex before you use it.

jimishol

Dear my one downloader. I apologize for frequent updates of my previous post. I had to fix the calculation of average velocity to take into consideration the non straight route. I updated pdf and tex files once more and i hope for last time.

To payback for inconvenience, I hope you are familiar with some Computer Algebra System (CAS). I use wxmaxima. If you can follow my pdf it should be easy to follow the .wxm file i attach, in case you are interested to. I use it as initial tool to decide what route would be profitable. But, be aware. Rename it as .wxm in order to be opened by wxmaxima.
It calculates how many convoys i should use to just overpass the demand. It gives revenues for those unscheduled and scheduled. It gives revenue for 1 less convoy too. I chose from them. You will see results as list of 4 elements because i wanted to test 4 types of convoys so capacity, velocity etc was given as list of 4 elements each.

An example of output for beer transport 48km away is

l km, demand goods/month, ppd money/good/km
(%i11) l:48$ demand:2.6$ ppd:0.29$  m:6.4$ dstCoeff:sqrt(2)$
v km/h, cp capacity, tu hours for loading unloading, cpd cost/km, cpm cost/month
(%i17) v:[6,3,5,4]$ cp:[1,4,4,6]$ tu:[5,5,5,5.5]$ cpd:[.09,0.12,0.14, 0.17]$ cpm:[0.24,0.24,0.48, 0.52]$ names:[Irish1,Irish1,pair1Irish,pair1Irish]$ /*piece goods*/


"average velocity is"" "[3.475,1.91,2.986,2.434]
"We need"" "[11.22,20.42,13.06,16.02]" ""cargo to satisfy the demand and"" "[12,6,4,3]" ""convoys to just overpass it."
"Revenue"" "[1.695,23.88,20.46,18.57]" ""from"" "[11,5,3,2]" ""convoys, unscheduled"
"Revenue"" "[-0.6544,22.3,19.14,23.4]" ""from"" "[12,6,4,3]" ""convoys unscheduled"
"Revenue"" "[1.543,24.16,21.92,24.63]" ""from"" "[12,6,4,3]" ""convoys scheduled"
"Scheduled departures every"" "[2,9,9,14]" ""hours and"" "[27.69,50.77,50.77,46.15]" ""minutes, for"" "[12,6,4,3]" ""convoys"" "
"A convoy, unscheduled, needs"" "[27,50,32,39]" ""hours and"" "[37.65,15.29,9.174,26.47]" ""minutes or"" "[4.317,7.852,5.024,6.163]" ""months between departures"
"Every one carried good covers"" "[0.2317,0.1274,0.199,0.1623]" ""of the demand per month"
I would chose revenue 23.88 with 5 convoys in this case. I will not because i have to use deposit and shipyard for 18/month and at least 4 stops with 4/month maintenance, i will earn almost nothing.
Thank you all

jimishol

    I upload a new version of the above .wxm file, as i use it for planning my network. I fixed 1 or 2 copy-paste errors i detected and added more types of vehicles to compare.
    Few notes on how i use it.
    I change only 3 things.
    • The line
      l:109.9/2$ demand:20.3$ ppd:0.22$ m:6.4$ dstCoeff:sqrt(2)$
    • comment the active of active line of vehicle types by adding "/*" at the start of it and
    • make active the line i care by deleting the "\*" from its start.

The .wxm has active his line for livestock. Here i had it crossing a line with about 15 stops where its length was 109.9km. This is equivalent with a simple straight line of "l:109.9/2". Despite the 35 capacity of livestock i use 21, in the type of line because i wanted not to carry more than the demand/month.
When i use it for pax, because vehicles carry passengers and on their return way, i change the normal "ppd" in the double of its value (2*0.09 if i recall right). For mail, if you thing that it returns loaded do the same. If not use the normal value. Of course in the above cases one has to estimate the demand.
When number of convoys in some compared cases equals to 1, then last formula fails because of the division by "n-1=0" and stops the execution of rest of lines. That is why i putted last after schedules for "n" convoys.

That's it. The approach is theoretical and can be used to any transport game you like.

jimishol

#9
Speedbonus

I upload the same above .wxm file as .txt but taking care the speedbonus because it exists in simutrans standard.
The formula where i ended to be used is a little different than that is mentioned in help menu. The speed bonus is actually a penalty if one uses lesser than the base speeds that appear in speedbonus.tab.
revenue_multiplier=max(1+(v/base_speed-1)*bonus/10, 1/8)where 1/8 is taken from my configuration
bonus_basefactor = 125If it cannot be greater than 1 then edit accordingly the above as min(1, max(...)). v is average velocity of your convoy without counting the waiting and loading unloading times. "bonus" is the number as per cent that appears in goods list.

It is of no use to try to understand formula in simple terms. I could not. Just take it as it is. The fact is that revenue decreases very fast as one uses lower than base speeds. I can remember few cases. If bonus is 10, then revenue multiplier is the ratio of my speed to the base speed. In order to get half of the revenue i see in goods list, i have to use a velocity that equals to "(b-5)/b" of the base speed. So, for b=18%, i have to use (18-5)/18=86.6% of the base speed to get half the revenue. If base speed=30 then for half revenue i must use 21.6km/h to get 50% of the revenue. But when, by timeline, the base speed turns to 100 then a forgotten, once profitable, obsolete line of buses will have to earn only the 9.45% but thanks to the minimum revenue restriction it will be 12.5%. Not enough for profit but things could be worse.

jimishol

Update of attachment to previous post.
I planned my first lines in standard. Started at year 1913, there is no loading-unloading time neither monthly costs on vehicles, so I minor updated my wxm file to reflect the changes.

Because speed bonus results was not in clear readable format. I added bonus_basefactor  as parameter, min(..., 1) to limit the multiplier to 1 and done the calculation through map and lambda functions.

cpm cost per month change its meaning to reflect cost for rail, roads etc and stations.

Since distance is not an easy available information, l input it separated to new code line and is given as the coordinates of source and destination  beside the monthly cost of roads or rails etc
l1:[1028, 85]$ l2:[1190, 211]$ length_cost: 2*1.5$
Freight track rustic has monthly cost 1.5. I use 2*1.5 because of I plan a double, go and return, line.

All vehicle inputs from 1750 year from extended is deleted. In my example plan I estimate revenue for Chippy steam and cars for sand.
For input of velocity I give as input format for example 2*50*37/(50+37)
When go loaded velocity differs enough from return empty one then the average velocity is given by "2*v1*v2/(v1+v2)". In above 50km/h is the empty velocity and 37kn/h the loaded one.
For input of cpm (cost per month) I give for example
5*2*72+l*dstCoeff*length_cost
4 cars and an engine use 5 platform tiles. Double because of source and destination platforms. 72 c/month is the monthly cost for platform sttations.
l*dstCoeff*length_cost is the monthly cost for rails.