lanedirt / OGameX

Open-source OGame redesign clone built with Laravel 11.x.
https://main.ogamex.dev
MIT License
23 stars 12 forks source link

Add method to calculate current used fields (building levels) on planet #143

Open lanedirt opened 4 months ago

lanedirt commented 4 months ago

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:

Image Image

Chewbaka69 commented 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

lanedirt commented 3 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

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.