Castelian (NES)/Game Mechanics
From SDA Knowledge Base
Contents
Difficulty differences
There are two difficulties in the game, "Novice" (default) and "Hero".
- The molecule enemies move twice as fast on Hero difficulty. This saves time in some places and loses time in other places compared to Novice difficulty. Overall, it favors playing on hero by a few seconds.
- The in-game timer ticks down every 15 game frames (= 45 frames + random lag frames) on Hero and every 20 game frames (= 60 frames + random lag frames) on Novice. Since the timer is converted into points at the end of each tower, this favors Hero difficulty by a few seconds over the course of a run (3 frames saved per avoided tick on the timer).
- Extra lives are awarded every 5.000 points on Novice and every 10.000 points on Hero. This is unlikely to have any consequence for a speedrun though.
Overall, Hero is clearly the faster of the two difficulties.
Lag
The game is inherently very, very laggy. The vast majority of lag is outside player control in real-time, but a few observations can still be made.
- When longer waiting times are required, it's sometimes possible to position yourself so enemies are off-screen, which can reduce lag (e.g. in tower 4).
- For sequences of the type "move right-take lift-move left", it seems like the lag situation can be different depending on if the character is turned around before or after the lift is activated. The difference is generally small though and it can be difficult to confirm with certainty that one sequence is faster than the other and not just depending on random lag that is susceptible to change for a different save state.
- Random lag contributes a significant factor to the time. Two full playthroughs with comparable execution might differ by up to 5-6 seconds because of this. Theoretically, it could be even more, but the odds of getting consistently good/bad random lag in tower after tower to fall outside this range appears to be pretty low.
- While changing the sound from "Effects" to "Music" is more pleasing to listen to while playing, it also introduces a lot of additional lag.
Movement comparisons
The term "movement frame" will be used repeatedly in this section. The game runs at 20 fps, so one movement frame is 3 actual frames (+ any lag frames).
- When climbing a stair-like set of platform steps, you can either walk or jump up them. There are 5 movement frames that are possible to jump on.
- - Jumping on the first possible movement frame saves two movement frames over walking.
- - Jumping on the second possible movement frames is one movement frame faster than walking.
- - Jumping on the third or fourth movement frame is equally fast to walking.
- - Jumping on the fifth (and last) movement frame is one movement frame slower than walking (this can easily be seen by noticing how the character sort of jumps into the side of the next step and thereby losing a bit of horizontal momentum.
- Jumping the last step to an opening is at best one movement frame slower than just walking up.
- When waiting for an enemy on a staircase to move out of the way, it's faster to walk up the steps past it. Jumping below the enemy will only work by pausing more than the jump ends up saving.
- It doesn't matter from which x-position a lift is activated. If the player is not centered, the game will automatically center the player with normal movement speed.
- In terms of animations and transitions, all x-pixels are equivalent when entering an opening. So any additional movement beyond the first available x-pixel an opening can be entered on is just a waste.
End-of-level countdowns
There are three countdowns after each level and each tick of countdown costs 3 frames (or more if random lag is added). The first one, the timer, is self-explanatory. The other two are:
- Technique - Starts at 100 and is reduced by 2 for every hit.
- Extras - Starts at 0. 5 is always added upon level completion and 2 is added for every destroyed enemy.
Enemy behavior
Enemy spawning
The game can only store four enemies in memory at the same time (including the molecule). When an enemy goes below the screen, it gets de-spawned (exception being the molecule) and a new enemy can take its place when the screen has scrolled sufficiently in the vertical direction to reach its spawn point. The enemies always spawn in the same order and their spawn locations are always the same.
Enemy movements
The movements are predictable with one exception. There is some variation to the initial x-movement of the destroyable ball enemies. The movement of these enemies seem to be triggered according to a few different mechanics. For example, balls that spawn during a lift ride always (?) start moving immediately. There is one important mechanic that governs at least some of the other balls. Notably the one near the end of tower 4. The game then polls every 10 movement frames (so every 30 actual frames + any lag frames) whether to start moving the ball or not. The game then checks that the player is within 32 x-pixels, that it's on the same y-level and that the player is walking or standing still (so jumping or shooting will not trigger the ball). The sub-routine for this check starts at $D20B and a successful check results in changing the value of $15F+Y, where Y is enemy number (from 0 to 3), to a non-zero value.
It should be noted that there appears to also be balls following other mechanics that are not described here.
The molecule
Whenever there are less than four enemies active in memory and the molecule is not one of them, a timer counts down every game frame (= every 3 actual frames) from 125 (decimal). When it reaches -1, the molecule will spawn.
RAM-addresses
12A/122 - x/y of the main character
125/12B - x/y of enemy #1
126/12C - x/y of enemy #2
127/12D - x/y of enemy #3
128/12E - x/y of enemy #4
164 - molecule timer
The y-coordinates for the main character are different from the ones for the enemies, but this has no other effect than being a slight inconvenience from a practical point-of-view. (The main character's actual x- and y-positions appear to be stored in B1 and B3, but at least in FCEUX 2.1.4, B3 doesn't display correctly in RAM watch)