Difference between revisions of "Addams Family (NES)/Game Mechanics and Techniques"
From SDA Knowledge Base
m (→Rowing the boat on the secret river) |
m (→Exploiting poor hit detection of solid walls) |
||
Line 75: | Line 75: | ||
If turning around in the freezer, while using the inertia to continue moving, you can clip into the solid wall near the end of the room. This can be used to jump over snowballs.<br><br> | If turning around in the freezer, while using the inertia to continue moving, you can clip into the solid wall near the end of the room. This can be used to jump over snowballs.<br><br> | ||
− | A similar technique can be used in the bone rooms in the crypt to jump into the walls when riding the moving bone platforms. This can be used to trigger the | + | A similar technique can be used in the bone rooms in the crypt to jump into the walls when riding the moving bone platforms. This can be used to trigger the movement of the upper bone platforms (they're only moving when Gomez is close enough to them) to reduce waiting time.<br><br> |
==Open questions== | ==Open questions== |
Revision as of 07:08, 16 January 2023
Contents
Items
In total, there is 1.056.300$ (+ a few thousand in hundred dollar bills raining down on the balcony), 3 chunks of cheese and 3 1-ups (but only two can be collected at most) in the game.
- Extra life. The 1-ups in the secret room of the pond and the one in the freezer are mutually exclusive. Collecting one will make the other disappear. The 1-up in the chimney is not impacted by this.
- Cheese, restores 16 health (56 max)
RNG
Most of the movements in the game run on local timers (item on screen and in a few cases room timers) and are therefore mostly predicable in real-time speedruns. However, at least the bats and birds have a random element to them. A central part for the triggering of bats appears to be the address $458, which is a sort of counter. It doesn't count down every frame and some values are skipped. This has not been described or investigated in further detail.
In TAS conditions, it can easily be seen that adding even small jumps, delaying a frame or jumping over/on a previous enemy can change the behavior of upcoming bats and birds. Based on these observations, it's assumed that their behavior can't be manipulated in real-time, but a description of the address $458 (bats) would be needed before anything can be concluded.
Movement mechanics
The basic movement in this game is very simplistic. Movement speed in the x-direction is 1 pixel/frame, with no acceleration, momentum or sub-pixels. The y-speed is slightly more sophisticated (0-3 pixels/frame) to give an impression of jumping in an arc. There are also some sections in the game that have more involved physics:
Stair mechanics
The first step on a stair can take anywhere from 1 to 10 frames and appears to be based on a global (or cyclic) timer. It does not appear to be manipulable, but the exact mechanics behind have not been investigated. The downtime can be used for x-movements in TAS-conditions, but it's difficult with the current knowledge to imagine any way to minimize stair downtime in real-time.
Swimming
Many games use sub-pixels to implement acceleration and inertia. Addams Family instead uses a somewhat convoluted calculation to achieve a similar result, but with some side effects that can be taken advantage of in a speedrun.
When Gomez takes a swim stroke (press 'A'), #$6 is added to the value in $30, up to a max of 21. $30 can be thought of as a sort of "probability momentum". Each frame, the value in $31 is subtracted by the value in $30. If $31 ends up being negative (i.e. $30>$31), #$F is added to $31 and Gomez moves one pixel in the x-direction. If $31 is still negative, another #$F is added and Gomez moves one more pixel. The value of $31 will therefore change quite erratically every frame. As a result, when looking at swimming in frame advance, Gomez moves 0-2 pixels each frame, even when the swim strokes are taken at a seemingly steady pace.
The value of $30 can decrease in two ways (if we disregard swimming into a solid object):
- Every time $45A changes value from 0 to 1, $30 decreases by 1. $45A is a cyclic counter that counts up every frame in the range 0-3. Hence why swim strokes need to be taken at a steady pace to maintain the speed.
- If the d-pad is released, $30 will decrease with 1 every frame.
It's also worth noting the following two important aspects about $30:
- Taking a swim stroke when the value of $30>=16 does not increase the value of $30. Once a value of 21 has been reached, the optimal swim stroke frequency is therefore every 24 frames, corresponding to the value in $30 having reduced to 15 after 6 cycles of decreases from $45A (each one taking 4 frames).
- Gomez can at most take a swim stroke every 9 frames. So too rapid button mashing will result in a loss of momentum.
In summary, when trying to swim quickly, there should in theory first be an acceleration phase of 5 quick strokes every 9 frames. This will increase the value in $30 5 times by a value of 6, but since $45A at the same time decreases the value 9 times (36 frames between the 1st and 5th stroke => $45A cycles through its 4 values 9 times), the final value will be #$21 if done optimally. From this point and onwards, a new stroke should be taken every 24 frames (and not faster!) to maintain the highest swim speed. Because of the layout of the pond, other considerations such as y-position and item collections obviously come into play as well.
Ice physics
Ice physics share the same fundamentals with swimming, but with different parameters. One is added every second frame to $30 if pressing the d-pad in the direction of movement, with a max value of 16. Movement is calculated in the same way as swimming by subtracting the value in $30 from the value in $31. The decrease of $30 from $45A when releasing the d-pad follows again the same rules as swimming.
Some comments:
- The physics are the same when jumping as when on the ground in the freezer.
- As opposed to swimming, there is no difference between pressing the opposite direction on the d-pad of movement or not pressing the d-pad at all. The only thing able to decrease the value of $30 is when $45A changes value from 0 to 1 (every 4 frames).
Rowing the boat on the secret river
The boat shares fundamentally the same physics as ice and swimming, but with other parameters. Pressing the direction of movement and B at the same time increases the value of $30 by 4, up to a max of 27. The x-movement of a frame is again calculated by looking at $31-$30. Since the max value of $30 in this case is higher than on ice or when swimming, frames with 2 pixel movements are more common.
$45A cycles through the values 0-3 and decreases $30 by 1 every time it goes from 0 to 1 (so every 4th frame). However, this is not in effect while in the air. If linking together buffered jumps, $30 can still decrease if $45A changes to 1 on the landing frame between the two jumps. This can be avoided by holding down B on the same frame (not bufferable).
Whether it's better to accelerate and then try to chain together a series of jumps when the x-speed is high or whether it's better to mainly stay on the gondola and row as much as possible (the game takes row inputs every second frame, so there is no risk of mashing too fast, like it was with the swim strokes in the pond) is debatable. And maybe in the end just a matter of personal preference.
Glitches and special techniques
Flying glitch
A glitch that allows Gomez to start flying after having climbed a stair. Useful in speedruns and easy to perform. It was discovered by 'ventuz', https://tasvideos.org/Forum/Posts/263156.
Item drops
It has been observed on a few occasions (only reported by 'ktwo'?) that enemies can drop cheese:
https://www.youtube.com/watch?v=20q9aWZ6tFA
This hasn't been recorded on emulator yet and is therefore difficult to analyze further. Unless money drops are possible, only the no-death category would be likely to benefit from additional cheese drops though.
Teleportation
Presumably found by 'capcomistle', https://www.youtube.com/watch?v=-hMBugFxC9k.
The secret rooms and the chimney contain hidden paths that lead to the bone rooms and the pit. There is no visual indication of where they are, but entering them is easy and don't require any precise inputs. Just press up when you're in the right spot. You'll generally end up outside the room geometry. In some of the destination rooms, it's possible to get back to a door, which can then be entered and thereby restore the normal game layout, while some teleportations lead to locking the game. By dying before the game locks up, the game can be continued as normal though.
Exploiting poor hit detection of solid walls
If turning around in the freezer, while using the inertia to continue moving, you can clip into the solid wall near the end of the room. This can be used to jump over snowballs.
A similar technique can be used in the bone rooms in the crypt to jump into the walls when riding the moving bone platforms. This can be used to trigger the movement of the upper bone platforms (they're only moving when Gomez is close enough to them) to reduce waiting time.
Open questions
Middle music manuscript
The manual says: "Each piece of music may help you, but you must figure out how!". The manual is quite explicit and actually explains how to solve the whole game and where to go in each step. It's often worded as mini-clues such as this, but they are pretty easy to figure out or even literally explained elsewhere in the manual. The left and right music manuscripts and their purpose are both mentioned in the manual's walkthrough and there does not seem to be anything glaring missing in the game that would need to be opened up. It can also easily be confirmed by playing around with RAM-address $471 that there are no unknown rooms that wait to be unlocked.
It can be worth mentioning how the game handles the other two music manuscripts. When a manuscript is collected, the value in $636 is changed from 0 to 1-3, depending on which one that was picked up. When taking it to Lurch, the value is copied to $623. A timer ($624/$625) then starts to count 5 full cycles (= 256 frames each) after which Lurch will start playing. If Gomez is in the correct location, the corresponding event will trigger. So when playing the left manuscript, the door in the library will start to open ($33E), and when the right manuscript is played, the dancers will move away (x/y - $32F/$33B) from the door to the wood.
The piece of code that is run is based on the values of RAM-addresses $E/$F. They change value depending on Gomez's location. This makes it a bit harder to conclusively say that the middle manuscript doesn't do anything (even though it's the likely answer). Unless you are in the right location, the piece of code that can be triggered by this manuscript being played won't run and could therefore be hiding somewhere in the game code.
Finally, the manual says that each manuscript may help, which is consistent with one of them not doing anything.
Fester's room
The manual says: "There must be something worthwhile in here." (the word 'something' is written in italic in the manual as to emphasize some kind of clue or riddle). There is a money bag in the upper left corner in plain sight, but it seems a bit odd if that is what the manual refers to. Since it's clearly visible, there is little point in making a clue about it or pretend like the player needs to look hard to discover it?
As already mentioned in the section about the middle music manuscript, it can easily be confirmed that there are no unknown rooms in the game that are missing an access. So if there really is something other than the money bag the manual refers to, it could be e.g. a hidden item or switch. However, there is no object loaded in memory other than the clearly visible ones (the money bag, spiders and their respective web strings). Nothing seems to be triggered in the code when the middle music manuscript is played either.
The most likely answer is probably that there is nothing there. Maybe whoever wrote the manual did it based on incomplete information about the game or based on content that was later removed from the game or they just tried too hard to come up with an interesting twist to the text for this room, when really there wasn't much to say in the first place. It wouldn't be the first time a game manual contains wrong or misleading information.
Locked door in the hall
The purpose of the door to the left on the ground floor in the hallway is unclear. It's not mentioned in the manual and there doesn't appear to be any reports of anyone claiming they've gone through it. Does it lead to Gomez's room, where Fester's imposter and the evil lawyer have taken Morticia to and locked themselves in? That could explain why Gomez needs to take such a detour via the secret river to save Morticia.
Useful RAM-addresses
4/5 - x/y window coordinates
12/13 - Gomez's x/y coordinates on screen
E/F - Appears to be used as a pointer in the code to specific events. It's e.g. used to point to the piece of code that triggers the dancers in the ballroom when Lurch plays the right music manuscript.
30 - Can be thought of as a "probability momentum". See the section about swim physics for more details.
31 - Used to calculate Gomez's movement when swimming/on ice/rowing. See the section about swim physics for more details.
32C/338 - x/y of the first object (includes both enemies and items) in memory. If more objects are loaded, their positions are stored in the next RAM-addresses.
458 - RNG-counter that determines bird spawing and bat behavior. It's not counting down every frame and sometimes skips values. How this functions is not yet described.
45A - A frame counter that cycles through the values 0-3. When changing value from 0 to 1, the value of $30 is generally decreased by 1 (for more information, see description on swimming/ice physics/rowing).
45D - Gomez's movement direction
471 - Room number #$0-#$24. The value is only shown during room transitions, but changing while inside a room teleports to the corresponding room.
4E9/4E8 - Gomez's big/small health (72 points max)
605 - Timer that is 0 at the start of the game and only runs in the Toy Room. This timer is used by the game to change the smiley faces on the boxes. The exact mechanics haven't been investigated, but the conclusion is still that it does not seem possible to manipulate the timing of the smileys and that you'll always get the same pattern. Note however that the value is kept upon leaving the Toy Room. So if you for some reason would like to revisit this room, the timing of the smileys will be different.
623 - Contains the music manuscript when handed over to Lurch
636 - Contains the music manuscript in Gomez's inventory