Energy

<
>
January 31, 2022

I spent the last couple of days with internal refactorings and the addition of Energy.
Until now every Structure on the Planet was always allowed to tick, there was no Energy requirement, production or storage.

In general

Every Structure now produces or consumes Energy which is tracked by the game. If there’s not enough energy available to tick every Structure, nothing will happen in that tick.
The unspent amount is then carried over to the next tick. And will eventually cause a tick, even if the produced Energy is much lower than the required Energy.
The factory ‘slows down’ in that case.
If there’s no production, the factory will grind to a halt.

Solar (panel)

I added the new Structure Solar, which currently produces a flat amount of Energy.
The produced amount should later depend on day/night, location on the Planet or even vary from Planet to Planet.

Battery

I also added a Battery as new Structure. It can be used to store Energy that’s overproduced.
Since the production currently doesn’t vary over time, the Battery is pretty much useless right now.
It was still an important Structure to add, so I can also test the Energy storage logic.

Below an image of the Solar panel, the Battery, the current Energy usage and production, and the current and maximum Energy storage.