Castelian (NES)/Game Mechanics

From SDA Knowledge Base

Jump to: navigation, search

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. Some balls immediately start moving in the x-direction upon spawning (e.g. the balls at the very end of towers 4, 5 and 7). The other balls are triggered by various checks. The game polls every 10 movement frames (so every 30 actual frames + any lag frames) whether to start moving the ball or not. This corresponds to the ball being at floor level (the balls bounce up and down in a cycle of 10 game frames). The game then checks that the player is within 32 x-pixels and that the player is walking or standing still (all other player movements/animations will prevent the ball from triggering). These checks start at instruction $D20B and a successful check results in changing the value of $15F+Y, where Y is the enemy number (from 0 to 3), to a non-zero value.

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.

Bugs/tricks/glitches

Alternative door exits (found by 'pirohiko')

In towers 1-6 and 8, one of the doors has two different exits (the reason for tower 7 being excluded is because there are no doors in that tower). The regular exit is reached by the standard method of pressing up on the d-pad when in front of the door. The alternative exit is reached by instead entering the door by pressing down. Most of the alternative exits work as shortcuts, but not all. See the routing videos for more details about the considerations for the individual towers.

The reason for some doors having two exits hasn't been investigated. Remains from the development process that were never removed or intentional secrets/shortcuts?

Glitched tower

At the top of every tower, there is one tile that when pressed down on will make a new elevator appear and all enemies to despawn. Taking this lift will freeze the time (as well as the molecule timer) and bring you to a moderately glitched extension of the tower. By taking the lift back down, the tower can be completed as normal. While this has the potential for creating shortcut opportunities, it's not the case and none of the lifts appears to be useful in a speedrun. However, despawning the enemies can save time and be used in a speedrun (e.g. in tower 5).

The score is increased normally when moving up to the glitched tower top. In tower 7, there is even an additional glitch that let's you score points repeatedly by going up and down the glitched portion of the tower. Since time is frozen, it's therefore trivial to score an essentially infinite amount of points without any risk. This game is therefore not suitable for score attacks. However, a casual player or one in the process of learning how to speedrun the game could benefit from this by stocking up on lives before tower 8.

RAM-addresses

B0/B2 - 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

Personal tools