Open xSentry opened 4 months ago
Any update on this? I'd love this feature!
I think the main problem for us is that we synchronize every 10s. So calculating from the previous delta would result in very rapidly changing not to mention inaccurate calculations.
Aside from that, we don't store anything in a database, so if the app restarts we don't have delta's available for at least 20 seconds, and I don't know what we would/could show in that timeframe.
What problem does it solve
Currently, there is no option to get the current change rate for a planets liberation. You would need to save a snapshot yourself and calculate the liberation rate on your own. Having such a feature in this api would be highly usefull for displaying informations such as: Winning, Loosing, Stalemate
What is the solution
We need to add the functionality of saving a snapshot of the current liberation and compare it. Everytime we want to update the liberation change we have to calculate the difference between the saved liberation and the current one to get an estimated rate of change. After calculating the rate of change we should update the snapshot.
Existing alternatives
An example for a possible output can be found here
Added value
A lot of people want to display such information. Providing this would make it easier for developers who dont want or cant implement an own database structure.
Additional notes
Here are some example Files I use, to implement such functionality with PHP in Symfony: (My implementation does not include proper defense campaign handling)
Entity to save the PlanetProgress:
Logic to calculate the change rate: