Open lanedirt opened 4 months ago
In other Ogame Clone, when you build a building, it increase the a field (field_current) but an other approach can be to count on the fly the number of building level.
If planet type === Planet : sum level of building by type building && can be construct on Planet else if planet type === Moon : sum level of building by type building && can be construct on Moon
In other Ogame Clone, when you build a building, it increase the a field (field_current) but an other approach can be to count on the fly the number of building level.
If planet type === Planet : sum level of building by type building && can be construct on Planet else if planet type === Moon : sum level of building by type building && can be construct on Moon
I prefer the option to calculate this value on-the-fly. 👍 We could probably cache the value if performance becomes an issue (later). But being able to recalculate the value in case of issues with the initial calculation logic seems like the most optimal choice.
For various features we will need a method that can calculate the amount of currently used fields on a planet. One example where this is shown is on the overview page as seen below.
I'm not sure yet how the amount of fields used should be calculated exactly. But this can probably be found out via wikis or basic reverse engineering.
TODO:
PlanetService
that calculates the amount of used fields on a planet and returns it as an int.