Difference between revisions of "Beetlejuice (NES)/Game Mechanics and Techniques"
From SDA Knowledge Base
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 | + | [[File:Art_piece1.PNG]] [[File:Art_piece2.PNG]] [[File:Art_piece3.PNG]]<br /> |
− | ===Beetles (overhead | + | 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
Contents
- 1 Animations
- 2 Scares
- 3 RNG
- 4 Enemies and objects
- 4.1 Delia's art pieces
- 4.2 Beetles (side view levels)
- 4.3 Beetles (overhead levels)
- 4.4 Cavern monsters
- 4.5 Cloud elevators
- 4.6 "Fish in cauldron"
- 4.7 Flies (overhead sections)
- 4.8 First boss
- 4.9 Flowers
- 4.10 Football legs
- 4.11 Lights
- 4.12 Mouse
- 4.13 Second boss
- 4.14 Spiders
- 4.15 Sweepers
- 4.16 "Urn with bouncing ball"
- 5 Buffered inputs
- 6 Glitches
- 7 Open questions
- 8 Selection of known RAM-addresses
Animations
Movement mechanics
Time cost comparisons
Scares
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
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)
- $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)
- $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).