I'm trying to make a spin on the Active Time Battle mechanic (ATB) most commonly seen in the Final Fantasy series.
ATB is a timing mechanic, whereby units in combat will each have a meter that fills up over time. Once it's full, the unit can then take their turn, once they've done it resets to 0 and gradually fills up again.
I'm not sure how the maths works out in FF specifically, but I'm attempting to make one that has a minimum time for the fastest unit, and all the other units will take their turn based on how fast they are compared to the fastest unit.
Breakdown of the variables:
- A - The amount of ATB points required to take a turn (constant 100)
- t - The minimum time for a turn to take (seconds)
- s - The speed of the unit
- M - The speed of the fastest unit
- b - The current ATB value
- $\Delta$ - The change in time over the frame
My current method is straightforward:
$b = b + s * \Delta$
But the results end up looking like this:
| Unit | Speed | Average wait time before turn (s) |
|---|---|---|
| Enemy 1 | 5 | 127 |
| Enemy 2 | 3 | 212 |
| Player | 20 | 31.5 |
| Companion | 10 | 63 |
What I'm trying to aim for if the minimum turn time was 10 seconds:
| Unit | Speed | Average wait time before turn (s) |
|---|---|---|
| Enemy 1 | 5 | 40 |
| Enemy 2 | 3 | 66.6... |
| Player | 20 | 10 |
| Companion | 10 | 20 |
Using the following to determine the times $$T = \frac{t}{s / M}$$
My maths has suffered quite a bit since leaving university so I can't see what I'm missing, since everything I seem to try is either too slow or too fast. The closest I managed to get was 6 seconds for the fastest unit with the following: $$b = b + s * A * \Delta$$