Civcraft / RealisticBiomes

Do not open issues here; open them on the maintained fork @ DevotedMC
https://github.com/DevotedMC/RealisticBiomes
7 stars 14 forks source link

GrowthConfig.getRate rewrite #42

Closed benjajaja closed 9 years ago

benjajaja commented 9 years ago

@WildWeazel @Maxopoly can you check this? Pseucode as follows:

rate = base_rate * biome_rate
// always return if the plant cannot grow in given biome - this eliminates greenhouse_ignore_biome flag
if rate == 0 then return

if greenhouse_enabled and block_under_greenhouse
// always apply greenhouse, the player should figure out when to use it
then rate *= greenhouse_rate
// get "sun" from plant block if transparent, else from block above
else if sun < max_sun
then
    if needs_sunlight
    // exponential penalty inversely proportional to light level
    then rate *= (sun / max_sun)^3
    // not_full_sunlight_modifier can be a boost or a penalty
    rate *= not_full_sunlight_modifier

// there used to be an "irrigated water" check at this point, I think it is not being used for anything

if soil_bonus
then rate *= 1 + soil_bonus * soil_blocks_found

return rate
Maxopoly commented 9 years ago

Multiplying the rate with both the exponential multiplier and the additonal modifier if there is not full sunlight is a bit weird imo, it should be just put into one configurable value.

Aside from that it looks very solid

benjajaja commented 9 years ago

@Maxopoly that part is from the original function as seen here (I should have linked that before BTW).

The idea seems to be that the penalty relative to lack of sunlight is applied to all plants equally (except exceptions like netherwarts), and then each plant can have another configurable not-full-sunlight penalty.

The logic of which plants have a greater not-full-sunlight penalty isn't clear to me, but that would be out of scope for this issue.

WildWeazel commented 9 years ago

This looks good, if we're doing away with the biome override option.

ttk2 commented 9 years ago

looks good to me too.

ttk2 commented 9 years ago

ok so if this looks good could we implement it?

Maxopoly commented 9 years ago

I guess so. I can just make some java code out of the pseudo code gipsy wrote out, tomorrow, if noone else wants to do it.

ttk2 commented 9 years ago

sound good.

benjajaja commented 9 years ago

closed by @Maxopoly in a0667be