Trampoline

Revision as of 00:05, 1 June 2019 by Nim (talk | contribs)


The Trampoline is an unfinished and unused object in Super Mario 64. Its model and collision are nearly fully finished, but its code was apparently abandoned early on.

Trampoline
Trampoline.png
Hitbox Info
Hitbox

Collision involves triangles instead of a cylindrical hitbox

Tangibility radius 1000
Interaction type None
Surfaces 0x00 (default)

The game contains infrastructure for the trampoline to affect Mario's jumps, and the trampoline has code for visually stretching and compressing. However, if you manage to load the trampoline into the game, it doesn't do anything other than act as a platform since there is no code to move it nor code to interface it with the existing trampoline infrastructure.

Below, you can see an example of the trampoline as it is in the game, with no modifications. It does nothing visible. It does not stretch or squish itself.

Code

The trampoline is made out of 3 objects: the top, the spring, and the base. The base is a static object with no associated code. The top spawns the spring and the base, and sets a variable to whether Mario's on the platform or not (though this variable goes unused).

 
The trampoline as it is in the game, inert
 
The trampoline spring when forced to stretch; it doesn't line up with the trampoline, instead going below and above it

The spring continuously updates to be 75 units under the top of the trampoline, and has the incomplete code to visually stretch/compress itself. The math is not complete; on the right, you can see the effects it has when it is forced to run. The errors are caused by the programmers putting 50 and 500 arbitrarily in place of 150 (the height of the trampoline), and not putting a simple line of code to correct the spring's apparent position. The lack of this code supports the hypothesis that the code was abandoned early on.

When the aforementioned spring code is repaired and the trampoline top is made to lower when Mario gets on it, the intended compression effect can be seen.

In Mario's main movement code, there are 3 useless functions. The first just returns zero, and the next two do nothing at all. The last function is called by the trampoline every frame. The zero function is called in the function that determines Mario's vertical speed when he single jumps, double jumps, triple jumps, sideflips, backflips, steep jumps, long jumps, wall kicks, jumps from a handstand, or shell jumps. This function takes in a constant initial vertical speed and a multiplier, and outputs the vertical speed plus Mario's forward speed times the multiplier (making it so that Mario's jumps go higher when he goes faster), plus the zero function. Interestingly, most of the jumps listed have a multiplier of 0, which makes the function mostly pointless (it's also responsible for making Mario jump lower when squished). Due to the zero function's proximity to the empty function called by the trampoline, it is plausible that the empty function was intended to make Mario code aware of trampoline, and the zero function was intended to return the additive vertical speed from the trampoline. When these functions are restored according to this hypothesis, and the broken spring compression is fixed, a fully functioning trampoline can be made.

 
A repaired trampoline