Zelda 64 Engine

The Zelda 64 Engine is the core engine for both Ocarina of Time and Majora's Mask.

There are three major components to the Z64 Engine that are important to speedrunners: Scenes, Rooms (sometimes referred as maps), and Actors.

  • Scenes can be thought of as being a container for an entire area.
  • Rooms are smaller segments (like a room in a dungeon) of a scene.
  • Actors are the interactive elements and npcs that make up the world.

Scenes

Only a single scene can be loaded at a time. Scenes can contain anywhere between 1 to 32 rooms, though the biggest dungeon (Spirit Temple) only has 29 rooms.

To illustrate, Kokiri Forest is broken down into three rooms:

  1. The "village"
  2. The maze where you obtain the Kokiri sword
  3. The meadow where the Great Deku Tree sits.

Scenes contain a collision mesh that provides the collision data for every map in the scene. This mesh is always loaded while the scene is loaded, making it possible to walk inside the "unloaded" rooms without falling through.

Scenes also contain exits that load a new scene when touched. Exits are part of the collision mesh for the scene and are triggered by passing over them. Because they are part of the scene collision, you can always trigger an exit by reaching the exit's physical location, regardless of what map is loaded.

For example, if Kokiri Forest's "village" room is loaded, walking into where the Deku Tree's mouth would be will transport you to the Inside the Deku Tree scene.

Exits can be thought of as being always "on"; only geography and actor placements are used to block access to them.

In some scenes, the rooms are not linked together, and instead are treated as seperate locations. Because the scenes contain collision for all rooms, and exits are part of the collision mesh, you can potentially trigger the exit for a room you did not originally enter. This is known as Wrong Warping, but is unrelated to the newer Wrong Warp glitch.

Below is a short list of scenes which group together non-interconnected rooms/

  • Ocarina of Time
  • Grottos
  • Lon Lon Ranch's ranch house and silo buildings, but not the Stable
  • Majora's Mask
  • Fairy Fountains
  • Grottos

For example, in Majora's Mask there is a trick known as Fairy Fountain Wrong Warp which allows you to quickly travel between locations by hovering between the Fairy Fountain "rooms".

Rooms

Rooms are essentially the segments of a scene. Rooms contain the graphical data, and can contain a list actors to load. Up to two different rooms can be loaded at the same time, but this usually only occurs during a transition between rooms.

It's possible to duplicate actors by passing through a "black" room transition actor in the same direction multiple times. This can be done by hovering around the room transition into an "unloaded" room, then coming through the map trigger into the first map. This type of duplication makes it possible to collect multiple copies of certain heart pieces and gold skulltulas.

Another bizarre glitch is known to exist in regards to rooms. In the main room of the Bottom of the Well it's possible to do a variant of the Walking While Talking glitch by opening a door while the camera is fixed after exiting a crawl space. While the intended destination loads normally, the graphic mesh of the main room remain loaded. Furthermore, Link is left behind on the main room side of the door.

Actors

Actors are the interactive elements and npcs that make up the world. There are many different types of actors in Ocarina of Time, ranging from items, to dungeon objects like blocks and enemies, to NPCs, to environmental effects like sound effects and lighting, and to set pieces like Dark Link's room.

In order to reduce lag, actors contain a flag that is used to determined if they should be rendered. The flag is set depending on the actor's distance from the camera and the direction the camera is facing. However, some actors will also use this flag to determine if it should be processed on a given frame. This results in a number of "If you don't see it, it's not there" glitches.

For one, it is possible to escape the forest via the "Walking While Talking" glitch. When activating this glitch in Kokiri Forest, the camera becomes locked in place on the sign next to the crawlspace. As long as the camera is locked here, the Kokiri kid blocking the exit from the forest is not processed, and subsequently the invisible wall does not exist either.

The second glitch that is known to occur due because of this is the 0,0,0 glitch. When entering a new area, the collision box for a skulltula is not set properly until it is within viewing range of the camera. Instead, it is placed at the 0,0,0 coordinate. Because of this, it is possible to kill the gold skulltula at the Desert Collossus by placing a bomb near the 0,0,0 coordinate.

One final glitch related to actors is known as the Hyrule Field glitch. It is caused by running out of memory to allocate new actors. This can occur a few ways:

  • The game can simply run out of space to allocate new actors
  • The game can have a considerable amount of free space available, but fail to load actors because the available free blocks are too small.
  • In Ganon's Castle, the light beam actor does not despawn when leaving the main room, resulting in multiple copies of the beam being created.

Because the code files for items like explosives and arrows are not loaded into memory until needed, running out of memory can result in the inability to use these items.

Last updated 04/17/2014 – mzxrules