Population curves

For what's not in 'Top Priority Game Design'. Post your ideas, visions, suggestions for the game, rules, modifications, etc.

Moderator: Oberlus

Message
Author
Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Population curves

#1 Post by Ophiuchus »

I would like to have options to boost early and late population growth and i am looking for a good way to calculate it.

Anybody knows some asymmetric on the x-scale function(s) which:
* are 0 for 0
* are 0 for 1
* have a maximum 1 at m f(m)=max_x(f(x))=1
* strictly growing for 0 < x < m
* strictly falling for m < x < 1

And what i would like to have is actually two functions (f(x,w),g(x,w)) with a weight parameter w which are combined (e.g. multiplied or added) to get something like the current growth curve function h(x) which has its maximum 1 at 0.5 .
* h(1.0-x) = h(x) ; current curve is symmetric around 0.5
* h(x) = (x - x^2) ; we use currently a second order polynom/parabel
* h(x) ~= (f(x, 1.0) o g(x, 1.0)) ; if you add up both functions with neutral weights 1.0, you get something similar to h
* h(0.5) = 1 = max_x(h(x)) = (f(0.5, 1.0) o g(0.5, 1.0)) ; and f(0.5, 1.0) = g(0.5, 1.0)

I could do some piecewise stuff, but if somebody knows some other option i would like to know.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Oberlus
Cosmic Dragon
Posts: 5758
Joined: Mon Apr 10, 2017 4:25 pm

Re: Population curves

#2 Post by Oberlus »

This is only related to the OP (Ophiuchus, I'll move it somewhere else if you prefer).
I think it gets something similar to (part of) what you might be looking for, but in a different way.


I've been thinking on this since wobbly made that comment about how his small or medium planets from start where dwarfed by a single large or huge native planet.

Since the formula for population growth is CURRENT + CURRENT * FACTOR * (TARGET +1 -CURRENT), target population has a great effect.

Turns to reach max population, starting at pop=1, depending on target population:

Target population: turns to max with growth factor 0.005, and with factor 0.008
3: 110, 69
6: 103, 64
12: 77, 48
24: 51, 32
48: 32, 20

Only 32 or 20 turns to reach 48 population? But 100 or 69 to reach 3?
Actually, with target population 48 it needs 6 or 4 turns to reach 3.5+ pop. It's roughly that a planet with target population X times bigger will grow X times faster to the size of the smaller (and infinitely faster from there on).

So I'm thinking it would be better to have a equation less dependent on target population, so that smaller planets are not sooo slow to grow.


CURRENT + CURRENT * FACTOR * MIN(1, 2*(1.05-CURRENT/TARGET))

This does:
- While current < 55% target, growht is +current*factor
- After 55%, each 5% reduces growth by 10% (so current*factor*0.1 at 100%)
So growth rate is the same for a tiny or a huge planet until each reaches 55%, and reduce the growth factor from there on.

Target population: turns to max with growth factor 0.1, and factor 0.05
3: 19, 38
6: 26, 52
12: 33, 66
24: 41, 80
48: 48, 94

A planet with target 16x bigger reaches its maximum population in roughly 2.5x the time.

A factor of 0.06 with Growth policy rising it to 0.09 seems reasonable. Big planets will grow slower than currently, small planets faster.

I also checked out CURRENT + CURRENT * FACTOR * MIN(1, 1.05-CURRENT/TARGET), which starts reducing growth factor from 5%. Compared to the above one, this one makes smaller target pops grow slower than big ones, but the curves are similar. I'm lazy to screenshot and upload the curves though...

User avatar
Grummel7
Space Dragon
Posts: 339
Joined: Mon Oct 09, 2017 3:44 pm

Re: Population curves

#3 Post by Grummel7 »

Oberlus wrote: Sat Dec 25, 2021 7:38 pm So I'm thinking it would be better to have a equation less dependent on target population, so that smaller planets are not sooo slow to grow.


CURRENT + CURRENT * FACTOR * MIN(1, 2*(1.05-CURRENT/TARGET))

This does:
- While current < 55% target, growht is +current*factor
- After 55%, each 5% reduces growth by 10% (so current*factor*0.1 at 100%)
So growth rate is the same for a tiny or a huge planet until each reaches 55%, and reduce the growth factor from there on.
This makes a lot of sense. While there is sufficient space, growth should be limited by the population's ability to replicate / produce offspring, not be how much empty space is available.

Actual formula should of course be

MIN(TARGET, CURRENT + CURRENT * FACTOR * MIN(1, 2*(1.05-CURRENT/TARGET)))

otherwise your curve ends at 1.1 * TARGET.

Btw, would it be a good idea to make the FACTOR species specific?

User avatar
Oberlus
Cosmic Dragon
Posts: 5758
Joined: Mon Apr 10, 2017 4:25 pm

Re: Population curves

#4 Post by Oberlus »

Grummel7 wrote: Sun Dec 26, 2021 2:37 pm Actual formula should of course be

MIN(TARGET, CURRENT + CURRENT * FACTOR * MIN(1, 2*(1.05-CURRENT/TARGET)))
Yes, yes.
Grummel7 wrote: Sun Dec 26, 2021 2:37 pm would it be a good idea to make the FACTOR species specific?
I've thought of that previously (but forgot about it). In MoO2 we had Subterranean to boost maximum population and Population Growth (-50, +50%, +100%) to modify base growth rate.
In FO we only have Population to modify base maximum population, and policies to modify growth.
We could/should to either have two separate species traits:
- Voracious (-25% max population) / Frugal/Scanty (+25% max population).
- Slow (growth factor *0.75) / Fast (*1.25) / Very Fast (*1.5) Population Growth.
Or make Bad/Good Population to have also a multiplier to the growth factor.
I prefer having two separate traits.

User avatar
Grummel7
Space Dragon
Posts: 339
Joined: Mon Oct 09, 2017 3:44 pm

Re: Population curves

#5 Post by Grummel7 »

I would also prefer separate traits.
And I would not try to find sophisticated names for them.

Good/bad population -> affects maximum population, just as now.
Good/bad growth -> affects population growth.

User avatar
Oberlus
Cosmic Dragon
Posts: 5758
Joined: Mon Apr 10, 2017 4:25 pm

Re: Population curves

#6 Post by Oberlus »

+1

Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Population curves

#7 Post by Ophiuchus »

Grummel7 wrote: Sun Dec 26, 2021 8:16 pm Good/bad population -> affects maximum population, just as now.
Good/bad growth -> affects population growth.
we have already good growth trait
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Oberlus
Cosmic Dragon
Posts: 5758
Joined: Mon Apr 10, 2017 4:25 pm

Re: Population curves

#8 Post by Oberlus »

Ophiuchus wrote: Mon Dec 27, 2021 7:03 am we have already good growth trait
:shock:
Where is it? Not in species/common/population.macros.
I know no species with it.

Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Population curves

#9 Post by Ophiuchus »

Oberlus wrote: Mon Dec 27, 2021 8:25 am
Ophiuchus wrote: Mon Dec 27, 2021 7:03 am we have already good growth trait
:shock:
Where is it? Not in species/common/population.macros.
I know no species with it.
sorry, my bad. i thought phinnert was using it (and actually i cant find an implementation for the fast colonization).
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Population curves

#10 Post by Ophiuchus »

ok, population curves basic history and bigger view:

once upon a time we had exponential growth without restriction (pop += pop * growth-factor) until it hit target pop
* so it starts growing with the growth growing
* good: it mostly does not matter where in your empire your population is, you always get the same growth-factor; so besides maxed out planets there is no incentive to move population around
* you would rather want to apply the evacuation effect in batch on full planets so that you can minimize the times you switch to evacution
* bad: exponential steamrolling

now we have an parabolic curve, pop .= pop * (target_pop - pop)
* growth on a planet is symmetric around max_pop/2 on the Y-axis. growth is very slow at the start and end and highest around max_pop/2
* good: feels a bit like restricted growth, no exponential steamrolling
* bad: it always makes a difference in growth where the population is, so there is more micromanagement potential
* for maximizing growth you want your planets about half-full


Some scientific result: in "real life" for humans you have restricted exponential growth which gets changed and flattened with wealth until you get actually some linear(?) decrease. That may be inspiration, but important are the game effects.
careful, generalizations from my experience coming up: "wealth" i would substitute with stability. while growth is higher in low stability, people (try to) migrate to wealth/stability (well actually people often migrate to where they think the wealth lottery has the highest ; they often prefer a low chance at a high return to a more certain chance of low return - probably because they feel have nothing to loose).

if i'd reinvent freeorion population, i would make sure that you always get the same growth in the empire, no matter on which planets the population is. E.g. calculating the total growth based on the total population and distribute that on your planets according to policy/stability.

Side thought: The simplest way actually to implement that would be "no growth". Hm
Oberlus wrote: Sat Dec 25, 2021 7:38 pm CURRENT + CURRENT * FACTOR * MIN(1, 2*(1.05-CURRENT/TARGET))
..
So growth rate is the same for a tiny or a huge planet until each reaches 55%, and reduce the growth factor from there on.
So exponential (non planet size connected) growth until half target pop, and then slowing it down?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Oberlus
Cosmic Dragon
Posts: 5758
Joined: Mon Apr 10, 2017 4:25 pm

Re: Population curves

#11 Post by Oberlus »

I'm digesting Ophiuchus post. If I get it right:
- It would be better to have a constant growth factor to remove the motivation to any form of growth-boosting-through-migration (apart from moving pop from full planets to others). But constant growth factor is exponential growth.
- It would be better to not have a fast exponential growth to reduce steamrolling of the kind the-first-empire-to-colonize-will-always-be-the-most-populated-empire.

The equation I suggested seems to be better at these two points than current equation, but I guess it could start the growth factor reduction earlier, from the very start, to better address the steamrolling point.

Code: Select all

MIN(TARGET, CURRENT + CURRENT * FACTOR * (1 - 0.5*CURRENT/TARGET))
Example of growth per turn with target pop = 20 and FACTOR=0.1:
At current=1: +1*0.1*(1-0.05) = +0.095 (95% of growth factor)
At current=5: +5*0.1*(1-0.125) = +0.4375 (87.5% of growth factor)
At current=10: +10*0.1*(1-0.25) = +0.75 (75% of growth factor)
At current=20: +20*0.1*(1-0.5) = +1 (50% of growth factor)

We could make the growth slower at greater sizes by increasing the 0.5 multiplying CURRENT/TARGET, or make it faster by reducing it. For example, using 0.8, the growth factor at full planets would be 20%.

Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Population curves

#12 Post by Ophiuchus »

To put the exponential growth into perspective, having it only until half target pop makes it 1/4 of a problem. If we have it to a third its 1/9 of a steamroller problem ;)

If we have a difference in growth curves, the question is if it still makes sense for empires to dedicate planets to exponential growth and evacuate those to places with lower growth rate. This would be mitigated if evacuated population goes to less full planets first.
You can still do dedicated synched population pumps though.

Besides total empire population growth, distribution is still important. Especially there needs to be a way to go tall/use metropolis.
You want more population on those planets where you get more bonus per population - that are probably planets with specials and/or high stability.

Another thought: One reason the exponential growth helps small planets is that all colonies start with the same amount of population. In principle one could keep the current curve and let smaller planets start with higher population to get the same initial growth - breaks simplicity and immersion though
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Population curves

#13 Post by Ophiuchus »

I think the only ways of really getting location-independent growth are
  • zero growth
  • exponential growth
  • empire-wide calculation of growth
It might be also that exponential growth of population is not a problem anymore, since the growth of empire is mitigated by influence upkeep. What you think?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
LienRag
Cosmic Dragon
Posts: 2218
Joined: Fri May 17, 2019 5:03 pm

Re: Population curves

#14 Post by LienRag »

Ophiuchus wrote: Mon Dec 27, 2021 10:12 am
now we have an parabolic curve, pop .= pop * (target_pop - pop)
* growth on a planet is symmetric around max_pop/2 on the Y-axis. growth is very slow at the start and end and highest around max_pop/2
I didn't know that Growth was designed to that bad at the beginning of the Colonization.
I think it's a problem actually, as you get very low return from settling planets if you don't rely on flat boni, since the Population stays that low for a while.

My mathematical years are far away in my past, so I don't know what would be the right formula that doesn't bring too much exponential growth ?

Ophiuchus wrote: Mon Dec 27, 2021 9:12 am
Oberlus wrote: Mon Dec 27, 2021 8:25 am
Ophiuchus wrote: Mon Dec 27, 2021 7:03 am we have already good growth trait
:shock:
Where is it? Not in species/common/population.macros.
I know no species with it.
sorry, my bad. i thought phinnert was using it (and actually i cant find an implementation for the fast colonization).
We definitely should...

I playtested the Asteroid whales a few months ago (as a non-colonizable species) and they were nice but basically just another Native.
With the ability to Colonize it would make the game quite different, especially if I can give them both a longer Colonization time and also a very bad growth rate - so they'd play very differently.

User avatar
Grummel7
Space Dragon
Posts: 339
Joined: Mon Oct 09, 2017 3:44 pm

Re: Population curves

#15 Post by Grummel7 »

Re: Phinnert: They have FAST_COLONIZATION, but that only affects how long it takes to start a colony.

Re: Parabolic Curve: The idea is okay and after pondering on it I found that the problem with the current calculation is that it grow quadratic with the target size. I.e. the first step (when you start from 1) is linear to the target size, but towards the middle, it becomes quadratic and that is why big planets fill quicker then small ones.

We could stick to a parabolic curves and still get a result similar to Oberlus' suggestion by using:
Value = min(Target, Value + Factor * Value * (Target + 1 - Value) / Target)

Re: Global growth: How would you implement that? How would you decide which planet gets how many settlers? And will it work independently of supply chain?

Re: Small colonies: Well, new colonies will not immediately produce a lot, that is kind of natural. I often set my colony to supply focus initially, since that depends much less on population size. And of course if you can conquer a big native planet, you will rather build troopers first.
Last edited by Grummel7 on Mon Dec 27, 2021 2:26 pm, edited 1 time in total.

Post Reply