I have some DOT (damage over time) implementation problems. My game runs on 30 FPS speed. Current implementation is: let's say the hero casts a spell which deals 1 damage per second. On every frame I do (pseudo code):
damage_done = getRandomDamage() * delta_time;
I accumulate damage and when it becomes more than 0, I subtract rounded damage from current health and so on. With 30 FPS and 1 DPS it will be 1/33 = 0.05...
We know that floats are not precise enough to sum 30 circulating decimals and have exactly 1 in the end. But HP is a discrete value and that's why 1 DPS will not result in 1 damage after 1 second, because the value will be 0.9999... instead. It's not such a big deal when you have 100000 DPS, ±1 damage will not be noticeable. But what if I have 1,5 DPS? How do modern RPGs implement DOTs?