CreeperHost Presents Chickens

CreeperHost Presents Chickens

2M Downloads

Breeding chickens doesn't average stacks

Saereth opened this issue ยท 3 comments

commented

Presently if you take for example, a 10/10/10 quartz chicken and a 1/1/1 yellow chicken you'll end up with a 1/1/1 OR a 10/10/10 glowstone chicken. It doesnt seem to average the parents stats but instead just give you one of the parents stats randomly?

Should probably average the stats or it becomes very easy to 10/10/10 every chicken

commented

My preference would be rand with min/max of the two, weighted towards the lower end? Unsure what anyone else's thoughts are on that.

commented

yeah a bit of rng with edging out towards increases on the average sounds pretty balanced

commented

Just did some digging in the code, and a bit of testing.
The math as of 1.21.4 is as follows.

int mutation = rand.nextInt(2) + 1;
int newStatValue = (((stat1 * strength1) + (stat2 * strength2)) / (strength1 + strength2)) + mutation;

If we ignore mutation for a second, and assume both parents have identical strength,
the child stat will be exactly halfway between the two parent stats, so if parent A stat is 1 and parent B stat is 10, the child stat will be 5.

But usually when combining parents with different stats, the strength stat will also be different.
And the parent with the higher strength will contribute more to the child's stats.

So when you combine a 1/1/1 with a 10/10/10, the strength difference is 1 vs 10, so the child starts will be almost entirely waited towards the 10/10/10 parent, resulting in a 9/9/9 child.

Then you add the random mutation value of between 1 and 2, and the child of a 1/1/1 + 10/10/10 should always be a 10/10/10

I have not been able to reproduce the op's issue of a 1/1/1+10/10/10 producing a 1/1/1
Though that could be an issue in a different version.