How can we possibly model acceleration in Mario Kart 8 Deluxe ?
Basically we want to visualise acceleration (i.e: to see how speed changes over time).We could visualise it through a speedometer but there hasn't been any one displayed in-game anymore since Mario Kart Double Dash.
That means we have to find another way to do it, what about actually creating & simulating one with some datas :)
However, modeling the speed of a vehicle while cornering/drifting/boosting/braking/etc.. is clearly a lot of work so we are only going to put effort in modeling a vehicle driving from no speed at all to maximum speed on a straight line (with no direction change not to mess with angular velocity).
First & foremost, long story short acceleration often is often refered as the rate of change of the velocity of an object with respect to time.
Subsequently, in regard to acceleration & relative acceleration in Mario Kart 8 Deluxe, here some summarized piece of information based on the Super Mario Wiki related topic in various Mario Kart games :
How quickly the vehicle's top speed is achieved from a non-moving position. Negatively correlated with speed.
How much the relative speed of the vehicle, i.e. the speed expressed as fraction of the top speed, increases over time.
The time the kart's top speed is achieved when accelerating.
How quickly a kart can achieve its top speed.
The rate of speed increase when holding the acceleration button.
Relative acceleration, i.e. how much the fraction of current speed to maximum speed increases over time.
Increase in absolute speed per frame, i.e. the amount of distance units/frame that can be added to the current speed in each frame.
In those wikis, speed is generally expressed in distance units per frame, a frame being a time unit (which depends on framerate) proportional to the usual & conventional time units (in MK8DX since the game runs at 60 fps thus we'll assume 60 frames equate a second).
Also the aforementioned relative acceleration (not to be confused with acceleration itself which is sometimes specified as effective acceleration) refers to the acceleration experienced by one object with respect to another object or reference frame (the relative acceleration between the two objects is the acceleration one object would observe when measuring the motion of the other object from its own frame of reference).
As we more or less have got an idea of acceleration purpose in Mario Kart 8 Deluxe, let's focus on what has been stated around it in the in-game stats wiki :
The following tables include all statistics for the both the drivers and vehicles part of Mario Kart 8 Deluxe in the format used internally
Technically, to model acceleration the best intuition to get would be to look for a mathematical function describing vehicles' accelerations patterns throughout the game's code.Unfortunately, most players like me do not have access to anything like that or do not know how to get that.
Nonetheless, instead of looking for a mathematical function, we may in fact consider looking for a mathematical (recursive) sequence :p
You know generally race vehicles gain much more speed at the start of driving than at the end when they are about to hit top speed, this something we notice too when driving regular cars for example.That suggests the speed increases faster while driving at low speed, in this case the lower the speed the greater the acceleration.
We could associate acceleration as a speed increment and consider that while driving the next speed value at a given frame is the current speed value plus a speed increment.
I see some people coming with the old goofy acceleration formula below :
Using the relative accelerations' values in that formula would be wrong in the way it'd confuse effective acceleration with relative acceleration on top of assuming the overall acceleration at any given frame is constant meaning the speed increment is constant as well which is not the case we just thought over.
Anyways, let's dive into the following quote from the MK8DX in-game wiki :
How much the fraction of current speed to maximum speed increases over time.
From what we said our sequence should like this :
( "nth", "umpteenth".. same to me, thank you in advance for not arguing on one of these with me :? )
That something is indeed acceleration (effective acceleration) since it is related to the speed increments.
In the quote, with the word "fraction" we have to think of a portion instead of a quite literal fraction which would in our case may represent the difference between maximum speed and current speed (subtraction) since the initial value of the sequence is Vo = 0 (distance units/frame), a fraction would create a sequence with every value being 0 which does not make any sense (the vehicle is basically not moving at all at this point) :
Note that this subtraction makes sense as the value decreases over time just like speed increments should, then the "increases over time" art of the quote only suggests that as current speed increases over time it implies the literal fraction of current speed to max speed also increases over time which makes sens too but do not necessarily neglect the "max speed - current speed" subtraction's decrease over time.
Obviously the quote aims to explain in some way the relative acceleration but we are going to use its pattern to illustrate effective acceleration because (correct me if I happen to be wrong here) relative should somehow be proportional to effective acceleration.
Now if relative acceleration is proportional to effective acceleration then relative acceleration should affect the subtraction of current speed to max speed :
Normally, we obtain a pretty interesting basic sequence to quantitatively model speed while accelerating from a full stop :
We can also specify the sequence mathematically as being an arithmetico-geometric sequence :
Following the logic of the obtained sequence the speed increments actually decreases over time which is while accelerating which is what we expect.
Now let's check out whether the sequence is reliable for an in-game perspective or not.
To test the sequence's viability, we want to record the time it takes for a given combination to go from 0 to top speed (in 150cc).We can pick the following combination for instance :
Doing quick equations we found out the levels of both speed (ground speed in our small study) and acceleration being 12 & 12 respectively :p
So here are their related values provided by the wiki for the variables our sequence accounts for :
Besides, we will do the experiment on the straightaway from the N64 Yoshi Valley track :
As for the experiment itself, it's quite difficult to tell when the actual top speed is reached so we are going to record and measure it using a second player with the exact same combination who will get a drift boost to reach top speed for sure and as soon as the second player stops breaking away we'll consider top speed being reached for the first player accelerating :
Although the experiment was made easier in a way, it is still a challenge to figure out the exact frame from when top speed is reached.. thanks Nintendo for not just putting a speedometer somehow :(
The good news is we can approximately figure out when about 98% of top speed (≈ 7.6 distance units/frame) is reached which happen to reached after about 4.868 seconds.
Graphing out the curve of the plotted connected points for our sequence indicates that 98% of top speed is reached as of the 357th (≈ 5.950 seconds) frame whereas if we base our modeling on that weird acceleration formula it'd be reached as of the 691th frame (≈ 11.517 seconds).
Our sequence is not too far away from what really happens to be in the game but we still need to improve the modeling of acceleration and speed.
In comparison to the recorded time we need to get a sequence in which the speed increment is more consequent so the simulated max speed is reached faster.
To do it we have to think about how we want to impact the speed increment dynamic.
To modify the sequence, we should incorporate a coefficient which is going to multiply the current effective acceleration components of the sequence :
To increase the effective acceleration's overall effect, the coefficient has to be greater than 1 but lesser or equal than 2, in other words the coefficient should be the sum of 1 and a proportion :
As for the proportion, it has to range from 0 to 1 and be decreasing as time goes by (to emphasise the early increments to make a real change in acceleration because the earlier the greater the increments), the subtraction of current speed to maximum speed is also decreasing so it could be considered a good choice for the numerator of the fraction.Then regarding the denominator of the fraction, maximum speed is our baseline when it comes to acceleration from 0 to top speed as it allows to evaluate the remaining proportion of current speed to top speed :
Finally simplifying the terms of the sequence we get a new acceleration modeling :
Mathematically we get a quadratic sequence as the following :
Graphing the last sequence we worked out indicates 98% of top speed is reached as of the 298th frame (≈ 4.967 seconds) which is as a result closer than the first sequence :
Now we didn't talk about the (effective) acceleration limitation factor (i.e. the maximum increase in absolute speed per frame according to the wiki) for our experiment's combination its value is set to 0.09 distance units/frame², I symply mention it because there happens to be some speed increments being greater than 0.09 distance units/frame² :
Therefore we have to apply conditions to our sequence to filter out all exceeding speed increment parts of speed increments with a value greater than 0.09 to add up with the next frame's speed increments plus managing the increment leftovers, and so forth...
We are not gonna get into the details of this to spare you with possible headaches.Here is how the curve looks like after some changes (it doesn't seemingly affect the time need to reach 98% of top speed though) :
It is also said in the Mario Kart 8 Wii U wiki that the acceleration limitation factor is very frequently not a limiting factor in all engine classes except for 200cc but for the sake of respecting datas we are keeping our conditioned sequence the way it changed.
Moerover, in another post we found out the average top speed values in all engine classes but do not forget our datas are related to 150cc engine class and from that post in particular we can deduce 7.7 distance units/frame equates roughly 86.62 km/h (≈ 53.44 mi/h).Meaning we could assume 1 663 200 (7.7*60^3) distance units translate into roughly 86.62 km.
At last, using the sequence we ultimately came up with plus a little Scratch code we can simulate a speedometer to visualise the acceleration of the metal Mario combination going from 0 to top speed on a straightaway :
NB: The code doesn't follow exactly the sequence as there had to be modifications to make up for unrealistic timings in order to display speedometers which match what we worked out.
And that's pretty much it, here is a model (given the relative acceleration value, the acceleration limitation value & the top speed value) which isn't obviously THE model for modeling acceleration but correct to an extent.Either way this is a topic that I think is somewhat interesting when understanding how a combo accelerates after getting hit & stopped by items.
Sidenote: We can find out the average distance travelled needed to reach top speed as well by calculating a finite integral of the sequence (area under its curve for a specific amount of time) which for the combination we tested on acceleration gives us an average travelled distance of about 2894 distance units or about 151 meters (≈ 492 feet) :
Another use of the sequence we obtained would be to figure out the time we need to wait before trying to drift right after being hit by an item (otherwise we'd not be able to start a drift, lose speed too and wait more time to be able to start another drift).
In the MK8DX wiki this phenomenon is due to the fact that drifting and automatic drifting can begin only if the speed of the vehicle is greater than a specific percentage of its top speed (in the MK8 wiki version, that specific threshold is set to 55% of the top speed from which we can base our calculations off of as an assumption).
For our previous experimental combo which have got a top speed value of 7.75 distance units/frame writing down the sequence in an excel spreadsheet, we calculate the time needed to be able to drift after getting hit by an item without any speed loss being about a second (a LARGE approximation for about 48 frames).
Anyway, these examples shows how understanding the fundamentals of a statistic (through simulation & visualisation in this case) can help improving one's vision on the game strategically speaking (at least a little) ツ .