Simplify CONC_CAMP_SLAVE equation

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer

Post Reply
Message
Author
User avatar
Oberlus
Cosmic Dragon
Posts: 5714
Joined: Mon Apr 10, 2017 4:25 pm

Simplify CONC_CAMP_SLAVE equation

#1 Post by Oberlus »

What is this atrocity?

https://github.com/freeorion/freeorion/ ... ocs.txt#L9

Code: Select all

SetPopulation value = Value + 0.5*(101+Target.TargetPopulation-2*Value - ((101+Target.TargetPopulation-2*Value)^2 -4*(Value*(Value-1-Target.TargetPopulation)-2*100))^0.5)
For better reading in this discussion:

Code: Select all

Value + 0.5 *
    ( 
          101
        + Target.TargetPopulation
        - 2*Value
        - (
              (101 + Target.TargetPopulation - 2*Value)^2
            - 4*(Value*(Value-1-Target.TargetPopulation) - 2*100)
          )^0.5
    )
The equation is indecipherable. Computing the result for different values of Population (Value) and TargetPopulation one gets it's removing a percentage of population (close to 10% of TargetPopulation) that increases when TargetPopulation is small, and that is stronger when Population is around 50-80% of TargetPopulation. The evolution of values is a bit erratic:

Columns: TargetPopulation
Rows: Population as percentage of TargetPopulation
1391521305080
25%-194%-64.6%-22.5%-14.8%-12.0%-10.5%-10.4%-11.8%
50%-195%-66.0%-24.2%-17.0%-14.7%-13.9%-15.6%-19.7%
75%-196%-67.0%-25.0%-17.6%-15.2%-14.4%-16.7%-23.0%
100%-197%-67.65%-24.6%-16.2%-12.7%-10.3%-9.0%-11.6%
I suggest to change formula for something simpler, independent from current population, with mostly equivalent effects in-game:

Code: Select all

SetPopulation value = Value - (1.5+0.1*Target.TargetPopulation)
1391521305080
-160%-60%-26.7%-20%-17.1%-15%-13%-11.9%

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Simplify CONC_CAMP_SLAVE equation

#2 Post by Geoff the Medio »

Looks like it was developed over time... Relevant commits:
https://github.com/freeorion/freeorion/ ... cca0a3be1a
https://github.com/freeorion/freeorion/ ... 73f75R1440
https://github.com/freeorion/freeorion/ ... ea90bdR676

Looks like it is, or was, reducing the population by some amount on top of or instead of other changes from other effects. It's not intended to be a simple percentage relationship, but rather compensating for the variable rate of growth depending on the current and target populations.

Post Reply