What does MINERAL_RANDOM_FACTOR mean in the constants.js?


  • Culture

    I've found this variable today, no clue what it does or what it means.


  • Dev Team

    It is used in mineral deposit regeneration formula:

    regenerationAmount = Math.floor(MINERAL_MIN_AMOUNT[mineralType] * (1 + Math.random() * (MINERAL_RANDOM_FACTOR - 1)))

  • Culture

    Ah cool! Thanks a lot for the quick reply



  • Just to clarify for future readers:

    "The minerals can regen to any number between MINERAL_MIN_AMOUNT and MINERAL_RANDOM_FACTOR times that amount."

    For most minerals, that means between 70,000 and 2 times that (or 140,000).

     

    The random factor is the maximum potential percentage of minerals that can spawn, relative to the MINERAL_MIN_AMOUNT. The actual percentage is a linear probability between 1 (100%) and the MINERAL_RANDOM_FACTOR (currently 2, or 200%).

    If the random factor was 0, then the MINERAL_MIN_AMOUNT would actually be the maximum, and it might spawn as little as 0.

    If it was 1, then minerals would always regenerate to exactly MINERAL_MIN_AMOUNT.

    And if it was 10, then we might get anywhere from MINERAL_MIN_AMOUNT to 10 times that.