Population increase not working

Hi

As per the readme, I see the population will increase with food, however when I just get food, this never increases, is there perhaps something missing in the readme?

Population Growth/Decline Rate

The population will change depending on the amount of food harvested. This process happens every 10 ticks

if the population has a surplus of food the the population will increase based on the current tier level

eg:

total population = 5
tier level = 0
increase factor = 1
new total population = 6

You need heat as well, since this is a winter snow base game the people want fire to cook food :slight_smile:

And to advance to next population tier you need the resources given in the next tier to be able to go past the current tier max population

1 Like

Definitely somethings that they should add to the readme. Like, how is heat used, and the commands. By playing around with everything, you get the feel of how everything fits together, because getting real work done or info from the EC team is non existent the last 2/3 weeks. No communication from them.

But if you interrogate the actual Engine and the config, you will get a lot of stuff to work with such as what the actual Resource Tiers are (which should be in the read me, IMO), and what you need.
I actually saw today that stone are actually used by the engine, so you need to have more resources (Food, Wood for Heat and stone) than your population to increase it.
But there is weird things happening to my population, like I have almost more than double the resources than population, but the population will still go down after a ‘feeding’ cycle.

I had the same issue, i found that heat needs to be double atleast, stone is not that important you neet atleast population × 0.2 to sustain population consumption.

I dont know if this is an unintended feature, or a bug but It doesn’t really matter to me cause the more heat and food you have the faster your population grows.
So if one player have just enough to sustain population it will grow by 1 or 2, but if someone has 3 × population it can grow by 3 or 4.

This is just assumptions based on what I experienced.

Hi @styphoiz, @Kortgat and @AtomicNomad

Thanks for bringing this to our attention. I will speak to the team to get some clarity on this and get back to you all with an update.

2 Likes

Some interesting things I found in the CalculationServices for the engine. I think these are bugs that might need to be fixed, but fixing them will break my Bot. :sweat_smile:

       private int GetFoodConsumption(BotObject bot)
        {
            return (int) Math.Ceiling(bot.GetPopulation() * engineConfig.UnitConsumptionRatio.Food);
        }

        private int GetWoodConsumption(BotObject bot)
        {
            // TODO: Add the heat consumption stuff here
            return (int) Math.Ceiling(engineConfig.UnitConsumptionRatio.Wood);
        }

        private int GetStoneConsumption(BotObject bot)
        {
            return (int) Math.Ceiling(engineConfig.UnitConsumptionRatio.Stone);
        }

        private int GetHeatConsumption(BotObject bot)
        {
            return (int) Math.Ceiling(bot.GetPopulation() * engineConfig.UnitConsumptionRatio.Heat);
        }

This means that your wood and stone consuption will always be 1 every day-night cycle, irrespective of your population size, which is not what the appsettings suggests by saying 0.5 wood per person and 0.1 stone per person.

Then, the appsetting says the importance for food is 1.2 and for heat it is 0.9. The calculation for this is:

var heatSurplus = (bot.Heat - GetHeatConsumption(bot)) * engineConfig.ResourceImportance.Heat;
var foodSurplus = (bot.Food - GetFoodConsumption(bot)) * engineConfig.ResourceImportance.Food;
var minResourceSurplus = (double) Math.Min(heatSurplus, foodSurplus);

So only the least of the two between heat and food is taken into consideration for the population growth calculation. Wood and Stone is technically not required for population growth, except when going to a higher tier.

The above calculation is also a bit counterintuitive. Let me explain:

The code also has a section where it caps the minimum resource requirements.

var populationRangeMin = bot.Population * -0.5;
var populationRangeMax = bot.Population * 0.5;
minResourceSurplus.NeverLessThan(populationRangeMin).NeverMoreThan(populationRangeMax);

So for arguments sake, lets let my population be 100. To get maximum growth I need my minimum resource (heat or food) to be on the limit. So the limit is:

100 x 0.5 = 50

So rearranging the above equations I get:

heatSurplus = (bot.Heat - GetHeatConsumption(bot)) * engineConfig.ResourceImportance.Heat
heatSurplus / engineConfig.ResourceImportance.Heat = bot.Heat - GetHeatConsumption(bot)
(heatSurplus / engineConfig.ResourceImportance.Heat) + GetHeatConsumption(bot) = bot.Heat 
(50/0.9) + 100 = bot.Heat
156 = bot.Heat

foodSurplus = (bot.Food - GetFoodConsumption(bot)) * engineConfig.ResourceImportance.Food
foodSurplus / engineConfig.ResourceImportance.Food = bot.Food - GetFoodConsumption(bot)
(foodSurplus / engineConfig.ResourceImportance.Food) + GetFoodConsumption(bot) = bot.Food 
(50/1.2) + 100 = bot.Food 
142 = bot.Food 

So even if the importance for food is rated higher in the appsettings, you need less food than heat to get maximum addition of people. Counterintuitive…

In the Surplus functions iI do not feel a reordering of the function is necesary

Assuming I have 110 food and I have 110 heat, given a population of 10
We could say

heatSurplus=(110-10)* 0.9 = 90 
foodSurplus=(110-10)* 1.2 = 120

The engine will not rearrange the equation, So the “weight” of the above should be

var minResourceSurplus = (double) Math.Min(90, 120);

Then the engine will take heat as a “harder” requirement.
Which does match what you are saying, But its not necessarily a bug I would say.

**As a sidenote, I am only taking the population change function apart now.
A bit slow to get off this year.

Yes, I agree. the engine will not rearrange the equations.

But if you need to know what is the optimal amount of food and heat you require to get maximum growth of your population, your bot needs the rearranged equations.

The reason why I am saying that it is counterintuitive is because the appsettings list the factors as:

"ResourceImportance": {
    "Food": 1.2,
    "Heat": 0.9
  }

It makes one think that Food is more important than Heat which is not the case.

Anyway, use it, don’t use it, can’t really create a bot if I cannot send commands in time.