RANDGEN

Current Author: Hantig Dacian


Modified by Hantig Dacian from last version 1.2a (or 1.3 – I’m not sure) to version 1.4.10 on May 2, 2004.

See “Links to developers” to know how to get in touch with any of them.

RANDGEN is a tool for RANDMAX user. If you don’t know what randmax is then RANDGEN will do nothing for you (except causing headaches 🙂
RANDGEN is freeware. You may upload it to any bbs or distribute it on the internet as long as it serves no commercial purpose.
However, to do so, read the license file to find out more details.

RANDMAX is written by Steffen Pietsch and manages your planets:
It randomizes friendly codes, taxes your natives and builds factories and mines according to an ini file.

RANDMAX and RANDGEN are utilities for VGA Planets, a multiplayer strategy game written by Tim Wisseman.

The list of changes can be found below.

Purpose
=======

I use randmax to manage all my planets. However, it takes a lot of time to set up a randmax.ini and it is rather annoying to change your ini whenever you colonize or conquer a new planet. So I thought it would be a good idea to make a program that generates a randmax.ini for me.

It may also be useful if you host a game and you have to make a few caretaker turns because you are looking for a replacement player.

 

Getting started
===============
If you are familiar with RANDMAX then just start RANDGEN (as parameter the directory where your game data is). It will update your existing randmax.ini, i.e. it will add a ‘second-section’ order for all planets that have no
‘second-section’ order. The old randmax.ini will be renamed to randmax.bak

Please read the section “PHOST and HOST v3.2” if you play with one of these host versions.

 

Version
=======
This is version v1.4
It will work with randmax v2.d1 or later.

New in version v1.4 (modified by Hantig Dacian):
————————————————

Additions:
– Added license the files
– Added a version tracking method
– Added option to change the default tax rate for Feds and the others
– Added option to change the default mining rate for Feds, Lizards and the others
– Added option to change the default the maximum amount of money allowed from a planet on one turn (internal usage when estimating the taxation method)
– Added option to change the default intended happiness when safe taxing natives
– Added options to change the default behavior when generating structure building actions: Now you can specify if you like to have your planets protected by normal scan (begin the action for every planet with “f15 d15”) and/or by bioscan (begin the action for every planet with “f15 d20”), except on the planets that need a different “f???” setting (to optimize the tax flow)
– Added option to change the default Trans Uranium Rate
– Added MANY MORE friendly codes to have all the default special ones (like bum, lfm, trg and many more) used that are not randomized by Randmax, including those from STARBASE+ (since many games tend to have this add-on). The list is not perfect, I know, but it now has the most used of them.
– Added “cda” into the INI file by default (CrystalDesertAdvantage is active for Crystal player)
– Added “nt% 100” into the INI file by default (Gives the wished percentage of MC which has to be collected with the last percent of native-tax. When this percentage isn’t reached then we don’t take the last percent of taxes. Default is 100 % (that means don’t take the last -%) ). This was added due to the fact that games tend to have crappy planets and when you found a good native planet, you want to squeeze the last MC out of it. This parameter should be changed to “nt% 1” for Borg, to maximize the cash in the beginning of the game, when every MC is useful 🙂
– Added “cts 70” into the INI file by default
– Added “nts 70” into the INI file by default
– Added “ntx 70” into the INI file by default
– Added option to specify a number of growth turns to calculate growth of the natives.

Changes:
– Changed the number of turns until the planet should be mined to 20 (due to the fact that new games tend to have the ship limit very early – on turn 20 for example :))
– Changed the minimum native number for taxation to 1 (from 3000). Why leave (every turn) those 10 MCs from low population natives 🙂
– Changed the default number of defenses to 21 (instead of 20) to gain an additional bonus)
– Improved the taxation mechanism (this is quite a lot to explain – read the Appendix 1)
– Removed the rounding to numbers that are multiple of 10 from the number of generated mines and factories
– Removed the minimum number of mines of 20 (some planets do not need minimum 20 mines)
– Removed the minimum number of factories of 20 (some planets do not need minimum 20 factories – I had planets very rich in MCs which, for taxation purposes, needed only 3 factories and 8 mines. These planets are very rare and are pearls, so I decided not to mess them up)
– Don’t ignore the minerals with low density any more (this is very useful for Borg planets that can afford 400+ mines and can extract 40+ of one mineral given the density of 10)
– Extended the maximum number of mines to 600 (instead of 400), since some Borg planets can afford it 🙂 – the rest are not affected
– Modified the old “ctx 1” into “ctx 70” into the INI file
– Removed “mct 20” from the INI file when generating for Borg (not needed since Borg colonists can be taxed normally, only the natives can be taxed to a maximum of 20%)
– Lots of other stuff I didn’t remember (since I developed it for almost a year without publishing it)

Advanced (for developers only)
– Added a PI value, so that it is not hardcoded into the program (in VGA Planets it is 3.14, not the whole number 🙂 )
– Added functions to calculate some complex formulas

What needs to be done more?
– marked all places where things have to be checked/optimized/done with “here” (or “aici” – in places I forgot to translate 🙂 )
– getGrowthForPlanetWith must gain also a current happiness level (so that randgen won’t try to grow them from 40% happiness to 70% happiness – conquered planets for example – when the change in happiness is very low and the grow turns are not permitting this). The current formula estimates the native population growth as it has the happiness of 70%

New in version v1.2:
——————–
– new defaults :
MINETURNS 25 (instead of 30)
nth 40 (instead of 70)
DEFENSE 20 (instead of 0)

– “auto change” (randmax special orders are automatically updated) related -a and -f switches

– fixed problems:
(1) Unowned planets get a randmax.ini entry with the race characteristics of the race that scans the planet. Earlier randgen versions did generate an entry that didn’t take into account race-specific tax and mining rates.
(2) The maximum number of mines and factories on planets with valuable natives was not correctly calculated if there were mines and factories on the planet. Note that there is a new method to calculate the max factory/mine number.

 

New in version 1.1 :
——————–
– -d switch for maximum defense
– mnt 20/ mct 20 lines for Borg planets

 

Usage
=====
randgen [DIRECTORY] [options]

Where options are:
-a : disable auto change (update of section 2 in randmax.ini)
-b : hide the planet from Bioscan (make “f15 d20” and then the order)
-dNNN : add a defense order (dNNN) to every planet (default 21)
-f : force auto change of ALL section 2 entries in randmax.ini
-gNNN : turns number for population calculation (see below, default 30)
-h : hide the planet from Scan (make “f15 d15” and then the needed order)
-iNNN : income limit for factory maximization (default 170)
-mNNN : miningrate NNN (default 100)
-n : generate new randmax.ini (old will be renamed to randmax.bak)
-oNNN : time to outmine a planet (default 30)
-pNN : generate only for player NN
-rNNN : income limit for mine reduction (default 40)
-sNN : safetax limit for growth method taxation (default 3)
-tNNN : taxrate NNN (default 100)
-uNNNNN : max income allowed per planet in one turn (default=5000)
-vNNN : safe tax the natives instead of growing them (default=70)
-x : Trans Uranium Rate

Example :

randgen GAME1 -d50 -t150 -o50 -n

will generate a NEW randmax.ini in the directory GAME1 and use a taxrate of 150%. It will also add a ‘d50’ command on every planet and use an ‘outmine’ time of 50 turns (see below).

Note to the auto change :
RANDGEN will change section 2 entries in randmax.ini. This is useful if small meteors strike, natives appear and in several other cases. Entries in sections 1 and 3 are not changed. For description of these sections see randmax.doc.

There is no update of the mines and factories for planets with valuable natives (where factories are not maximized). The only how these numbers could change is through terraforming (with a different maximum native limit), and auto update here would lead to an increase of the maximum factory/mine number by 160-170 every turn which is exactly what we want to avoid on such a planet :-).
If you don’t like this then turn it off with the -a switch.

If you want an update of all planets, even the ones with valuable natives, then use the -f switch.

If both -a and -f switches are specified then the first of them will be in use.

 

PHOST and HOST v3.2
===================

There are some things you should keep in mind if you play with these host versions.

HOST has a 20% tax limit for Borg planets (except for Avians). If you tax higher than 20% the happiness will decrease normally but you get no extra money. Therefore randgen inserts these limits into the third section of randmax.ini (“mnt 20” and “mct 20”).
PHOST has no such limit so you can delete these orders if you play Borg in a PHOSTed game.

All HOST v3.2 versions (both HOST and PHOST) have a configurable maximum income per planet. Future randmax versions will support this limit so make sure that you add the appropriate line into the third section of randmax.ini.

 

 

How does it work?
==================

General
~~~~~~~
RANDGEN will scan your planet data and your randmax.ini. If it finds a planet that has no special order (in the second section) then it will generate a special order for this planet and add it to randmax.ini.

The old randmax.ini will be renamed to randmax.bak

If you select the /n switch then randgen will rename an existing randmax.ini to randmax.bak and generate a completely new randmax.ini.

The special order for the planet depends on the mineral content and the natives living on it. RANDGEN will try to order enough mines to get the minerals out of the planet core in a reasonable time but RANDGEN will also be careful to build not too many mines in order to keep the natives happy.

 

The Parameters
~~~~~~~~~~~~~~
Here is an explanation for the possible command line parameters.

MINETURNS : randgen will order enough mines to out mine the planet in MINETURNS turns. The default is 20. Please note that usually the mineral with the lowest density determines the required number of mines so most minerals will be mined out a lot earlier (at least if you have enough colonists to build the required number of mines).
The default value is 20 turns.
You control MINETURNS with the /o switch.
MINEINCOME : If your planet has valuable natives then you might want to build fewer mines in order to avoid making them upset.
If you get more tax at 1% taxrate than MINEINCOME then RANDGEN will reduce the number of mines.
Use the /r switch to change the default of 40 MC.
NOFACT : Usually it makes sense to maximize your factories because you will get more money if you build the factories and sell the supplies instead of taking the 1 or 2 percent more tax that you can get if you build no factories.
However, a few natives are valuable enough so that it’s useful to build no factories at all. I call this limit NOFACT and the default value is 170 (because you have to go down 1% for every 170 factories you build).
Change this value with the /i switch.
GROWTURNS : Imagine you have a nice warm planet with few but good natives.
On the one hand you can let them grow for some turns. After that growth period they may be over the MINEINCOME or NOFACT value and you want to build only few or no mines and factories.
On the other hand you may have only very few natives and they would take a very long time to grow to a number that justifies it to build few mines or factories.
So I decided to introduce the parameter that works like this:
I calculate the income per tax% (to compare it with MINEINCOME and NOFACT) for the population that you would get if you let your natives grow (0% tax) for GROWTURNS turns. The default is 30 and you can change it with the /g switch.
SAFETAX : Randmax offers you to tax the natives with a growth method (“n”) or at ‘safetax’ (“t”, the highest possible tax rate without decreasing the native happiness).
If the safetax rate is low then you will lose a lot of money if you tax the natives with the growth method (a result of Tim’s
rounding). If you have a high safetax then the increased growth will make up very soon for the lost money.
The SAFETAX switch decides how to tax the natives :
if the safetax rate is lower or equal to SAFETAX then RANDGEN will tell randmax to use safetax. If the safetax rate is higher then RANDGEN will order randmax to use the growth method.
The default value is 3, configurable with the /s switch.
TAXRATE/MININGRATE : Usually randgen will assume the default taxrates and miningrates, i.e. 200% tax, 70% mining for Feds and 200% mining for Lizards. If you select a different tax/miningrate you do not only change the rates, you also force randgen to use this value for all races.

Details
~~~~~~~

Here is how RANDGEN makes a special order for a certain planet:

First RANDGEN figures out the number of mines that you need to get all minerals out of the core in MINETURNS turns.

If there are no natives living on the planet then RANDGEN will order this number of mines plus maximum factories (even if you have 10 million colonists it’s still better to build factories because you need to decrease the tax by 1 % for every 240 factories you build. 240 factories give you 240 MC but 10 million colonists give you just 100 MC for 1% tax.

(Note that the factory influence is different for natives and colonists: You need to reduce the native tax by 1% for (approximately, not exactly) every 170 mines or factories instead of 240 for colonists.)

If natives are living on the planet then RANDGEN will check if it is worth to reduce the number of factories and mines (only if you are not the Cyborg).
Keep in mind that you have to lower the tax rate by 1% for every 170 factories or mines you build. If you get 100 MCs for every percent tax, then you lose 100 MCs income per turn if you build 170 mines. Once the planet is mined out you still lose the 100 MC per turn but get nothing for it.

So RANDGEN figures out how much money you will get for _1_ tax percent if you let the natives grow for GROWTURNS turns. I call this value the INCOME.

If the INCOME is higher than MINEINCOME then RANDGEN will reduce the mines by the factor MINEINCOME/INCOME. Additionally the maximum number of mines is 200*MINEINCOME/INCOME.
So the more money you can get the fewer mines RANDGEN will build.
However, if INCOME is lower than NOFACT then RANDGEN will still order the maximum number of factories (“f”).

If INCOME is even higher than NOFACT then RANDGEN will try to keep the number of factories and mines as low as possible.
How low is ‘as low as possible’? Well, everything depends on the rounding in Tim’s formulas. There is a number of mines and factories that you can build without losing money (= be forced to go down by 1%) but if you build just one factory or mine more then you have to decrease the taxrate.
RANDGEN calculates the possible population maximum (depending on the climate) and figures out this number. So you can take as much tax at maximum population as if you have no mines and factories at all.
If you should have already more factories and mines than this number then RANDGEN will calculate the number for the highest possible taxrate at maximum population.
Since it doesn’t matter if you build factories or mines RANDGEN will split these numbers between the mines and factories depending on existing structures and mineral content (low minerals cause low mine numbers).

The mine and factory numbers are cut to the highest possible multiple
of 10 (to get nice looking planets :-).

After that RANDGEN decides how to tax natives:
If you have a high safetax value (the tax rate at which the happiness remains constant) then it’s better to tax the natives with the growth method (“n”). If you have a low safetax (<4) then it is more useful to tax at safetax (“t”) because you will lose a lot of money if you tax the natives with the growth method (also a result of Tim’s rounding).
BTW RANDGEN will tax Bovinoids always with the ‘growth’ – method.

RANDGEN won’t let the natives grow on Cyborg planets, it will always
try to get as much money out of them as possible (‘t30’).

 

Notes
=====
– If no -n switch is given then randgen will keep the first and third section
in the existing randmax.ini.
– randgen will always change existing special orders, EXCEPT orders where
a number follows the factory build order (f???). This is because these
numbers won’t be changed anyway and if you terraform you’ll hurt your
income by building more factories and mines than necessary if such an
order is changed.
– defense doesn’t influence the happiness of natives and colonists

 

Related Formulas
================

Maximum mines/factories/defense
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
maxmines = 200+sqrt(clans-200) (or number of clans if clans<200)
maxfactories = 100+sqrt(clans-100) (or number of clans if clans<100)
maxdefense = 50+sqrt(clans-50) (or number of clans if clans<50)

Maximum population
~~~~~~~~~~~~~~~~~~
maxcolonists = 10,000,000*sin(temperature*pi/100)
maxcolonists = 10,000,000*(temp/100) (only Crystals with ‘Crystals like desert’)
maxnatives = 15,600,000*sin(temperature*pi/100) (approx)

Growth
~~~~~~
I figured them out with host314. These formulas were different with host300f, so if you use an older host version you will get a different growth.

Colonist_Growth%=5*sin(temperature*pi/100)/(1+tax_rate/5)
The growth is cut to 0 if
(a) the happiness is lower than 70
(b) the temperature is arctic or desert (<16 or >84)
(c) the maximum population would be exceeded at the current growth rate

Native_Growth%=4*sin(temperature*pi/100)/(1+tax_rate/5)
The growth is cut to 0 if
(a) the happiness is lower than 70
(b) the maximum population would be exceeded at the current growth rate

If you play the Crystallines and the ‘crystals like desert’ switch is on you will get different growth rates for your colonists

growth%=(temperature/20)/(1+tax_rate/5)

Happiness
~~~~~~~~~
Natives:
happy_change=trunc(5+native_government/2-sqrt(natives/1.000.000)
– (mines+factories)/200 – tax*.85)

Colonists:
happy_change=trunc(10-sqrt(colonists/1.000.000)-(mines+factories)/300
– tax*.8 – abs(temp-50)/33)

These are approximations to the real formulas:

Natives:
Happychange = TRUNC[(1000 – SQRT(Native Clans) – Native Taxlevel*85 – TRUNC ( (factories + mines)/2 ) – 50*(10-Native Government) ) / 100]

Colonists:
Happychange = TRUNC [(1000 – SQRT(Colonist Clans) – 80*Colonist Taxlevel – ABS(50-Temperature)*3 – (factories+mines)/3 ) /100]

 

Disclaimer of warranties
========================
RANDGEN is not warranted in any way. If you use it you use it at your own risk. The author is not liable for any damage or loss of data that may occur during regular usage of RANDGEN.

 

Author’s note
=============

If you have suggestions or if you find bugs then please contact me via email:

[email protected] (preferred)
[email protected] (if you can’t reach me at snafu)

You can reach the author of RANDMAX, Steffen Pietsch, at:

[email protected]

 

Thomas Voigt

Links to developers
===================

This section is new and should contain links to all the developers (besides Thomas Voigt).

Hantig Dacian (Dacus)
———————

If you have suggestions or if you find bugs then please contact me via email:

[email protected] (preferred)
[email protected] (backup email address)
[email protected] (only as a last resort)

Dacian

Appendix 1
=========

This is the section that explains the modifications made into the taxation mechanism:

1) followed the formulas from Donovan’s and implemented them into a low-level rounding way

2) Take into account the Avians when growth taxing them and don’t let them get to a happiness greater than 90% (+10 is added to the happiness BEFORE calculating the change in happiness generated by the taxes, so some percents are lost otherwise)

3) Calculate exact number of factories and mines, instead of generating them to be a multiple of 10.

4) Adjusted the formula for calculating the maximum structures on a planet which do not affect the happiness of the natives

5) Changed the happiness point which randgen will safe tax to 99%, 71%, 41% or 31%, since Randmax seems to have problems in safe taxing the happiness 100%, 70%, 40% or, respectively, 30% – it loses 1% when safe taxing.

6) Natives are now taxed to 31%. You’ll lose some factories and mines every turn, but you’ll get money to cover that (by taxing from 41% to 31%)

7) Borgs are now taxed in a much improved manner: Until the native population is assimilated, all the colonists are safe taxed to 99%.

8) (For Borg) after all the natives are assimilated, then switch to normal taxing for colonists.

9) When the colonists are sitting on a planet that does not allow growth, then they are safe taxed to 41% happiness. As soon as the planet has its temperature changed, the taxation system is switched to normal.

… And many more that I don’t remember at the current moment 🙂

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments