0
\$\begingroup\$

I've been developing a boss hitting system for my application with utilization of firebase (firestore).

Simply put, there is a boss, visible to multiple users, he got max and current hp. The problem is that when ever user press "hit" button it deals for example 5 damage. In my case I do it as the following, I query the current hp from the firestore, subtract from it the dealt damage (5 damage in our case) and post it back to the firestore database, right after that I update the current hp to the user.

The key issue here is whenever there are several users, while hitting same boss all of them get different current hp, thus in some cases the hp of the boss isn't only decreasing but increasing.

How can I overcome this issue?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.