Global timer

From Ukikipedia
Jump to navigation Jump to search

The Global Timer is a variable that increases by 1 on every frame. Some events occur depending on the parity of the global timer, or depending on other functions such as trigonometric calculations, so pause buffering can be used to alter the state of the game.

The Global Timer starts counting from the moment the console/emulator is powered on, and resets to 0 every time the game is reset. Many Objects and variables depend on the global timer to determine their course of actions on any given frame. Example: the coin display value in the HUD only goes up once the Global Timer is odd. This is why that with pause buffering, the coin display can fail to update for a certain amount of time.

Phenomena Dependent on the Global Timer

  • The opacity of Bowser's shock waves is decreased by 1 when the global timer is not divisible by 3.
  • Waves created when an object is thrown into water will disappear when the global timer is a multiple of 16.
  • Swoop's yaw and roll are dependent on the value of the global timer.
  • Coffin's shaking movement and sound is dependent on the global timer.
  • The LLL drawbridge only begins lowering or raising if the global timer is a multiple of 8.
  • Blowing wind spawns large particles when the global timer is even and small particles when the global timer is odd.
  • Water ripples created when Mario moves in water only spawn if the global timer is even.
  • The time it takes for Mario to be able to grab Hoot again after letting go of him is dependent on the global timer.
  • The JRB aquarium bubbles only spawn when the global timer is odd.
  • Penguin Blinking is controlled by the global timer
  • If held by Mario, the Baby Penguin will cry whenever the Global Timer is a multiple of 30.

Global Timer Overflow

As the Global Timer's value is stored as an unsigned integer, the Global Timer will overflow to 0 if the game runs for 4,294,967,296, or 2^32, frames. As the game runs at 30 frames per second, this will take 143,165,576.533 seconds, or roughly 4.5 years, to occur. This can affect some of the Global Timer dependent behaviors mentioned above.

  • Penguin blinking will be interrupted so that the Penguin's eyes go from being fully closed to fully open when the overflow occurs.
  • If Mario is holding the Baby Penguin at least 16 frames before the overflow occurs, the Baby Penguin will cry and then cry again as soon as the timer overflows, 14 frames earlier than another cry would start normally.