# Realistic Population Growth

Hi guys,

I have been working on a simulation of a wildlife area with realistic population growth and statistics however I am getting weird values for some of my variables.

I am first trying to estimate the growth rate (r) from the amount of births (b), deaths (d) and current population (pop) using the formula

r = (b - d)/pop

Then I find out the number of individuals added from the carrying capacity (k), growth rate and current pop using this formula

New pop = (pop X r)((k - pop)/k) + pop

I have tested this out in excel with various different types of input data and it works in the spreadsheet, however when I plug it into UE4 I get a growth rate of 0 and even when I set the growth rate to a particular number ie 0.49, I still get a return of 0 added to the population ie no growth recorded.

I have my variables are set as follows in unreal

r = .49
b = pop X .49
d = 30 (deaths are added based on how many are eaten throughout the year by predators, but for now I have put as a value of 30)
pop = 500
k = 3000

I strongly suspect I have put them in wrong as I’m reasonably new to unreal, but any help would be greatly appreciated

Really hard to tell.
But here is something you’ll have to address eventually anyway (which might also be the problem now) float point precision in BP.

Meanwhile… are you dividing by 1 to get a whole and a remainder?
if you only need the integer you could Floor the result…

A bigger picture would be appriciated. offhand. Why +
3000-buffalo pop / 3000 ?

lastly. Try printing out the result of buffalo pop x .49 direct to see if buffallo pop is not 0.
0 x .49 is??? 0
ergo, if you print out 0, you forgot to initialize your default value for the buffalo pop variable.