Dark Forest Planet Energy Growth Mechanism

A very important concept in Dark Forest is "Energy", which represents the planet's energy, the planet's energy will increase over time until it reaches the planet's energy limit, by sending energy can attack to occupy other planets or enhance their own planets, around the core concept of energy, you can start a very exciting interstellar battle. In fact, in Dark Forest's underlying contract, Energy is actually represented by Population, but in the UI, Energy is used instead, so isn't it a bit more understandable?

Dark Forest veterans will soon discover that the growth of planet energy does not seem to be linear, but rather related to the amount of energy left after the planet sends energy, which is indeed the case, as Dark Forest uses a Lazy Update mechanism for planet energy growth.

First of all, Dark Forest is a Crypto-Native game, all the data is in the chain, yes, Crypto-Native again, so the planet energy state in Dark Forest is not possible to update in real time, so the Gas cost is too high, but also brings unnecessary communication costs. Therefore, the planet energy status in Dark Forest is only updated when interacting with each other, and when sending energy, Dark Forest will calculate the remaining energy of the planet and record a timestamp, and when sending or receiving energy again, the energy growth of the planet will be calculated and updated by the interval of two timestamps, which is called Lazy Update. The energy value of the planet that players see on the client side is not the real value on the chain, but is calculated based on the previous remaining energy and the time stamp.

The code for calculating energy in Dark Forest is as follows.

Energy Update Code
Energy Update Code

To be honest, this code is not too good to read, so let's convert it to basically the following formula.

Energy Update Formula
Energy Update Formula

From the above formula, we can see that the planet's Energy(population) is related to the following factors: the planet's energy limit, the energy growth rate, the remaining energy after the last interaction and the interval between two interactions.

Of course it is still not easy to see the relationship between these factors from the formula alone, we can plot the energy growth curve to facilitate our observation.

Now suppose there is a level 5 planet with an energy limit of 259K and an energy growth rate of 6.48, then based on the energy remaining after the last interaction and the interval between interactions, we can plot its energy growth curve as follows:

Energy Lazy Growth Curve
Energy Lazy Growth Curve

From the graph we can see that the energy growth curve is basically an S curve, with slow growth at the beginning, a high speed growth period in the middle, and then the growth rate slows down again, so when players send energy on the planet, they can't send all the energy, in which case it will cause the original planet energy recover rate abnormally slowly, and this threshold value of sending is about one-fifth of the planet energy limit, so that the planet will immediately enter the high speed energy growth period.

The above energy ratio is determined by the curve structure, so it is applicable for any level of planet. Here we choose another level 9 planet for testing, whose energy ceiling is 4M and energy growth rate is 20.73, and the energy growth curve is as follows.

Energy Lazy Growth Curve for Lv9 Plant
Energy Lazy Growth Curve for Lv9 Plant

By comparing the curves of the two graphs it will be seen that the energy ceiling of the planet and the energy growth rate do not change the shape of the curve, but only affect the proportion of time when the energy grows to the ceiling. Therefore, the ratio of the threshold value for sending energy to the planet's energy limit does not change either, which is about one-fifth.

Dark Forest players sometimes find that the energy that the planet can withstand higher than the energy limit, and then will quickly drop to the energy line, which is also determined by the above formula, we assume that the energy of the above level 9 planet is 5M, then its energy drop curve is as follows.

Energy Lazy Decay Curve
Energy Lazy Decay Curve

The same formula can be used to achieve both energy increase and energy decrease, which has to be said to be a very subtle design.

By:EliteMetaverse.eth

Subscribe to EliteMetaverse
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.