[X3] All about mines' productivity.

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Post Reply
Posts: 428
Joined: Wed, 2. Jan 08, 15:05

[X3] All about mines' productivity.

Post by Mietitore » Wed, 9. Apr 08, 01:19

This topic is in english because all the study was made by italians, with a nice brainstorming thread in italian forum, and I can translate only in english. I'm sorry about this and I hope to see soon this topic translated in your language. :)

Thanks to:
Italian forum Mods and members and in particular to

All the ones who will partecipate to translation (contact your Mod)

Special thanx to:
jorganos (german forum)


Mines... the strangest factory in the X-Universe.

I love to plan my next expansion with precision, I can easily find the balance of a station but I have a problem... how can I choose the right sector with the right asteroid on which I can build a mine that will sustain my complex productivity with raw materials?

This is the question that started this long discussion, all based on the infallible mathematical and logical language, that will lead us to the total knowledge of a mine behaviour... through other questions...

Why, with the change of the asteroid yield, all the empirical results, that we may imagine linear and easy to calculate, are not "so easy"?

Why with different yields we have the same production?

What happens if I choose to install a mine on a yield zero asteroid... or if I install the wrong mine on a wrong asteroid?

Why should I decide to build there and not here?


This topic is the answer to all questions about mines, from empirical sampling to code analysis, from formulae to tables... to the end of mines' mistery.


To start: we want to allow anyone with a calculator in hand (but also paper and pen are good since the simplicity of calculations) to predict how many products a mine will produce knowing already the yield . Others have already developed speeches depth and better articulated about Factories, and Loop Complex.

Here we only talk of mines.

Far from me to give the idea that what follows as the infallibility and the importance of what I first inappropriately called “study”. After all I have not certainly discovered the Maxwell Equations, which only name them lead me to chilling school’s memories!

The "Equations of Mietitore" already named, play a little “different”.

Below we exposed the two "paths" that led to the equations:

1. Experimental – the sampling we have -> data -> chart -> equations closest possible to chart;

2. Analyzing the code - code reading -> interpretation -> adaptation -> equation (discovered by Garga-Potter).

The second of two routes grew after the publication of respect topic, as a result of numerous speeches, but mainly thanks to intense collaboration with Garga-Potter to who, with great personal pleasure (and much boredom by everyone else ...), I had a confrontation in “algebra tongue". The final equation was deduced by him: if anyone is interesting about the whole "gestation" which led to the result I invite you to read the numerous replies to the main post (in italian forum).

Otherwise, if you want to get quick and jump directly to the calculation, go to the end of the post, just copy the table and equations, and take a pen and paper and... Have fun.


Sampling and Analysis
So I decided to sample, during playtime, the various types of mine both Mineral and Silicon to find, once accumulated a certain amount of data to understand what's the relationship is between the yield of an asteroid deducted from the use of Mineral Scanner Upgrade and the potential productivity in time.

Since most of the cycles of stations last a minute and that every production is easily traceable to that unity of time, for convenience, exportability and comparability of the data I have decided to refer to the "minute" (aka 60 seconds).

I don't have made a lot of test indeed, even for reasons of time, but shortly after it was appear, as the rest was predictable, that the relationship between Profit and Productivity is linear, that the plan represented by a Cartesian straight. Consequently that to find had to be a equation of First Instance.

In this image (if you click on the thumbnail is the same in original size), I reported the results of sampling for mines with Profit from 1 to 10 and their graphs that represent the relationship between this and productivity.


As expected the relationship is represented by lines on the plane. The formula for this type of graphic has to be something like

Y = nX + c

So considering Y = Productivity and X = Yield, empirically (or rather doing various efforts), I tryed to understand which value attach to "n" and "c" to come nearer to the representation that the graphics gived back putting in the data of the sampling.

I created and used four spreadsheets to immediately compare real data with the previsions of the formula i tryed. The following images shows some examples:

Ore Mine M

Silicon Mine L

After some hours of lost sleep, I picked out the following formula which I bring up to scratch with some attempts that confirmed the good precision. I tryed to reduce the drifts which creates around real and expected data to minimum. These drifts born probably from the number of sampling which, clearly, if has been bigger it would be more exact.
Nevertheless the formula can be reckoned enough exact... mainly as designed for the game.

I reached these conclusion for the computation of the productivity. Notice that the result, as saied before, is expressed in product units for minute:


Productivity = 0,19 x Yield + 0,2

For more precision remember that 0,19 is a recurring decimal

The drifts of this formula is represented by a sinusoidal function of type X*Sin(X) and, instead of real date, has to be considered nonessential as fluctuate between +0,15 and -0,25 product units for minute. For example, on a value of production of 12 units for minute we will have an error of about 0,25 unts (equal to 2,8%).


Productivity = 0.47 x Yield + 0.4

This is the case in which for time reasons i could less improve, but at least for non excessive Yield the drift seems to be nonessential. As soon as i will have time i will try to improve the computation.


Productivity = 0,5 x Yield + 0,5

Here the drift seems even to be absent, at least for Yield values non excessive.


Productivity = 0,125 x Yield + 0,12

For more precision remember that 0,125 is a recurring decimal.

Also in this case the drift is almost nothing.


For simplicity, but with detriment for the accuracy, con be used the following formula, more "memorized":
1. ORE MINE M --> Productivity = 0,2 x Yield + 0,2
2. ORE MINE L --> Productivity = 0.45 x Yield + 0,45
3. SILICOME MINE M --> Productivity = 0,5 x Yield + 0,5 (..equal to original)
4. SILICON MINE L --> Prouctivity = 0,12 x Yield + 0,12

Lets do some explaining practical examples

Is given a ore asteroid, which yield is Ore = 15, using the formulae we obtain

Ore Mine M formula > Productivity = 0,19 x Yield + 0,2

Products per minute = 0.19 x 15 + 0,2 = 3,08 Ore

Ore Mine L formula > Productivity = 0.47 x Yield + 0.4

Products per minute = 0.47 x 15 + 0.4 = 7.45 Ore

Result: with good precision on this asteroid we can predict mine productivity in 3 Ore per minute in a M sized mine and 7.45 Ore per minute in a L sized one.

Is given a silicon asteroid, which yield is Silicon = 23, using the formulae we obtain

Silicon Mine M formula > Productivity = 0.05 x Yield + 0.05

Products per minute = 0.05 x 23 + 0.05 = 1,2 Wafers

Silicon Mine L formula > Productivity = 0.125 x Yield + 0.12

Products per minute = 0.125 x 23 + 0.12 = 2.99 Wafers

Result: with good precision on this asteroid we can predict mine productivity in 1,2 Wafers per minute in a M sized mine and 2.99 Wafers per minute in a L sized one.

CODE ANALYSIS (joined work by Garga-Potter & Mietitore)

In this part of the topic I will use the plural form, that's not why now I have greatness obsession to use the "pluralis majestatis", but only because all comes out from the collaboration by me and Garga-Potter: without his support I surely had stopped to the empirical phase of it.

I will try to summarize all the phases that leaded us to the goal: if you don't love mathematics I suggest you to jump forward and copy the table and the formula that, after all, you can solve in 30 seconds also with paper and a pen.

Scripts and Parameters
Starting directly from the code part who manage the mine behaviour on X3 (taken by the linked topic by jlehtone, english moderator, who has our gratitude)
Basic_cycletime = rounddown( BASETIME / (Yield + 1) ) + 1 seconds
Multiplier = rounddown( 59.9 / Basic_cycletime ) + 1
Cycletime = Multiplier * Basic_cycletime
Products per cycle = Multiplier * Fab_size
the first problem comes from the knowledge of two parameters without which we can not solve the equations in first and third code line: BASETIME and Fab_size.

To simplify we set: K = BASETIME e J = Fab_size.

These parameters depend on the Mine type we wont to analyze (Ore Mine or Silicon Mine) and on the structure size (M o L).

On the following table you can find the values based on the mine type and size, with which we can calculate the productivity per minute:


So, thanks to the code, now we can define the mine cycle-time (T) and the products number the mine produces for every cycle (P).

The steps
Now products per minute (Pm) are easy to desume from the simple mathematical relation

Pm = 60 * P / T

in which, from code lines, we can change

Pm = 60 * Multiplier * J / Multiplier * T

and with a simplification (Multiplier can be erased)

Pm = 60 * J / T

Now, looking at the first code line, we can replace T with the expression, considering int = rounddown (function that gives the integer part of an argument)

Pm = 60 * J / ( int ( 600 * K / R + 1) + 1

Finally: the formula
Definitely simplifying and balancing the coefficients we obtain the definitive formula to calculate a given mine products per minute, having the yield of the asteroid on which we wont to install it (c.d. Garga-Potter Formula). :D


Replacing J and K with the table value and R with the asteroid yield we will obtain the mine products per minute (Pm).

EXAMPLE 1: We want to know how much a Ore Mine M can produce in a minute if placed on a Yield=15 asteroid.
In this particular case we can set K = 600, J = 120 (from the table) and R=15

First step we solve K / (R+1) = 600 / 16 = 37.5
than we calculate int(37.5)+1 = 37 + 1 = 38
and finally J / 38 = 120 / 38 = 3.15 Ore / minute

EXAMPLE 2: We want to know how much a Silicon Mine L can produce in a minute if placed on a Yield=10 asteroid.
In this particular case we can set K = 2400, J = 300 (from the table) and R=10

First step we solve K / (R+1) = 2400 / 11 = 218.181818
than we calculate int(218.181818)+1 = 218 + 1 = 219
and finally J / 219 = 300 / 219 = 1.369 wafers / minute

EXAMPLE 3: We want to know how much a Ore Mine L can produce in a minute if placed on a Yield=100 asteroid.
In this particular case we can set K = 600, J = 300 (from the table) and R=100

First step we solve K / (R+1) = 600 / 101 = 5.94
than we calculate int(5.94)+1 = 5 + 1 = 6
and finally J / 6 = 300 / 6 = 50 ore / minute

Easy, isn't it? :)


As a direct result of the deep mathematical study about mines, I calculate other equations used to generate four spreadsheets.

These are tables with the data obtained from the mathematical formulae found directly analyzing the script code who manage the calculations in game.

In these tables you can read the data about every single mine in realation with the asteroid on wich it is built accordingly to this


Rendita (yield): Yield of an asteroid scanned with Mineral Scanner Upgrade
Prod / min: Mine production capability per minute (Pm)
Ciclo (sec): Mine production cycle-time in seconds (T)
Prod / Ciclo: Products per production cycle (P)
Celle / Ciclo: Energy needed per production cycle (E)

I will now list which formulae leads to the table data.

R = Yield (in italian is Rendita.. so it's "R")

and considering the parameters table in which

for Ore Mine M: J = 120, K = 600
for Ore Mine L: J = 300, K = 600
for Silicon Mine M: J = 120, K = 2400
for Silicon Mine L: J = 300, K = 2400

we have

Pm = J / ( int ( K / (R + 1) ) + 1 )
Garga-Potter's Formula

T = ( int ( 59,9 / ( int ( K/(R+1) ) +1 ) ) +1 ) * ( int ( K/(R+1) ) +1 )
deducted by script code

P = ( int ( 59,9 / ( int ( K/(R+1) ) +1 ) ) +1 ) * J / 60
deducted by script code and balanced

E = P * K / 100
deducted by samples

Finally here are the four tables we can now generate using the formulae:

Ore Mine M

Ore Mine L

Silicon Mine M

Silicon Mine L


Data emerged from samples and deducted from the experimental equations match with those coming from the script-code, but, obviously those coming from the code returns more accurate results.
There is no doubt that this last equations are, despite of their harder difficuty to resolve, more precise, elegant and correct, but, for the easier kind of expression they hare, due to the lack of parameters, i keep in this topic also the experimental equations, for those who don't love mathematics so much. :D


Thanks to the numerous formulae we found with the long process of this topic, great Garga-Potter, who leaded the creation process, presents us this utility to calculate, fast and easy, the data that now we can obtain.

Here is the link!

Last update: 2008/04/10 18.31

All reported error and comments will be welcome.
Mietitore. :)
Last edited by Mietitore on Wed, 9. Apr 08, 18:33, edited 6 times in total.

Posts: 3548
Joined: Fri, 19. Dec 03, 11:36

Post by |K.O.S.H. » Wed, 9. Apr 08, 08:33

sorry mate.
but ists useless to post an english topic, when text on the pictures is written in italian...
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

Posts: 183
Joined: Fri, 5. May 06, 20:36

Post by cryztal » Wed, 9. Apr 08, 08:43

It's easy to understand...

But isn't it more easy to just plan your complex here for example:

No really need for all these calculations, is there?


User avatar
Posts: 320
Joined: Thu, 12. Aug 04, 14:04

Post by jorganos » Wed, 9. Apr 08, 09:01

I am amazed at the imbalance between ore-mine M and ore-mine L.
Result: with good precision on this asteroid we can predict mine productivity in 3 Ore per minute in a M sized mine and 48 Ore per minute in a L sized one.
This isn't how it should work, since there is a meta-rule. Any (player owned) factory M should output twice the amount a (in X3 hypothetical) factory S would yield, any factory L five times the amount of S, any factory XL ten times the amount of S. Since this appears to work out for Si-mines, I strongly suspect a factorial error in your calculations for the Ore Mine L (or M). Either it should be 7.5 Ore for L and 3 for M, or 48 for L and about 19 for M.

The code corroborates this, M structures have J = 2*60, L structures J = 5*60.

Posts: 428
Joined: Wed, 2. Jan 08, 15:05

Post by Mietitore » Wed, 9. Apr 08, 18:13

yes.. it's 7,89 per minute... as the tables indicates.

I probably sampled something wrong.

Now it's correct...

the right experimental formula for Ore Mine L is

Pm = 0.47 x Yield + 0.4

thank you :)

Posts: 429
Joined: Thu, 1. Jun 06, 20:45

Post by jeanorwin[KBG] » Thu, 10. Apr 08, 14:21

It seems, like it's Script - Please post it into the Script and Modding Forum, thanks..


Posts: 5
Joined: Sat, 24. Mar 07, 22:45

Post by Orngrimm » Wed, 30. Apr 08, 12:57

There is a typo in a formula at the top...
Productivity = 0,5 x Yield + 0,5
3. SILICOME MINE M --> Productivity = 0,5 x Yield + 0,5 (..equal to original)
are both WRONG like you can see very quickly:
SI-Mine L has 0.125 x Yield + 0.12. Why should a M-mine have more (0.5 x Yield + 0.5) than a Large mine?

Later, you state it correctly:
Is given a silicon asteroid, which yield is Silicon = 23, using the formulae we obtain

Silicon Mine M formula > Productivity = 0.05 x Yield + 0.05

User avatar
Posts: 2012
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Wed, 30. Apr 08, 13:58

Tbh, wouldn't it just be easier to use the underlieing mathematics that define how often products are used/made? Namely relvalue.

i.e. Relvalue/60 * yield/25 * station size = units/min
Where station size is ...2/5 for m/l

And then including a rounding "error" term (as the game creates a +c where c is a constant for each race, to account for rounding errors), where the MAXIMUM error term is usually just the above equation rounded up/down (typically up). Also the rounding error is usually worked out at the size = 1 level and scaled upwards accordingly, I would assume that yield 25 is also a basis point.

Further more it might be easier to look at it from a Total output perhour/5.333 hour segment. Where the output is trying to reach some goal, but due to rounding errors will miss it significantly .

p.s by rounding errors I mean inter/no decimal errors

Post Reply

Return to “X³: Reunion - Scripts and Modding”