Rapidly changing numbers?

Thanks for reading in advance.

I’ve faced this issue many a time when working on combat-based games where the HP value of a player can change from one number to another in a fraction of a millisecond: oftentimes extremely rapid changes to a value go ignored or are overlapped. It’s never a fully consistent problem and always happens at random, but in far too great a frequency to just be passed off as an unsolvable bug.

My example is: In the class-based fighter I’m working on, the Warrior class has access to an ability that projects three waves in branching directions that all start on a single point. Being skilled enough to pointblank the ability (catching the target in the starting point) results in all three waves hitting the target, dealing their individual damage three times, once per wave.

Completely at random, however, the ability will only deal 15 damage a single time despite all three waves being confirmed as a hit by the server. This is further reproduced in the Warrior’s passive - it gets a third of whatever damage it deals as Shield on its HP bar. If all three waves find their mark, the result should be exactly 15 points of Shield, but oftentimes I’m lucky to receive the full amount.

I know other games have managed to remedy this dilemma before - one Tower Defense Simulator or Tower Battles both have units that fire at insanely fast speeds at approaching enemies, and their damage never misses a beat. I’d like some insight on how I might be able to achieve a similar result.

Thanks!

5 Likes

you can double check,your printing the right value

if your weapon has a cool down or animation add the same cooldown to this

I’m a bit confused, are you saying that sometimes rather than having 3 rounds of 5-Damage hits the opponent will receive a single round of a 15-Damage hit?

The ability is intended to deal 15 damage per wave. There’s three waves, so if they all hit, the target should be taking 45 damage.

The Warrior gets Shield equal to 30% of all damage it deals. So if the full 45 damage was dealt, I should be receiving 15 Shield.

Occasionally, only one of the waves will hit, dealing only 15 damage. And even if they all do, there’s a moderate chance I won’t get 15 Shield either, since my Shield value is changed 3 times almost instantly. I’m looking for a way to stop changes to numbers from cancelling out if they happen too quickly in succession.

You need a damage queue system, and by that I mean something to request to do damage, then check if damage is already being done, and if so, then wait(). Sort of like the data store throttle system.

1 Like