Dragon's Lair (NES)/Game Mechanics(ntscu)

From SDA Knowledge Base

< Dragon's Lair (NES)
Revision as of 06:35, 8 November 2020 by Ktwo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Dragon's Lair (NES)

Items

  • D - daggers, deal 1 HP of damage, 3 can be on screen at the same time
  • A - Axes, deal 2 HP of damage, 2 can be on screen at the same time
  • F - Fireballs, deal 3 HP of damage, 1 can be on screen at the same time
  • E - restore 16 energy
  • C - restore candle
  • G - Add one gold to the inventory
  • L - Extra life
  • P - Points

Hidden item locations

The list below comes from searching with save states, but hasn't been verified by address watching, so it's possible that there are still hidden items to be found.
Level 1 (in order of appearance)
A - right before the first two gateways
P - right after the first two gateways
F - after the third prisoner
A - before the second set of two gateways
F - after the last prisoner

Level 2 (in order of appearance)
C - in the opening in the roof between the first two moving blocks
P - two blocks to the right of the hidden C
P - after the first set of two moving blocks
A - before the first pit
L - after Singe's Dragon's Breath

Level 3 (in order of appearance)
P - under the second arc from the start
A - under the third arc from the start
G - before jumping on the ledge of the first pendulum
E - after the first set of two pendulums
L - after the axes
F - before the second ghost
E - right before the 3rd G
P - before the visible daggers
A - over the first floor support after the visible daggers
E - after the hidden axes
P - under the second arc after the big skull guarding a big pit
P - under the same archway as the above P

Level 4 (in order of appearance)
There doesn't appear to be any hidden items in this level.

Movement and animations

This section looks at the cost of performing various actions. If nothing else is stated, it's compared to walking in a straight line.

  • First shot - 35 frames
  • Subsequent shots - 20 frames/shot
  • Small jump - 30 frames
  • Big jump - 35 frames
  • Small vertical jump - 95 frames
  • Big vertical jump - 120 frames
  • Dropping down "1 height" - 35 frames (meaning that it's 5 frames faster to jump off ledges than drop down from them)
  • Duck and rise - 70 frames
  • Go straight into ducking position after a jump - saves 15 frames compared to performing jumping and ducking separately
  • End-of-level gold countdown screen (1 gold) - 157 frames
  • Countdown for each additional gold - 24 frames
  • Chaining jumps together, chaining ducking and rising, "corner landing" all have no additional impact on the animation times


Energy

The player energy is tracked in memory addresses 332 (big energy, BE) and 6A5 (small energy, SE). When the small energy loops, the big energy is reduced by 1. A life is lost when the big energy hits 0. Below are some observations about the energy.

  • E block - +16 BE
  • Getting hit by a bat, skull, the Lizard King or a bubble - -4 BE
  • Shoot - -16 SE
  • Start energy - 39 BE
  • If the player's BE is 2, 3 or 4, getting hit by an enemy brings you down to 1 BE and whatever you had left of small energy, instead of killing you if it had inflicted the normal 4 damage.
  • If an E is collected when player energy > 23, you'll end up with 39 BE and whatever you had left of small energy.


Note: There is a bug that can occur with the Lizard King. If you bump into him in the vicinity of where the first serpent was supposed to appear, you'll take damage continuously. In a speedrun setting (so walking to the right without stopping), that means a damage of 12 BE. If you stop moving while taking damage, even more energy will be lost.

Enemies

  • Serpent - 3 HP
  • Red bat - 3 HP
  • Baby dragon - 4 HP
  • All other regular enemies have 1 HP
  • Dragon under the drawbridge - 10 HP
  • Mine cart troll - 10 HP (each)
  • Grim Reaper - 16 HP
  • Singe - 40 HP


The RAM addresses containing the bosses' health tend to vary a bit, depending on which object index they're loaded in memory. A few examples are: $3B2, $3C4, $3FA, $3E8, $BB2 and $40C. It's easy enough to find these addresses when needed, so no further attempt has been made to investigate if there are other possible addresses.

The Lizard King

The Lizard King guards the gold of the castle. As soon as you have collected/stole some of its gold, a random check will occur every movement frame (=5 actual frames). An outline of the RNG check that is performed to determine if the Lizard King appears or not is as follows:

  1. Call the RNG-function starting at $C000
  2. If the accumulator is >= #$FB, then branch (instruction $DAB1), else abort
  3. Call the RNG-function starting at $C000
  4. If the accumulator is <= #$20, then branch (instruction $DAB9), else abort
  5. $718 is loaded and will start to count down for the Lizard King to appear

Each check therefore has a 1/51 * 1/16 = 1/816 ~ 0.12% to spawn the Lizard King. It's difficult to see how the RNG calculation behind the Lizard King's appearence can be manipulated in real-time, but some observations can still be made:

  • The RNG check that triggers the Lizard King is only done in certain areas of the game. The check isn't done in the middle section of stage 2 (before and after the dragon's breath pit) and the whole stage 3. Also, the checks aren't started at the very beginning of each stage and they are stopped a little before and under the boss fights.
  • If you have no gold, no check is done and the Lizard King won't appear. In a casual playthrough, where one might be tempted to kill the Lizard King, it will therefore continuously appear until it has bumped into you and retrieved its gold.
  • Since a speedrun spends roughly the same amount of time between attempts in each level, it's possible to estimate the probability of a Lizard King spawn in each level.
- Level 1 is ~ 50%.
- If no encounter in level 1, the first section of level 2 has ~25% encounter rate (if the Lizard King already took the gold in level 1, it will not appear at the start of level 2). There is also a short section before the bosses, where the check is done. Since there is forced gold before this section, it can always appear here. However, the probability is only around 1/15, due to how short the section is.
- The Lizard King check isn't done in level 3 and encounter is therefore not possible.
- Roughly 75% chance of an encounter in level 4
  • While there are benefits with getting a Lizard King encounter (losing the gold, but also despawning enemies), it's on average far from being worth waiting for the Lizard King to appear. However, if someone were willing to put in enough attempts, it's clear that there could be time to save by trying to wait for the Lizard King in strategic places (in particular in level 4).


Singe

Singe's puffs are blown at regular intervals, but their height is based on RNG that is unlikely to ever be possible to manipulate in real-time. The branch operator in $A26F determines if the puff will be high or low, based on if the accumulator is even or uneven. Input to this calculation are the addresses $6A1 and $6A2, which change value every frame according to an RNG calculation that appears to be random for real-time considerations. Without a deeper analysis, Singe's puffs are therefore not possible to manipulate and with equal chance generating a high puff as a low puff. There doesn't appear be any kind of "equalizing" factor built into the code such as "if too many puffs of one type, increase the chance of the other kind".

Personal tools