Page 1 of 1

[SOLVED] Looking for a (mathematical) growth function

Posted: Tue Dec 22, 2015 12:24 am
by ObscureScience
Hello

I'm currently trying to prototype a RTS/Civ-like game based on statistical simulation of populations. To make it a RTS I indend to have part of the population be manifested as controllable units. So what I'm trying to achive is to have a good function to calculate the number of representatives available at a certain population size.

I'm not "good" at math but I think I want something similar to a logarithmic function, so the number of them grows slower the bigger the population.

What I currently have is just that,

Code: Select all

math.floor(math.log(popSize))
but I'm not satisfied with the results. I guess I want some modifiying factor (that is also a function) so that the growth isn't as fast in the beginning but pans out slower, but I haven't been able to express it. I'm leaning to having the "popSize" be shapingFunc(popSize), however it would be defined.
An estimation of how I want it to look
  • popSize: representants
  • <10 : 1-2
  • <100 : 5-10
  • <1000 : 10-20
  • <1000000 : 100-200
I'm also sure this is quite trivial with someone math training, which I would think a lot of you have. Thank you for any pointers!

Re: Looking for a (mathematical) growth function

Posted: Tue Dec 22, 2015 3:20 am
by davisdude
Here's what I got:

Code: Select all

math.floor( math.log10( popSize ) ^ 2.75 )
Mostly keep in mind the parent graphs. If you want you could try getting really technical and solving for some equation, but I just interpolated values until I got it close enough.

Re: Looking for a (mathematical) growth function

Posted: Tue Dec 22, 2015 3:25 am
by pgimeno
Here's my attempt:

x^0.33333333

That returns:
100 for x = 1,000,000
10 for x = 1,000
4.64 for x = 100
2.15 for x = 10

Re: Looking for a (mathematical) growth function

Posted: Tue Dec 22, 2015 7:10 am
by deströyer
I would recommend using a table of breakpoints rather than a formula. This is way more readable and gives you better control for balancing.

Few people have the math chops to look at a formula like math.floor( math.log10( popSize ) ^ 2.75 ) and intuit what a population of 7,000 would give you - I certainly don't! How would you for example fix this formula if it works fine for the first 10,000 inhabitants and then becomes broken?

Re: Looking for a (mathematical) growth function

Posted: Tue Dec 22, 2015 11:22 am
by ObscureScience
Thanks a lot for the help. I'll try these ideas out for a bit before I tag this as solved.