Difference between revisions of "Beetlejuice (NES)/Game Mechanics and Techniques"

From SDA Knowledge Base

Jump to: navigation, search
m (Scares)
(Enemies and objects)
Line 76: Line 76:
 
==Enemies and objects==
 
==Enemies and objects==
 
===Delia's art pieces===
 
===Delia's art pieces===
===Beetles (side view sections)===
+
[[File:Art_piece1.PNG]] [[File:Art_piece2.PNG]] [[File:Art_piece3.PNG]]<br  />
===Beetles (overhead sections)===
+
The following description refers to the art pieces' x-position, the y-position works in an analogue way. The description is applicable to both the objects in room 0x13 and 0x15 (from $55).<br  /><br  />
 +
 
 +
Every 16th frame, the RNG function is called and through various calculations updates [$5CA+X].  This address has double purposes. First it determines a base movement of the object for the next 16 frames. This base movement is either move left or stand still. Then through logical manipulations, it adds a number to [$5D0+X] every frame. The new x-position (5AC+X) is then calculated by taking ”move left or standstill” plus if there was a carry in the calculation of the new [$5D0+X].<br  /><br  />
 +
 
 +
Several steps have been skipped in the description above, but the end result and conclusion are that the game achieves something similar to a sub-pixel movement. During 16 frames, the art piece will move 0 or 1 pixel every frame, depending on how often the carry is produced in the calculation of [$5D0+X].<br  /><br  />
 +
 
 +
With the art pieces' movement at the core relying on RNG, it's difficult to see how any manipulation would be possible.<br  />
 +
 
 +
===Beetles (side view levels)===
 +
[[File:Beetle_(side_view_levels).PNG]]<br  />
 +
* $41X - position and object occupied
 +
* $42F+X - Beetle type (0 – 10, 1 – 25, 2 – 50, 3 – 75)
 +
<br  />
 +
 
 +
Every 4 frames, the RNG function is called and a result is compared with 0x32 (instruction $A835). If it's smaller, another check is done with a 1/4 chance of passing per active beetle hole on screen (instruction $A83F). A beetle will then spawn from the corresponding hole.<br  /><br  />
 +
 
 +
The type of bug is again determined by running the RNG function. The result is this time compared with 0x50 (instruction $A875). If it's smaller, a red beetle (worth 10 vouchers) will spawn. If it's greater, another check is done with equal probability of the remaining 3 types (instruction $A879).<br  /><br  />
 +
 
 +
In summary,  as long as the three available beetle memory addresses aren't filled, the probability of one of the 3 more valuable types spawning per second and per hole is 15*(48/256)*(1/4)*(166/256) ~ 46%.<br  />
 +
 
 +
===Beetles (overhead levels)===
 +
[[File:Beetle_(overhead_levels).PNG]]<br  />
 +
* $60C – Beetle flag
 +
* $611/$60E/$60D – Big/Small/Sub x-position
 +
* $610/$60F – Small/Sub x-speed
 +
* $619/$616/$615 – Big/Small/Sub y-position
 +
* $617/$618 – Small/Sub x-speed
 +
<br  />
 +
 
 +
There is a 75% chance that an enemy drops a beetle (instruction $9E8C, when enemy health goes to 0). Same for all enemy types. There can however only be one beetle at a time (controlled by the beetle flag).<br  /><br  />
 +
 
 +
The speed is recalculated every second frame as the current speed and an addition based on a result from calling the RNG function (see e.g. Instruction $BD50).
 +
<br  />
 +
 
 
===Cavern monsters===
 
===Cavern monsters===
 
===Cloud elevators===
 
===Cloud elevators===

Revision as of 04:59, 20 March 2023

Animations

Movement mechanics

Time cost comparisons

Scares

Name Cost Shots Special ability Comments
Medusa.png Medusa head 100 1 Freezes "floating skulls" (found in some bug holes)
Birdman.png Birdman 150 2 Increases jump height The jump ability allows for shortcuts and is very useful in a speedrun
Two-headed man.png Two-headed man 200 3 1-hit kills the sandworm on Saturn
Skeleton.png Skeleton 250 5 No damage from bees, 1-hit kills the beehives (both only found in level 1)
Umbrella.png Umbrella head 400 9 None? The manual hints about giving some sort of advantage against the octopuses in the sewer stage
Ogre.png Ogre 500 12 1-hit kills the cavern monsters in level 2 (Storm drains)
Ghost.png Ghost (called "spooksheet" in the game) 600 15 None? Only available in the graveyard level. The manual does not seem to hint about any special ability. It sounds more like it's an "all-purpose" scare with lots of shots.
Snake.png Snakeman 750 19 None? Same comments as for the ghost scare.


RNG

The RNG-addresses in RAM are $24-$27. They're calculated by various operations between themselves and take the result of the previous set of RNG and the global timer ($3BB) as seeds.

The RNG-function is called by various events that require a new set of RNG. This can result in the RNG being calculated from several times per frame to every few frames or not all (if nothing loaded in memory requires RNG-values.

There is no indication that the RNG-values would be possible to manipulate in real-time. In TAS-conditions, the RNG can be manipulated to a certain extent by performing actions that trigger the RNG-function to be called. Beetlejuice's movements don't impact the RNG-function, but e.g. throwing a potion (in the overhead section) will create additional calls of the RNG-function.

Things impacted by RNG

Enemies and objects

Delia's art pieces

Art piece1.PNG Art piece2.PNG Art piece3.PNG
The following description refers to the art pieces' x-position, the y-position works in an analogue way. The description is applicable to both the objects in room 0x13 and 0x15 (from $55).

Every 16th frame, the RNG function is called and through various calculations updates [$5CA+X]. This address has double purposes. First it determines a base movement of the object for the next 16 frames. This base movement is either move left or stand still. Then through logical manipulations, it adds a number to [$5D0+X] every frame. The new x-position (5AC+X) is then calculated by taking ”move left or standstill” plus if there was a carry in the calculation of the new [$5D0+X].

Several steps have been skipped in the description above, but the end result and conclusion are that the game achieves something similar to a sub-pixel movement. During 16 frames, the art piece will move 0 or 1 pixel every frame, depending on how often the carry is produced in the calculation of [$5D0+X].

With the art pieces' movement at the core relying on RNG, it's difficult to see how any manipulation would be possible.

Beetles (side view levels)

Beetle (side view levels).PNG

  • $41X - position and object occupied
  • $42F+X - Beetle type (0 – 10, 1 – 25, 2 – 50, 3 – 75)


Every 4 frames, the RNG function is called and a result is compared with 0x32 (instruction $A835). If it's smaller, another check is done with a 1/4 chance of passing per active beetle hole on screen (instruction $A83F). A beetle will then spawn from the corresponding hole.

The type of bug is again determined by running the RNG function. The result is this time compared with 0x50 (instruction $A875). If it's smaller, a red beetle (worth 10 vouchers) will spawn. If it's greater, another check is done with equal probability of the remaining 3 types (instruction $A879).

In summary, as long as the three available beetle memory addresses aren't filled, the probability of one of the 3 more valuable types spawning per second and per hole is 15*(48/256)*(1/4)*(166/256) ~ 46%.

Beetles (overhead levels)

Beetle (overhead levels).PNG

  • $60C – Beetle flag
  • $611/$60E/$60D – Big/Small/Sub x-position
  • $610/$60F – Small/Sub x-speed
  • $619/$616/$615 – Big/Small/Sub y-position
  • $617/$618 – Small/Sub x-speed


There is a 75% chance that an enemy drops a beetle (instruction $9E8C, when enemy health goes to 0). Same for all enemy types. There can however only be one beetle at a time (controlled by the beetle flag).

The speed is recalculated every second frame as the current speed and an addition based on a result from calling the RNG function (see e.g. Instruction $BD50).

Cavern monsters

Cloud elevators

"Fish in cauldron"

Flies (overhead sections)

First boss

Flowers

Football legs

Lights

Mouse

Second boss

Spiders

Sweepers

"Urn with bouncing ball"

Buffered inputs

Glitches

Screen warping in the overhead levels (TAS-only)

Softlocks

Open questions

Brick

Toilet paper

Additional scares with special abilities

Selection of known RAM-addresses

Personal tools