RandMAX Documentation

By neffets, 27 September, 2006

Documentation for RandMAX utility to manage Your resources in VGA-Planets.

You can specify the build parameters for every planet seperately and you can also give general orders that work for every planet that has no order. RANDMAX v2.g by Steffen Pietsch

currently maintained by Thomas Voigt

        1.1   Use  
        1.2   Version  
        1.3   Aim  
        2.0   Usage  
        2.1   The Taxation  
        2.2   The Option File (RANDMAX.INI)  
        2.2.1     Section 1 (Friendly Codes)  
        2.2.2     Section 2 (Planetorders)  
        2.2.3     Section 3 (Special Codes)  
        2.3   Working Order At All  
        2.4   Using with WinPlan  
        3.1   Formulas involved  
        3.2   nothing  
        4.1   Known Bugs  
        4.2   Version History  
        5.1   Remark  
        5.3   Disclaimer  
        5.4   Freeware  

1.1 Use:

    RANDMAX <-c | -h | -n | -p | -r | -s | -t | -w> <dir> <option-file>
    -cN     tax colonists (with at least N million) with growth-method
    -d      dump ini-file
    -pN     RANDMAX only player N (1,2, ... 11)
    -sN     sell after maximizing all supplies except N (default=1000)
    -n      tax natives with growth method
    -t      tax natives with safetax
    -r      No Randomize; RANDMAX does all except randomizing the FC's
    -w      WinPlan-compatibility-mode (works only with "-p" option!)

    -h or -? gives you a very short help for commandline
    <dir>   subdirectory with your result data

1.2 Version:

    Since 1995/02/13 RANDMAX V2.e7 is available
    Randmax v2.f was not made public.
    Randmax v2.g released september 2006

1.3 Aim:

    Most of the commands that you give your planets are 'routine'
    stuff. You maximize your factories, change your friendly codes
    (especially if you play against the Birds) and you tax your 
    natives. This needs a lot of time and very few thinking.
    RANDMAX will do all these work for you completely automatic 
    while you have still full control over your planets.

    You can specify the build parameters for every planet seperately
    and you can also give general orders that work for every planet
    that has no order.

    RANDMAX allows you to
    (1) Randomize all planets friendly codes (to prevent forgetting
        this and be superspy-"attacked")
    (2) Maximize the factories, mines and defenceposts of your
    (3) Taxadjusting for natives and colonists

    Note : Planets uses several files containing checksums and
    information about the planets version (to prevent cheating
    and planet version changes). It is necessary for RANDMAX to
    find these files (otherwise the checksums would be wrong).
    There are two ways to make sure that RANDMAX has this information.
    First you can unpack the result, run planets and then RANDMAX.
    Running planets before RANDMAX makes sure that all required
    files are generated.
    Second you can keep the data from your old turns in the player-
    directory and you wont have problems. Of course you need to run
    unpack before you run RANDMAX.

    If RANDMAX can't find these files it will generate the files
    of its own and they will contain the shareware register
    information. If you try to access the game directory with
    a registered planets version you'll get an error in planets.

2.0 Usage

    The program is controlled by an option-file (RANDMAX.INI).
    Here are the parts of the file :

    (1) Friendly codes
        There may be some friendly codes that you don't want to
        change (if you want to surrender ships or if you want to
        prevent that allied ships attack your planet). In the first
        section you can tell RANDMAX all friendly codes that it
        shouldn't change.

    (2) Planetary orders
        You can give each planet several orders (to build structures
        and tax natives/colonists).
        You can also give an universal order that works for every
        planet that has no order.

    (3) Parameter section
        There are a lot of parameters that allow you control the
        native taxation.

2.1 The taxation

    All natives and colonists on your planets have a certain
    happiness which is a numerical value between -300 and 100.
    In planets you see only a very rough estimation of the happiness
    (100-90: happy, 89-70: calm, 69-50: unhappy, 49-40 : very angry,
     39-20: rioting, below : fighting).

    Depending on the tax rate the happiness will rise or fall
    (or remain constant). Planets shows you on the build screen
    how the happiness will develop : A 'green' tax rate means that
    the happiness will rise or remain constant, while a 'red' tax rate
    indicates that the happiness will drop next turn.

    Because of some rounding mechanics it would be useful to tax
    always at the highest 'green' rate, but the taxes will affect the
    growth of the natives/colonists . The higher the tax rate the
    slower the growth will be. You might want to find a way how
    you can get better growth and still good taxes.

    Although the happiness change rate is influenced by a lot of
    factors (number of clans, government, temperature) the current
    happiness value won't affect the change. Furthermore the
    tax influence is linear (i.e. if you tax at 20% it will have
    twice the effect as if you tax with 10%).

    This means that (except roundings) it makes no difference for the
    native happiness if you tax them one turn at 30% and then wait
    2 turns with tax 0 or if you tax them 3 turns at 10%.
    But in the latter case you will get less growth.

    RANDMAX allows you to use both methods : Tax at 'safetax'
    or try to optimize growth. Optimize growth means that RANDMAX
    figures out how the happiness will change next turn.
    If the happiness would reach 100 (the maximum) then RANDMAX
    taxes as high as possible (depending on the number of your
    colonists). If the happiness will remain below 100 then RANDMAX
    sets the tax rate to 0 (maximum growth).
    RANDMAX will switch to safetax as soon as the native population
    approaches the maximum.

    Due to the roundings you lose about one percent tax every turn
    you let your natives grow. That means that on planets with a
    low safetax rate (1-3) it may be better to tax at safetax (those
    low tax rates won't affect the growth that much).
    On planets with a higher safetax the natives will grow much faster
    and make up for this loss very soon. (You _do_ want those 15 million
    insectoids or bovinoids, don't you ? :-)

    Note : If the happiness is below 70 the natives won't grow at all.
    So RANDMAX will try to keep the happiness always at 70 or higher.
    You can advice RANDMAX to overtax your natives so that the happiness
    drops below 70 in the turn where RANDMAX taxes rigorously
    (the natives won't grow anyway with 40% tax) but makes sure that
    the natives reach 70 in the next turn (growth happens after
    happiness adjusting). This gives you a longer 0%-tax-time for
    growing (especially for avians).

2.2 The option file

    RANDMAX.INI consists of 3 sections.
    Between all these sections must be separated by ONE line starting with at least
    3 asterisks ('*'). You can use the rest of the line for your comments.

    An example RANDMAX.INI is included to your RANDMAX version.

2.2.1 Section 1: Save Friendly Codes

 The first section contains all friendly codes that RANDMAX shouldn't change.
 If you have no configuration file RANDMAX will keep the friendly codes
 'NUK' and 'ATT' safe and for the new hosts 'bum', 'dmp' and 'con'.
 Since version 2.e7 you can use "?" as wildmark in the friendly codes,
 so "mn?" will match "mn1" till "mn9" but also "mnA" till "mnZ" and so on.

2.2.2 Section 2: Maximize Orders


 (1) general:
    XXX oNNN oNNN ... oNNN

    XXX planetnumber
    o   order (d, f, m, c, a, n, t, s, l)
    NNN number (see description of the orders)
        If you have no NNN then it is set to 1000 (for MAX)

    Maximum number of orders = 10

    There has to be exactly one planet per line!.

    You can give a GLOBALOrder with a planetnumber = 000
    who works when NO special order is given.

    ATTENTION: As delimiter I only accept Spaces (nothing else)
    so an line such:
    12  f,m30,d          is NOT valid (no spaces but commata)

    To have nice-looking ini-files I recommend write leading zeros
    for numbers below 100 (e.g. 013 001 051 ...)

 (2) order description:
    allways as:  option<NNN-parameter>
    No spaces or other delimiter between the option and the number.
    You can omit the number, then for maximizeorders RANDMAX will
    take MAX as number,but for other orders exist DEFAULT-values.

    d       maximize planetary defence up to NNN
            (e.g. d135 means maximize always the defence,
            when we are below 135)
    f       maximize factories
    m       maximize mines

    n       adjust taxes for natives with growth-method
            (for NNN see at 3.section/code="NTH", default=70)
            AIM: is max growing and good tax-collect.
            * on other temperated world growth-method:
              - when they become happier than 100 then tax rigorous!
                (So don't worry about taxes of 55%)
                I adjust taxes that the natives next turn (with tax=0)
                again grow.
              - when the native population exceeds max-population then
                we can tax always with "safe"-method, I understand safe
                as let remain the happines, when it is over 70 else tax
                them the way they will reach happiness=70
    t       tax natives always with safetax (I dont like happyness
            below calm-state) but You can force it also down to
            a happiness of 40 with option t40
            (very angry, 39 then is rioting)
            (for NNN see 3.section/code="NTH", default=70)
    c       adjust taxes for colonists
            NNN gives the minimum population in million
            (c2 means tax only when #colonists >= 2.000.000)
            - method is same as for natives (method "GROWTH")
            - Here the tax-always-with-safetax also works on desert
            and arctic worlds, because there we haven't any growth
            if NNN > 10 then it works as NNN for cth (see code "CTH")
            (NNN default=70)
    a       same as order "c", but for low population;
            tax them with safetax
            with further check for too high taxes without getting
            also minimum one MC more for the last tax-percent.
            (NNN default=70)

 C-Endorders (performed AFTER all other commands)
    s       sell all supplies (to get the money) if no number is given
            sell all except NNN supplies if number NNN is given (def=1000)
    l       disable the commandline-sell-option (see there)
            So set it e.g. on your Bovinoid-planet to safe your supplies
            for Merlins, fighter and fuel.
 135 m30 d50 n c3    means: build mines up to 30 then defences up to 50
                and tax the natives and the colonists (colonists only
                if they are at least 3 millions).

 While RANDMAX works you get
  a "." for every planet with a special order
  a "0" when with this planet the global-order works and
  a "-" if for this planet no order works.

2.2.3 Section 3: special parameters

    This section is only for special codes which ar working globally

    ctx     tax colonists with growth-method
            (optional is a second parameter NN for the million,
            btw. the wished happiness like declared in section 2)
            (see 'c' option in section 2) (NNN default=1)
    ntx     tax natives with growth-method (NNN default=70)
    cts     tax colonists with safetax (NNN default=70)
    nts     tax natives with safetax (NNN default=70)
    nth     (after reaching the maximum population the tax-modus change
            automatically to safe-tax.) Now you can say that it not only
            tax safe (means: stay at the current happiness) but you can
            declare a wished happiness (the number NNN say this)
            If you omit the number after "nth" then default=70
    cth     same as "nth" for colonists after reaching the maximum
            population (number default=70)
    nt%     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 0 % (that means take allways the last tax-%)
    mnt     max natives-tax (in newer host only 20% or below is allowed
            for cyborgs), default is 100.
    mct     max colonist-tax                            (default=100%)
    mmc     max MC's allowed to collect (host 3.2)
    mnc     min colonist (clans) before we tax natives  (default=1 clan(!))
    mcc     min colonists (clans) before we tax colonists. This overrides the ctx 
            order. Example: mcc=3000 will tax colonists only if there are at
            least 300000 colonists on a planet.
    mnn     min natives (clans) before we tax natives   (default=1 clan)
    mnm     min MC to collect before it's worth to tax natives (default=1 MC)
    hca     happychange includes avianbonus (+10). For adjusting of taxes
            I have this in mind, BUT here I mean the check IF I tax or not,
            I have the opinion, that also the avians should get the chance
            to grow(!). When hca is on then also for this check I take
            the normal happychange+avianbonus, and that's why almost you
            will tax them (they would have only every fourth turn the chance
            to grow). I recommend let hca away. (no NNN value)
    not     overtax natives  when using growth-method, normally when RANDMAX
            taxes, you will get a happiness of 70 for Your natives, and next
            turn when they are again 70+HappyChange they wil again grow. Now
            I give you the chance to overtax the natives below 70
            (below to 70-HappyChange), so next turn Your natives will (with
            0% taxrate) become happier to (70-HappyChange)+HappyChange=70
            and they ALSO will grow. For safety I tax only 71-HappyChange.
    cot     overtax colonists when using -"-
    rno     Randomize NO; RANDMAX does all except randomizing the planetary
            friendly codes
    cda     CrystalDesertAdvantage is active for Crystalplayer
    csn     Crystal sinus behaviour enabled (PHOST only)
    cco     Colonists: Climate-limits-population is Off,
            so your colonists can grow (in regular)
            up to 25 million independent of the temperature.
            Optional NNN parameter declares this MaxLimit to
            e.g. 10 million or 20 or 25 million (default=25)
    nco     Natives: Climate-limits-population is Off,
            so your natives can grow (in regular)
            up to 25 million independent of the temperature.
            Optional NNN parameter declares this MaxLimit to
            e.g. 10 million or 20 or 25 million (default=25)
    wpl     Same as "-w" option, player plays with WinPlan
    bas     Borg assimilation safetax: Use only safetax if planet
            owner is Borg and there are still natives (except Amorphs)
    ctr     colonist tax rate in percent. In the default host config
            this should be set to 200 for the Federation and 100 for all
            other races
    ntr     native tax rate, as ctr but for natives

2.3 Working Order at ALL:

    1. The main order is allways the special planet-order
    Only if this didn't work
    2. The 000-order.
    Only if this didn't work
    3. Orders from the 3rd section.
    Only if this didn't work
    4. Global orders from command-line 

    !!! commands from the 3rd section OVERWRITES command-line-orders !!!

2.4 Using with WinPlan

   Since version 2.e3 You can use RANDMAX with WinPlan.
   Because WinPlan use different control-structures You can only
   randomize/maximize one player at once.
   So if You are player7 use:
         RANDMAX -w -p7 game1
   For using RANDMAX You have not to leave WinPlan at all,
   but You to leave the specified player.

3.1 Involved Formulas

 Following formulas were found in the very well documented PHost edition.

 Mathematical Notation

       ABS(X)      Absolute value of X
       ERND(X)     Round floating point to nearest integer. Values that
                   have a fractional part of exactly 0.5 are rounded to
                   the nearest even integer (e.g., 8.5-->8, 9.5-->10)
       MAX(A,B)    Maximum of A and B
       MIN(A,B)    Minimum of A and B
       SQRT(X)     Square root of X
       TRUNC(X)    Truncate floating point by discarding fractional part

 TargetTemp = 100 if planet is Crystal and cfg_CrystalsLikeDesert is ON
            = 50
 TempDivisor = 66 if planet is Crystal and cfg_CrystalsLikeDesert is ON
             = 33
 CHAPPY change = 10 - SQRT(CLANS/10000.0)
                    - ABS(TEMP-TargetTemp)/TempDivisor
                    - (M+F)/300
                    - CTAX*0.8

 NHAPPY change = 5 + NATGOV/2 - SQRT(NATCLANS/10000.0) - (M+F)/200
                   - NTAX*0.85
 If natives are Avian,
    NHAPPY change = NHAPPY change + 10

 MC from colonist tax = 0, if CHAPPY < 40
                      = (CLANS * CTAX * 5 + 2500) / 5000, if CHAPPY >= 40

 MC from native tax   = 0, if NHAPPY < 40 or natives are Amorphous
                      = MIN((NATCLANS * NATGOV * NTAX + 2500) / 5000, CLANS)

             MC = MC * 2 if natives are Insectoid
             MC = (MC * cfg_TAX_RATE + 50) / 100

 For rounding TIM uses the ERND-function. (7.5 to 8 and 6.5 to 6).

4.1 Known problems


4.2 Changes:

     v2.g:  (September 2006)
       - (bugfix) colonist taxation was sometimes off by 1 percent, 
         causing taxes to be 1% too high or too low
       - (bugfix) natives are no longer taxed down to 40 (or the nth value)
         before they reach their population maximum
       - (bugfix) the maximum income (mmc switch) is now checked for the 
         sum of native and colonist taxes, and works correctly for Insectoid natives.
       - (host 3.2/ phost v3.3c change) Siliconoid max population is now 
         100.000*temp  if the cda (Crystals prefer deserts) switch is active
       - (new) added "bas" switch (Borg assimilation safetax): Works if planet
         owner is Borg and there are still natives (except Amorphs). 
         In this case only the safetax will be used, and no tax if the happyness
         is below 96. 
       - (new) tax rates can be now adjusted using the ctr and ntr switches. Please 
         note that you must set this parameter if you play a race with a nonstandard 
         taxrate (i.e. Federation with 200% tax bonus).
       - (new) csn switch added for Crystal sinus behaviour in PHOST. If 
         CrystalDesertAdvantage is ON, then Crystals will grow on arctic
         planets if sinus behaviour is disabled, but they will not grow on
         arctic planets if sinus behaviour is enabled.
       - (new) mcc switch added to define the minimum number of colonists
         for colonist taxations. This could be configured with the ctx option,
         but only in terms of millions. Now you can enter the exact amount of
         clans for taxation. For compatibility, the old ctx option behaves as
         usual, but is overridden by an mcc command. Note that the ctx option
         is still necessary, without it colonists are not taxed.
       - Thomas Voigt () now maintains randmax. Please report bugs
         and suggestions to me.

     v2.f:  added "?" as Wildmark in save friendly codes;
       new "cco" option added for ClimateLimitsPopulation=OFF
       new try to correct the overtaxing option (only 69 happiness (:-(;
       repaired a "divide by zero" bug if You had a low nativepopulation

     v2.e6: corrected notused "cth" while safe-tax-method
     v2.e5: prevent rounding-failures with post-test of the happychange
     v2.e4: MaxOrdersAvail now limited to 20 to save memory;
       now also with Dump-option the comments after the planetorders
       are preserved (up to 40 characters);
     v2.e3: BUG-fix (nt% did not work); new WinPlan-switch "-w"
     v2.e2: only BUG-fix
     v2.e1: 3rd-section-code mmc MaxMCfor host3.2-compatibility;
       now up to 100 safe fc's possible; 3.2-special codes implemented
     v2.e0: dump-option, now up to 20 orders possible;
       now coments are allowed in ini-file

     v2.d4: internal release
     v2.d3: release of v2.d2 ; a40 and t40 now works also when population
       not yet have reached the maximum-population (or if it decreases like
       natives under the oppression of cyborgs)
     v2.d2: BUG-fix for "cth" and "nth"; New code "cda" for CrystalDesertAdvantage
     v2.d1: New codes "nth","cth" (also usable for Lizard-Hiss)
     v2.d0: Planets shows false tax-incomes with insectoids; change my code

     v2.C4: BUG-fix, also with this "nt% Number" when after Number nothing came
       then it would go in an unterminated loop - it would hang. (FIXED)
     v2.C3: BUG-fix, when you had specified nt% and had not enough colonist,
       RANDMAX divided with zero and -> Runtime error. (FIXED)
       New switch for NoRandomizing (-r or code='rno')
     v2.C2: added output-feature. Now you can redirect all written output to a file
       e.g. with: RANDMAX game1 >rand.log         You will get nothing on
       the screen, but all output in the rand.log-file. (Nice for using in
       automated batch-modes)
     v2.C1: now initializing of player-gamedir with '.', in former times, when
       you played all in one directory (without extra gamedir) RANDMAX
       searched in the dir \ for any files that means in the root-dir.
     v2.C0: 8 new special codes

     v2.B2: now multiplayer-option (-pN like -p3 for Bird) works for shareware
       and registered planets-users.
     v2.B1: same as v2.B0, only register-check now works in right order (it
       was something in trouble with the if-then-then-else-...)
     v2.B0: new third section with special codes (= three-letter-codes)

     v2.A1-4: new taxorder a; take insectoid-bonus in min; better roundings
     v2.A:  new orders s and l for selling supplies

     v2.9:  taxadjusting like any other order in RANDMAX.INI

     v2.8:  with taxadjusting (until now only global on command-line)

     v2.7b: Only one byte changed, but without it it maximized false
     v2.7a: Fixed two bugs: 1. gets negative amounts of money and supplies
                          when you already have more Units than allowed.
                       2. Did not sell supplies for getting enough cash
                          to buy further units
     v2.7:  Now support of Maxnumbers of factories, mines and defenses


     v2.5:  Make RANDMAX.EXE independent from my program makegood.exe

24. December 1993: Version v2.04 is the first public version


   Remember that if you use a registered version of planets.exe then make
   sure that you run planets.exe once BEFORE RANDMAX (vputil has the same
   problem) OR you use only sweep.bat instead of clearing the whole

   If You compare the tax-results with other utilities use
   plantabl (by Thomas Voigt) or planets (by Tim Wisseman).
   !!! VPutil have rounding failures, if You are low on colonists,
       so it can happen that You tax one percent to low !!!
   I heard about WinPlan also shows sometimes false infos.

   Dont belief planets.exe if it says "rioting", look in vputil
   first, because planets.exe also says "rioting" with a happiness=40
   what is only a "very angry". (Rioting begins happiness<=39)

5.2 END:

 Please tell me if the program fails. Just zip up all player files
 in the player directory and email them uuencoded to me.
 Email adress of maintainer: spock ON_HOST snafu.de

5.3 Disclaimer:

   This program is provided 'as is', with no explicit or implied
   warranty. I disclaim all warranties with regard to this software,
   including all warranties of merchantability and fitness. In no
   event shall the author be liable for any damages resulting from
   the use of this program.


   This program is free for every person. Please give the program
   to all Your friends.
   (This means you are not allowed to take money or other benefits
   for RANDMAX!!!)

Steffen <neffets ON_HOST neffets.de> Thomas <spock ON_HOST snafu.de>