A
A
Alexey Merkulov2019-06-25 13:43:55
Mathematics
Alexey Merkulov, 2019-06-25 13:43:55

Is there a (formula, equation) to calculate the lifetime of a player?

Let's say there are 3 players: a, b, c.
player a:
rate of fire=700 rounds/min.
damage=5 units.
health=100 units.
Player b:
rate of fire=500 rounds/min.
damage=9 units.
health=100 units.
Player c:
rate of fire=1000 rounds/min.
damage=3 units.
health = 80 units.
Player (a) shoots player (b) and player (c) shoots player (a).
Question: who will live? How much health will he have left? Who will die first, second?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-06-26
@Alexbanks

We will assume that the server FPS is 10. And they all start shooting at the same time.
Then per frame player (a) will make 1.17 shots or 5.83 damage .
And player (c), respectively, will make 1.67 shots or 5 damage .
Obviously player (a) deals damage faster.
So player (a) will deal 104.94 damage in 18 frames to take 100 health out of player (b). Moreover, 17 frames is not enough, because the damage will be only 99.11, which is less than 100.
For the same 18 frames, player (c) will only deal 90 damage, and will not have time to take out all 100 health units of player (a).
Not everything is so simple, it depends on the implementation.
For example, it's banal if the damage each frame is rounded down, then both will have damage per frame equal to 5.
Therefore, it may turn out that everyone will die at the same time (except for player (c)).
Or you have to take into account who fired first, because we assume that both started shooting at the same time, but this rarely happens in a real game. So in the formula you want to get, you will have to add the difference in the start time of the shooting.
The server may also have a different FPS, which is usually from 10 to 30, and sometimes goes beyond this, and other rounding rules, which will make their changes.
There are pings, lags, they also make their own adjustments, depending on, I repeat, the architecture and implementation.
Further, if you have complex mechanics and shooting accuracy drops when taking damage, then the calculation becomes much more complicated. Or if everyone has a different weapon that has a different spread when firing. Or if the weapon overheats and changes stats or just breaks down (before it deals 100 damage to the player). Maybe a small clip and time to reload, etc. etc.
In general, everything is difficult in reality. And in pure mathematics, you can, of course, derive a formula, but without other factors, it will not help much. For example, in your example, the DPS is almost the same, so it all depends on who notices the enemy first (well, plus ping).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question