Tuesday, April 15, 2014

Gravity on Azeroth, part 2


Because if there's anything that needs a sequel, it's Gravity... right?  Okay.

When we left off, we (read: I) devised two ways to calculate acceleration due to gravity in World of Warcraft.  The first, more basic approach, assumes constant acceleration and uses the relationship

$$a = {{2h_0}\over{t^2}}$$

The second approach assumes that drag (air resistance) functions realistically in-game, and uses a more complex equation with no neat solution.  To reiterate: we will be measuring (directly) the time it takes to fly to an arbitrary height, the time it takes to fall from that height and (indirectly) the total displacement, and then attempting to calculate the acceleration due to gravity and the magnitude of drag.


Player characters run at 7 yd/s (for whatever reason, distances in WoW are measured in yards).  With Artisan Riding (+280% speed) and guild perks, I fly at 418% normal run speed, or 29.26 yards per second.  Knowing this, it's easy to calculate distance using flight time.  If fall time from the same height is measured, we can also calculate average acceleration using the above formula.  I recorded seven trials at varying heights and compiled my data in the following table:


Flight time (s) Height (yds) Fall time (s) Avg. Acceleration (yds/s2)
5.4 158.0 4.6 14.9
7.5 219.5 5.6 14.0
8.2 239.9 5.9 13.8
9.0 263.3 6.5 12.5
11.4 333.6 7.4 12.2
13.2 386.2 8.5 10.7
16.8 491.6 10.1 9.6

It's easy to see that there's a problem here - the calculated acceleration decreases as measured height increases.  This is a clear indication that acceleration was not constant and our first formula is not sufficient to describe free fall near Azeroth's surface.  Fortunately, we took the time last time to produce a formula which describes the relationship between distance and time, accounting for drag.


$$h_0 = \frac{v_\infty^2}{g}\ln\cosh{{gt}\over{v_\infty}}$$

Neither WolframAlpha nor I could come up with a solution to this equation which directly related terminal velocity to gravitational acceleration (our two unknowns), but we can still work with it.  Plotting height and fall time shows a fairly linear relationship (R2 = .997), which means we approach terminal velocity very rapidly.  We can use the last two points to estimate terminal velocity by making a small logical leap: since it took us 1.6 seconds longer to fall 491.6 yards compared to 386.2, our terminal velocity is approximately (491.6-386.2)/1.6 = 65.9 yards per second.  Eliminating terminal velocity as a variable makes the equation simple enough to solve.


Height (yds) Fall time (s) Acceleration (yds/s2)
158.0 4.6 18.6
219.5 5.6 19
239.9 5.9 19.3
263.3 6.5 17.4
333.6 7.4 19.2
386.2 8.5 17.0
491.6 10.1 17.2

Using our estimated terminal velocity of 65.9 yd/s, we have an average gravitational acceleration of 18.2 yd/s2.  I would be perfectly happy with these results if I didn't have a beautiful open-source graphing program (graph.exe) which allows custom best-fit models.




Handing our equation and point series over to graph.exe gave a terminal velocity of 61.6 yd/s and an acceleration-due-to-gravity of 19.9 yd/s2, with R2 = .999. Compare that to the effect of gravity near Earth's surface, where acceleration is only 10.7 yd/s2 and a typical skydiver's terminal velocity is in the range of 60 yd/s.

Possible sources of error

It would be wrong of me to end this article by leading you to believe that my measurements and subsequent calculations are exact and final.  While I believe my results were very close, I have a responsibility to inform you of any possible sources of experimental error.

- Accuracy of time measurements was limited by my reaction time (I used a manual stopwatch in my trials)
- Server latency was not taken into account, although my home and world latency were measured at <44ms prior to the trials and should not have had a measurable effect

If you liked this article, or have anything to add, please comment below.  Stay tuned later this week for more math, science and strong opinions.  For science, and for the Horde!