Open main menu

Castlevania Speedrunning β

Changes

Cv1/ScrollGlitch

776 bytes added, 18 April
Training Resources, Starting Pixels and Timings
Castlevania graphics are made up of foreground sprites (simon, candles, hearts, enemies) and background tiles. The game is building up these background tiles ahead of what is actually on the screen behind the scenes so that it can scroll smoothly as Simon moves. Around half a screen offscreen, the game is drawing a column two blocks wide. When that is complete, the game moves onto the next column. It looks something like this:
[[File:CV1_ScrollGlitch1. updated.png|550px]] 
=== Tile Update Algorithm ===
We are now going to choose which actual blocks on the column will be updated. The game manages a special variable called the Block Counter that determines that location. This variable maps to the tiles vertically like so:
[[File:CV1_ScrollGlitch2Block_Counter_mapping.jpgpng|550px]]
The block counter has a value between 0 and 7, inclusive; however, only the values 1-6 actually map to blocks.
=== How non-glitched walking normally works ===
A player usually just walks in one direction for a while. As they walk through a new Column Update Window, the column 1.5 screens away starts getting updated. The Column Update Window is 32 pixels wide and we update tiles every other pixel, so we will run the tile upgrading algorithm 16 times (32/2). This will cause the block counter to go from 0 -> 7 and then 0 -> 7 again. This updates every tile value twice. Updating it twice doesn’t cause any harm - it just puts the same value there.
 
''NOTE - Technically there is a 50% probability of it being 15 times, not 16. This is because the first value is always overridden to 0. If that happens on the tile updating frame, the counter will still be held at 0. ''
=== What causes the scroll glitch to happen? ===
If the block counter is only updated every other frame, it seems impossible to actually make the trick predictable. Luckily, there is a neat math trick that solves this. This is best explained with an example:
''NOTE - Technically there is a 50% probability of it being 15 times, not 16. This is because the first value is always overridden to 0. If that happens on the tile updating frame, the counter will still be held at 0. ''
If you move 1 frame, did you move the block counter? You don’t know. There is a 50% probability you did. If you move 2 frames, did you move the block counter? You moved the counter one and only one time with 100% certainty. This is because you either updated on the first frame or the second frame. It can’t be both or neither!
Note that these are simplifications. There are scenarios where you can do fewer turnbacks if you get lucky ( a combination of turnbacks being too short but getting lucky with the frame counter). In addition, you often want to execute extra turnbacks to raise consistency (discussed later).
''TECHNICAL NOTE - This is oversimplified. There are some details around having an odd number of pixels on the last walk forward that leads to one extra counter iteration. I don’t think this is a missing aspect of the algorithm, just some tricky off-by-one math. I got frustrated and stopped trying to nail it down exactly. ''
=== Scroll Glitch Execution Approaches ===
For all strategies, there is an important starting pixel where you want to start your turnbacks. This is the pixel that will have the block counter 1 below your target block regardless of whether. You can find this pixel with visuals for each of the level 5 tricks at: https://castlevaniaspeedrunsfurther down this page.com/Cv1/level5
=== 2 - 14 Turnback Method ===
Unfortunately, this approach does have a few downsides. First, each turnback will cost an extra 4 frames. In addition, you will often have to do one extra turnback relative to the two pixel turnback. If targeting block 2 or 3, I would recommend 4 turnbacks. Anything below that, I would recommend 3 turnbacks.
=== Training Resources , Starting Pixels and Timings ===
ROMHack - A romhack is available on the CV1 discord. When used, it will print out Simon’s pixel coordinates. In addition, it will print the Block Counter.
The starting pixel coordinates for the scroll glitches are:
{| class="wikitable" style="margin:autoleft"
|+
|-
! Stage Number !! Pixel !! Savings**
|-
| Stage 6 Crusher || TO FILL IN 1D9 & 1B9 || ~ 9 sec
|-
| Stage 13 7 Coffee || A4 255 & 1F9 || ~ 1.4 sec
|-
| Stage 14 Wall 13 Griddle || 328 A4 || ~ 12.5 sec
|-
| Stage 14 Ceiling Drop Bacon || TO FILL IN45C or 43D || ~ 3.5 sec
|-
| Stage 14 Advanced Egg || 2C4* || ~ 6 sec
|-
| Stage 14 Cheese || 328 || ~ 8 sec|-| Stage 14 Race || 21C || ~ 8 sec|-| Stage 17 Clocktower || TO FILL IN 219 & 1FB || ~ 6 sec
|}
 
<nowiki>*</nowiki>Touching pixel 2B9 is needed before turning around
 
<nowiki>**</nowiki>Timings are approximate, also you may not see the same time savings if you don't play the rest of the level as optimal as your prior splits, example the 12 second saving of Stage 13 might turn into 6 seconds if you missed other things in level 5.
 
Stage 13:
If you are trying to learn a whipless rhythm approach, sounds can also be a helpful aid. You hit the buttons on the appropriate beat. Every frame is 1/60th of a second (technically 1/60.09), so you can use that to create a beat. One style is to do 4/60th of a second followed by 12/60th of a second. Another is to just have a metronome set to 16/60th of a second and time either your forward or backward presses to that beat.
Attached is an MP3 created Below are two videos with rhythm of whipless scroll glitch turnbacks for the 4-12 pattern. To execute 4-12 wiggles, do a turnback on the short note, and move forward on the long note. {{#ev:youtube|Zn2FFhDc5WE|550}} {{#ev: TO FILL IN youtube|-WG7e4nAnp4|550}}
=== Acknowledgements ===
{{#ev:youtube|zxLs7h2cL6Y|550}}
 
Displaced Gamers Video on the code
 
{{#ev:youtube|wd18YNZB0D4|550}}
20
edits