Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The calculation for min food rate is incorrect #1301

Open
hallipr opened this issue Jan 25, 2023 · 2 comments
Open

The calculation for min food rate is incorrect #1301

hallipr opened this issue Jan 25, 2023 · 2 comments
Labels
Data incorrect Displayed values are not correct

Comments

@hallipr
Copy link
Contributor

hallipr commented Jan 25, 2023

I'm pretty sure Crumplecorn's calculations for minRate and maxRate are wrong.

var maxFoodRate = species.taming.foodConsumptionBase * species.taming.babyFoodConsumptionMult * babyFoodConsumptionSpeedMultiplier;
const double baseMinFoodRate = 0.000155; // taken from crumplecorn
// min food rate at maturation 100 %
var minFoodRate = baseMinFoodRate * species.taming.babyFoodConsumptionMult * babyFoodConsumptionSpeedMultiplier;

Daeodon has the taming stats:

babyFoodConsumptionMult: 40,
foodConsumptionBase: 0.01

With Game.ini:

BabyMatureSpeedMultiplier=0.0   <<-- to hold dinos at a specific maturation for long durations
TamedDinoCharacterFoodDrainMultiplier=5.0
BabyFoodConsumptionSpeedMultiplier=3.0

and GameUserSettings.ini

DinoCharacterFoodDrainMultiplier=7.0

The current calculation for minFoodRate would be:

baseMinFoodRate * species.taming.babyFoodConsumptionMult * babyFoodConsumptionSpeedMultiplier = 0.000155 * 40 * 3 = 0.0186

In local tests:
A 99.999% daeodon consumed 160 food in 458 seconds. A rate of 0.349 f/s.
A 0% daeodon consumed 1000 food in ~23 seconds. A rate of ~43 f/s.

This would indicate that TamedDinoCharacterFoodDrainMultiplier and DinoCharacterFoodDrainMultiplier are used for min and max, and BabyFoodConsumptionSpeedMultiplier is only used in max:

5 * 7 * 0.01 = 0.35
3 * 5 * 7 * 40 * 0.01 = 42

I think the correct formula for minRate and maxRate should be:

var dinoMult = DinoCharacterFoodDrainMultiplier;
var tamedMult = TamedDinoCharacterFoodDrainMultiplier;
var babyMult= BabyFoodConsumptionSpeedMultiplier;
var minRate = species.taming.foodConsumptionBase * dinoMult * tamedMult;
var maxRate = species.taming.foodConsumptionBase * dinoMult * tamedMult * babyMult * species.taming.babyFoodConsumptionMult;

A simple reduction could be:

minRate = speciesBase * dinoMult * tamedMult * 1
maxRate = speciesBase * dinoMult * tamedMult * babyMult * speciesBabyMult

or

specificRate = speciesBase * dinoMult * tamedMult * (1 --> babyMult * speciesBabyMult)

specificRate = speciesBase * dinoMult * tamedMult * (1 + ((1-maturation) * (babyMult * speciesBabyMult - 1))

for the 0%

specificRate = 0.01 * 7 * 5 * (1 + 1 * (3 * 40 - 1))
             = 0.01 * 7 * 5 * (1 + 119)
             = 0.01 * 7 * 5 * 120
             = 42

for 99.999%

specificRate = 0.01 * 7 * 5 * (1 + 0.00001 * (3 * 40 - 1))
             = 0.01 * 7 * 5 * (1 + 0.00001 * 119)
             = 0.01 * 7 * 5 * 1.00119
             = 0.01 * 7 * 5 * 1.00119
             = 0.3504165
@hallipr
Copy link
Contributor Author

hallipr commented Jan 25, 2023

I ran a longer duration test with:

BabyMatureSpeedMultiplier=0.0
BabyFoodConsumptionSpeedMultiplier=0.1
TamedDinoCharacterFoodDrainMultiplier=1.0
DinoCharacterFoodDrainMultiplier=1.0

A 0% Daeodon lost 661 food over 16727 seconds at 0.039995 f/s.

That's:

specificRate = speciesBase * dinoMult * tamedMult * (1 + ((1-maturation) * (babyMult * speciesBabyMult - 1))
             = 0.01 * 1 * 1 * (1 + (1 - 0) * (0.1 * 40 - 1))
             = 0.01 * (1 + 4 - 1)
             = 0.01 * 4
             = 0.04

@hallipr
Copy link
Contributor Author

hallipr commented Jan 25, 2023

Rate over time is just:

startMaturatation = maturation(babyAge)
endMaturatation = maturation(babyAge + duration)

startRate = specificRate(startMaturation)
endRate = specificRate(endMaturation)

foodDrained = (startRate + endRate) / 2 * duration

this would need proper clamps around duration to not bleed into adult time

@cadon cadon added the Data incorrect Displayed values are not correct label Jan 29, 2023
cadon added a commit that referenced this issue Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data incorrect Displayed values are not correct
Projects
None yet
Development

No branches or pull requests

2 participants