Unit Motion | [Go Back] |
Investigation into TA's movement model has shown it to posses a typical programming implementation of simple 1D kinematic equations of motion. The general time unit used is a frame, f. The frame rate used is 30f/s so 1 frame can be converted to 1/30th of a second for more familiar expression of velocity and acceleration terms.
The implementation is likely as follows with values being updated every frame:
velocity += acceleration |
displacement += velocity |
Generally speaking motion in the game involves movement from a known start point to a designated endpoint. This means that it is the path velocity and displacement with respect to time that are calculated to reach the endpoint. This calculation uses a units acceleration, maximum velocity and brake rate constants and their kinematic relations.
A general movement from an initial stationary position, xi, to another final position, xf, will consist of the following sequence:
1. xi,vmax - xi | Accelerate at a constant rate until maximum velocity is reached. |
2. xf,vmax - xi,vmax | Move at a constant (maximum) velocity until near the endpoint. |
3. xf - xf,-vmax | Decelerate at a constant (brake) rate to a stop at the path endpoint. |
A shorter movement may also mean the maximum velocity may not actually be reached, giving us the following sequence:
With acceleration at a constant rate, the kinematic equations are as follows:
vt = v0 + aacc·t | (1) |
xt = x0 + v0·t + ½·a·t² | (2) |
These simplify to the following where acceleration is zero:
vt = v·t | (3) |
xt = x0 + v·t | (4) |
To find the intermediate movement between a known start point, x0, and endpoint, x3 we declare the following helpful relations:
t1 - t0 = vmax/aacc
t3 - t2 = vmax/adec
x2 - x1 = x3-[(x3-x2)+(x1-x0)]
t2 - t1 = (x2-x1)/vmax
As an example lets take the slowest units for each of the 3 constants considered and compare them.
Table 1: Units featuring the slowest movement values.
Unit | aacc (px/f²) | Vmax (px/f) | adec (px/f²) |
CORE HTLA "Turtle" | 0.003 | 1.9 | 0.017 |
CORE KG-EHL "Sumo" | 0.04 | 0.34 | 0.1 |
ARM ARM-THC "Bear" | 0.004 | 1.0 | 0.0018 |
To establish a comparison baseline let's consider the acceleration times for each unit.
Table 2: Units featuring the slowest movement values converted to frames (a measure of time).
Unit | t1-t0 (f) | t3-t2 (f) | (t3-t2) + (t1-t0) (f) |
CORE HTLA "Turtle" | 633 | 112 | 745 |
CORE KG-EHL "Sumo" | 9 | 3 | 12 |
ARM ARM-THC "Bear" | 250 | 556 | 806 |
This shows us that the ARM ARM-THC "Bear" will take the longest to accelerate from standstill to vmax and immediately brake to a standstill again.
The distance covered in this time is calculated as follows:
x1-x0 = ½·vmax*(t1-t0)
x1-x0 = ½·1·250
x1-x0 = 125px
x3-x2 = ½·1·556
x1-x2 = 278px
Now let x1 = x2 so the total distance travelled is:
x3-x0 = (x1-x0) + (x3-x2)
x3-x0 = (125) + (278)
x3-x0 = 403px
So how far could the other units travel in the same time? Let's work it out for the Sumo:
x1-x0 = ½·vmax*(t1-t0)
x1-x0 = ½(0.34)9
x1-x0 = 1px
x3-x2 = ½(0.34)3
x1-x2 = 1px
(t2-t1) = (t2-t1) - [(t1-t0) + (t3-t2)]
(t2-t1) = 806 - [1 + 1]
(t2-t1) = 804f
x2-x1 = vmax*(t2-t1)
x2-x1 = 0.34(804)
x2-x1 = 273px
So the total distance travelled is:
x3-x0 = (x1-x0) + (x2-x1) + (x3-x2)
x3-x0 = (1) + (273) + (1)
x2-x1 = 275px
Let's ask a different question for the Turtle. How long would it take for it to travel 403px?
x1-x0 = ½·vmax*(t1-t0)
x1-x0 = ½(1.9)633
x1-x0 = 602px
x3-x2 = ½(1.9)112
x1-x2 = 106px
These first of these two calculations already shows us that the Turtle cannot reach vmax over this short distance. In fact it would need 708px to do so. This means that it will have to accelerate then decelerate to a lower velocity.