Rubber banding in Super Mario Kart

The popular Mario Kart series started with Super Mario Kart (SMK), on the Super Nintendo. Obviously, the  goal of the game is to finish first. In the Grand Prix mode, you choose one of the 8 characters and compete against the 7 others over the course of 5 tracks. The signature difficulty setting was introduced in this game (50cc, 100cc, 150cc). Interestingly, and this is what will be analyzed, difficulty doesn’t come from better skills, but from the AI cheating, having two modes that I call “turbo” and “slow”.

plot1

Example of a first lap done by the computer. The color represents the speed, red = slow to green = fast. See this file for the R code behind this graph and the following ones.

Rubber Banding

I was curious to see if my race position had an effect on the speed of the other karts, ie if they go faster when I’m ahead of them. To fully comprehend the effect, I did a simple A/B experiment on the first ever track (Mario Circuit 1).

  • First, I did the race while being first all the way (named “best” experiment from now on). To simplify the experiment, I cheated and changed my lap meter to the last lap, effectively getting first in the process.
  • Secondly, I did all the race in the last position (named “last” experiment from now on). This experiment was much easier indeed as all I had to do was to stay idle all the way.

I recorded in a database the AI speed and position  every 5 frames. I did 5 tests for every difficulty setting / experiment combo with randomized characters for a total of 30 race results. Here is the lua code used.

cheat.gif

I modified the lap meter to the last and had to move forward so it could record my new rank.

Let’s analyze some of the experiment results with the first AI in 50cc mode. There was mostly no interference with AIs, therefore the first AI in the starting grid always stayed first (and so on until the last one). The speed is taken live from the SNES’ memory value and use unknown units. An aggregate of the speed by percentage of lap completed is shown in the following graph.

Plot2.png

An additive model was used to aggregate the data points in four simple curves. Slower speeds correspond to AI slowing for curves while higher speeds are in straight lines.

We can see that on the first lap, the speed is around the same for both the last and first strategies (green and red curves are indeed very similar). This strange behavior is further analyzed in the next section of this blog post. It isn’t shown in the graph, but the AI’s character makes no significant difference here even though it makes a significant difference in handling, acceleration and top speed when they are human-controlled. For the second lap and up, we see that there was a significant decrease in speed, a constant 200 speed-units approximatively, when the player is behind (the purple line is much lower than the blue line). Therefore, we know that there are two modes, a “turbo mode” and a “slow mode”, which is around 40 % slower.

This is a proof of what is called “rubber banding” and is a way for programmers to make the game challenging with an unskilled AI. The name is a metaphor, as if the two vehicles were connected by a large rubber band. In the simplest form introduced in this game, the AI goes slower when the player is behind. Rubber banding is also used in newer Mario Kart series (see an example in MK64).

If we look at the speed both experiments on the map we have the following:

Plot3.png

AI race paths for both experiments are atop one of the other except for the lower-right corner. Again, the color represents the speed, red = slow to green = fast.

Note that the last curve is taken at a great speed by the turbo AI (bottom-right), which explains why the AI has the annoying habit of overtaking unfortunate players just before the finish line.

These previous results showed only one character on only one difficulty level.  See the following table for the aggregated numbers of all cc and ranks combination and the graph for the respective visualization.

Table 1.png

“Last Place” is the experiment in which I stayed idle all race while “First Place” is the experiment where I stayed first all race. Numbers shown are the average time it took for the AI to finish the race.

plot3.png

Visualization of the previous table. Each bar represents a difficulty / AI rank combination. The up-pointing triangle △ is the AI’s racetime result when I was always first. The down-pointing triangle ▽ is for when I was last all race.

It shows that the rubber banding is more severe on the best computer-controlled players (rank 1, 2 & 3) and on the lowest difficulty. In these cases, the computer finished the race around 20 seconds faster. For the worst AI character, the difference is still present, but is minimal.

 

The first lap

As seen previously, the first lap have strange results. Why didn’t the computer slow down when I was last, as it did for laps 2-5?

I did a second experiment where I would modify the SNES’ memory to position myself between the best and the second-best AI. In other words, I would always stay in the second position, never too far from the first AI. Again, I also collected the speed and position of the computer-controlled karts to analyze if he indeed slowed down to help me overtake him. See an in-game example in the following gif.

Animation2.gif

In this experiment, I put the player’s kart in the middle of the first and second AI (lua code).

What happened is that the first AI was in “slow mode”as I am behind him. Adversely, the second AI is in “turbo mode” and would try to overtake me but would unfortunately crash into my kart in the process. If we add these new data observations to the previous speed plot, we get the following one:

plot5.png

Again, an additive model was used to aggregate the data points in singular curves.

Indeed, we observe that in this new experiment, the first AI didn’t go as fast as when I stayed idle. It stayed in “slow mode”. For laps after the first one, we see that there was no speed difference between being last and just being second.

I did similar tests and my conclusion is that when you are far enough from the AIs on the first lap, they will be in “turbo mode”. This whole first lap turbo looks like a programming error as it is in odd with the following laps.

Conclusion & Further works

As we saw in this small analysis, the AI changes speed whether it is ahead or not. But watch out, as this advantage gets away if you are too far behind in the first lap.

Of course, an important part of the game, the items, were left out of the analysis to keep it to the simplest. Further works could explore how much their occurrence differs for different difficulties and player positions. Other racetracks could be interesting to analyze, and could exhibiting strange and interesting behaviors.

One thought on “Rubber banding in Super Mario Kart

  1. Pingback: You SHOULDN’T hate the Blue Shell | IGN Video

Leave a comment