Creeper spread/annihilation formulae

Started by Vozw, November 05, 2023, 12:35:28 PM

Previous topic - Next topic

Vozw

Does anyone know how creeper spreads/annihilates with AC, or even better, can point me to a compilation of such mechanics?

Testing has suggested that 1 ore -> 5 AC, and so I'd expect 8.1 ore/second to produce 40.5 AC/second, but somehow my game on Frykt:Crosslaw shows 8.1 ore/second overtaking 200 creeper/second worth of emitters (40, 40, and 20 strength with intervals of 0.5), so I can only assume there's something I don't know.

Even if this is user error or has something to do with the forge, I'm still very interested in the formulae. Testing suggests that each tile deposits 4% of [height difference] into each orthogonally adjacent tile? I'm not positive yet how that interacts with dense adjacent creeper or anti-creeper, though.

J

AC is just negative creeper. Add them up and it vanishes, so it should be one-to-one ratio. Terrain is handled by making the depth of the creeper larger (by the terrain height) for flow calculations. Creeper spreading is based on heat flow, so large values flow towards lower values by a fraction of their absolute difference (with some extra checks to prevent creeper from just bleeding out of terrain). When the creeper (or AC) depth is below a certain threshold, it is removed, so when spreading into previously unoccupied terrain there's always some loss.

Regarding emitter strength, they are weaker than they might seem. When emitting, they 'set' the creeper height to their strength, rather than adding it on top. So a 20-strength emitter in a pool of 10-deep creeper only emits 10. This is why emitters get stronger the closer you get. Pause and advance frame-by-frame with your mouse on top of an emitter to see this effect.

Vozw

That's very useful information, especially regarding emitters not actually adding their full amount; thank you!

Do you know if there's any more to the flow formula other than checking each orthogonal direction's total height (disregarding any present opposite creeper), multiplying the height difference by 0.04, and then transferring that much over (and not transferring anything over if the source tile has a lower liquid height than the destination tile?)

Trying to work out if opposite creeper in any way impedes flow, among other things.

At the risk of asking too many questions, is it known what the granularity of creeper is? (is it a float, or is it rounded to some decimal place? Haven't found the minimum amount on terrain beyond which evaporation happens quite yet)

Many thanks!

Karsten75

Quote from: Vozw on November 06, 2023, 05:32:08 PMTrying to work out if opposite creeper in any way impedes flow, among other things.

As was said previously, "opposite" creeper is a simple arithmetic calculation.

QuoteAt the risk of asking too many questions, is it known what the granularity of creeper is? (is it a float, or is it rounded to some decimal place?

Creeper values are stored in a signed decimal fullword (4 bytes), thus Creeper values internally are between  -2,147,483,648 to 2,147,483,647. For display purposes, this value is divided by 1,000,000.

I do not recall offhand the evaporation limit, it may be as low as <1 on a cell. Turn on "mist" and you should see where Creeper (or anti-Creeper, for that matter) is evaporating.

Vozw

No, no, I got that creeper annihilates on a 1:1 basis; I mean the rate of annihilation on the contact line (presumably from flowing into each other)

For example; my Crosslaw game appears to be completely stable at 216 hours of runtime, and produces 40.5 AC/sec. If the flow formula is just [height difference x 0.04], this implies that the total height difference on the contact line (summed for both creeper and anti-creeper) should total 40.5/0.04 flow rate/30 flow calculations per second, or 33.75, but the creeper's estimated flow into the contact line even before getting to the anti-creeper is 30.75, so they don't appear to be flowing into each other at the expected rate.

So, either there's user error, or creeper and anti-creeper on the contact line do impede each others' flow, or I have the wrong flow formula.


@signed decimal fullword; Good to know; threshold for creeper spread from a source tile to an empty tile seems to be between 0.02(20k) and 0.03(30k), so the evaporation limit looks to be between 0.0008(800) and 0.0012(1200). Probably 0.001(1000) then.

I thought knucracker had hardcoded in the 2147.48 creeper/anti-creeper flip after the unintended integer overflow in CW2 led to some really creative custom level triggers; neat to know that it's still an integer under the hood.