TASVideos

Tool-assisted game movies
When human skills are just not enough

Submission #5735: Zurggriff & Aglar's Genesis Sonic the Hedgehog 2 in 17:40.08

Console: Sega Genesis
Game name: Sonic the Hedgehog 2
Game version: any,r1
ROM filename: Sonic the Hedgehog 2 (JUE) [!].bin
Branch:
Emulator: Gens 11a
Movie length: 17:40.08
FrameCount: 63523
Re-record count: 12451
Author's real name: Jonathan Jourden & Mikael Johansson
Author's nickname: Zurggriff & Aglar
Submitter: Zurggriff
Submitted at: 2017-12-09 01:46:43
Text last edited at: 2017-12-16 09:22:36
Text last edited by: feos
Download: Download (8901 bytes)
Status: published
Click to view the actual publication
Submission instructions
Discuss this submission (also rating / voting)
List all submissions by this submitter
List pages on this site that refer to this submission
View submission text history
Back to the submission list
Author's comments and explanations:

Movie Features

  • Emulator used: Gens version 11a
  • Aims for fastest in-game time, then fastest real time
  • Abuses programming errors
  • Takes damage to save time
  • Manipulates luck

About The Movie

This movie implements the new routes found in Emerald Hill 1, Chemical Plant 1, and Casino Night 2, along with some minor improvements in a few of the other levels.

Table of Times (minutes:seconds::frames)

Act New Time Old Time Frames Saved Total Frames
Emerald Hill 1 0:14::18 0:15::34 76 76
Emerald Hill 2 0:33::31 0:33::31 0 76
Chemical Plant 1 0:13::31 0:16::33 182 258
Chemical Plant 2 0:31::58 0:31::59 1 259
Aquatic Ruin 1 0:12::50 0:12::50 0 259
Aquatic Ruin 2 0:27::16 0:27::16 0 259
Casino Night 1 0:19::32 0:19::32 0 259
Casino Night 2 0:36::52 0:44::54 482 741
Hill Top 1 0:23::45 0:24::25 40 781
Hill Top 2 0:38::32 0:38::32 0 781
Mystic Cave 1 0:22::12 0:22::12 0 781
Mystic Cave 2 0:32::11 0:32::11 0 781
Oil Ocean 1 0:16::42 0:16::42 0 781
Oil Ocean 2 0:28::58 0:29::20 22 803
Metropolis 1 0:31::16 0:31::16 0 803
Metropolis 2 0:12::22 0:12::23 1 804
Metropolis 3 0:32::38 0:32::38 0 804
Sky Chase 2:05::57 2:05::57 0 804
Wing Fortress 1:30::03 1:30::08 5 809
Death Egg 0:40::29 0:40::30 1 810
Total 11:24::53 11:38::23 810

General Information Relevant To The Submission

The following information is not new to speedruns of this game, rather, it is here for convenience.
  • The game has a hidden in-game timer that counts the frames. It does not increment during lag frames or while the game is paused.
  • When performing a jump, Sonic does not move for one frame so jumping is limited to when it is faster overall and this restriction does make a difference throughout the run.
  • On horizontal ground, Sonic will lose speed when rolling. While holding forward when running, Sonic will maintain speed. When traveling down slopes, Sonic accelerates faster while rolling than running. Transitioning from rolling to running is done by jumping or falling off the ground.
  • Bounce height can be controlled by holding either A, B, or C which will keep a higher vertical speed until it falls below 4 pixels per frame. Releasing any of those buttons will immediately set the vertical speed to 4 pixels per frame if it was above that value.
  • Sonic will lose horizontal speed if the vertical speed is upward and less than 4 pixels per frame. This is avoided when possible by jumping from slopes that give Sonic a downward vertical speed or by bumping a ceiling.
  • Spindash release speed is controlled by how many times the buttons A, B, or C are pressed and how long the spindash is held before being released. The first button press sets the held spindash speed at 8 pixels per frame. Subsequent button presses raise the speed by 1.5 pixels per frame and each frame the spindash is held lowers the speed by 1/32 of the held speed value. The range for spindash speed is bounded to a minimum 8 pixels per frame and a maximum of 12 pixels per frame and the release speed only occurs in increments of 1/2 pixel per frame. Thus, it takes 6 button presses to release a maximum speed spindash.
  • Sprite ejection occurs when Sonic is inside a sprite and is colliding with one of its four sides. This pushes Sonic out in the direction of the side that is being collided with. This is generally used to get inside terrain.
  • Zips occur when Sonic is inside solid terrain. The game ejects Sonic at speeds up to 32 pixels per frame in the opposite direction that Sonic is traveling. This is useful for performing a level wrap but is also good for just going fast.
  • Level wraps are an effective way to get to the end of a level quickly. The left edge of every level has an invisible wall that is 16 pixels wide. Sonic can pass through this boundary by having sufficient speed to avoid collision with this wall. This underflows the value for horizontal position and the game then caps the now large value to a position at the end of the level.
  • Camera speed is capped at 16 pixels per frame. Traveling faster than this will cause Sonic to get ahead of the camera. The horizontal position of the camera is important as it determines when sprites (such as the sign post) load and can be manipulated, such as spindashing before performing a level wrap, which moves the camera to the right and delays it from following Sonic to the left. Sonic generally does not interact with sprites that are out of view of the camera.

Resources

Game Resources has useful RAM addresses and additional information.

Lua HUD for Genesis Sonic games

Important Information Regarding Real Time

The platforms in Wing Fortress that retract and extend into and out of play are controlled by a power-on timer and limit when Sonic can pass through without losing time. With a movie file that did not waste time at any of the capsules, Sonic was 2 frames late to getting through with an earlier platform cycle. Rather than pausing there for 245 frames to catch the next cycle, the time delay was distributed to the capsule animals in Casino Night 2 and Oil Ocean 2.

Stage By Stage Comments

Introduction

This is not a stage but 1 real time frame was saved by pausing on the last frame the white text is visible with controller 2. This also causes the Title screen to load incorrectly. This frame saved was ultimately lost to the Chemical Plant 2 capsule animals in this movie as showing up one frame later would not make a difference at that point.

Emerald Hill 1

This level was improved by Aglar. The lower route achieves sufficient speed to stay on the ground when running up the quarter-pipe and then a roll on the first pixel in front of the monitor allows Sonic to go airborne, avoiding the rolling speed cap and maintaining speed. Going through the loops starting with maximum spindash speed (slower speed than the previous movie) made gaining as much speed as in the previous movie nearly impossible but Aglar managed to pull that off.

Emerald Hill 2

An off-screen speed boosting jump and the final jump gives Sonic enough hangtime to avoid the vertical camera limit allowing the capsule animals to be cleared off the bottom of the screen.

Chemical Plant 1

Tee-N-Tee found that it was possible to level wrap by spindashing down the sine wave slope and performing two jumps, 2 frames apart, which give Sonic enough speed to pass through the boundary at the start of the level.

Chemical Plant 2

1 frame was saved by picking out a better slope to jump from after the last booster which gives Sonic more speed. This required rolling 1 frame before jumping from a position that was a few pixels ahead of the position used in the prevoius movie. This particular jump was found in the Knuckles TAS.

Aquatic Ruin 2

1 lag frame was saved by altering the movement in the beginning of the level. Lining up the position to 3 subpixels off in both the horizontal and vertical coordinate at the start of the zip was close enough to proceed through the rest of the level with the same inputs.

Casino Night 2

Sonic clips into the same monitor that Knuckles uses to level wrap, via a different method. The first zip gets Sonic to the position of the monitor before it loads. Then a spindash causes Sonic to fall to a spot where a zip out of the wall is possible. Because Tails will despawn after being off-screen for 5 seconds and then respawns at specific time intervals, careful selection of when to start with the first despawn allowed Tails to be in the wall at the start of the boss fight. This was necessary to give Sonic a break.

Hill Top 1

The time save in this level came from implementing a strategy used in the first Knuckles TAS that maintains speed after the zip. The zip past the lava zone works as it does because a spindash before the zip causes a delay in the camera following Sonic, allowing Sonic to get far enough ahead that the giant wall sprite does not load until Sonic is past it.

Oil Ocean 2

Time was saved by maintaining speed during the vertical warp. Careful positioning allowed Sonic to jump under the pillars around the boss area, rather than jumping too high and being stopped by them. There is not much room to perform this as Sonic is right above the kill plane when making the jumps while also getting just enough horizontal progress to hit the bottom of the pillars, rather than the sides. This was used in the first Knuckles TAS.

Metropolis 2

1 frame was saved by jumping with Tails at a later position and with less jump height. 9 lag frames were saved by using a different maneuver when approaching the lava.

Wing Fortress

This run saved 5 frames by jumping later and with less jump height to trigger the ending. This works because it gets the camera to the required vertical position sooner by spending more time in the air while still ahead of the camera. The camera moves at 6 pixels per frame to catch up to Sonic when on the ground. The camera moves at 16 pixels per frame while catching up to Sonic in the air and then at the same rate when caught up, which is still faster than 6 pixels per frame.

Death Egg

1 frame was saved in the final boss battle. This was made possible by performing the jump for the second hit from a roll. This causes Sonic to land 5 pixels above the ground and this extra height was useful to get a faster falling speed after the third hit to land 1 frame earlier and proceed with the rest of the fight.

Real Time

Real time is minimized without sacrificing in-game time, but, outside of lag reduction, real time savings are limited by platforms in Wing Fortress which only allow Sonic to pass through when they are opened so that Sonic can land on them. While not losing in-game time, these are 10 frame windows that work followed by 246 frame windows where pausing or some other time delay is required.

Capsules And The Capsule Animals

Shortly after hitting a capsule top, 8 animals will spawn and a capsule timer starts counting down from 179 at a rate of 1 unit per frame until it reaches a value of 1. The timer does not increment on paused frames. On the next frame, the timer changes to 180 which is when the game checks for the presence of animals. When this check sees zero animals, the value changes to 0 and the game proceeds to bringing in the bonus tallies.

When an animal spawns, it starts counting down a timer which triggers the animal to jump. The 8 initial animals have unique timers that range from 98 to 154 in increments of 8. All future animals start with a timer of 12.

Animals will only spawn when the lowest 3 bits of the power-on timer are 0. If the game is paused on this frame, the animal will not spawn. If an animal spawn occurs the frame before the capsule timer changes to 180, the newly spawned animal will be present for the first frame of the check for animals and will unload the next frame. This event will delay the bonus tally one frame and has a 1 in 8 chance of occurring.

The primary method of saving time here is by deleting animal spawns for those animals that would remain on screen longer than the initial set of animals. The game loads several animals that jump later than the initial animals are usually deleted unless they jumped to the right and left the screen early enough to not delay scrolling the screen to clear the animals that jumped to the left. In levels where the camera could not be scrolled upward, the capsule is generally too far to the left to manipulate animals to jump right, although this is still sometimes faster when manipulating the later animals to jump and is usually combined with deleting animal spawns.

The capsule animals can be manipulated before breaking the capsule by advancing the RNG seed that controls the animals type and horizontal travel speed before breaking the capsule. This occurs by destroying badniks (spawns an animal), deleting or adding boss explosions (explosions spawn on the same frames that animals spawn), and allowing bubbles to spawn in Aquatic Ruin. The boss explosions also use a timer that starts at 179, similar to the capsule timer, and does not increment on paused frames. Because he boss explosion timer does not start on a multiple of 8, two identical runs of a level with different power-on timer values may end with a different RNG seed. The direction they jump can also be manipulated. The direction is determined when they land by bit 4 in the power-on timer which changes every 16 frames.

Objects are dynamically loaded, so the location of useful RAM addresses change between the levels. These objects will load at addresses from $B400 up to $CFC0 and occupy $40 bytes. The object with the capsule timer can be identified by finding the object with the byte offset $00 set to $3E and the byte offset $25 set to $02. The timer can be found at the byte offset $1F. Capsule animal jump timers are located at bytes offset $37. The other addresses used were the long at $F636 (RNG seed) and the byte at $FE0F (Power-on timer, partial)

Due to in-game time being prioritized over real time and the way capsule animals work, comparing time spent during the capsule animal release may not always be a fair comparison of optimization during those parts.

Time Bonus

Finishing a level in less than 30 seconds yields a time bonus of 50000. Finishing a level from 30 to 44 seconds yields a time bonus of 10000. Bonus values increment at a rate of 100 points per frame. This makes finishing a level in 0:29::59 399 frames slower than 0:30::00. The next fastest time would finish the level in 0:23::19 and is the primary reason why speedruns of this game aim for fastest in-game time.

No other instances were relevant in this run but this happens at every transition to a lower time bonus. If the ring bonus is larger than the time bonus, then that becomes the limiting factor for fastest real time.

Lag

Lag is minimized, usually with seemingly random changes in movement.

Suggested screen shot: 8941


Mothrayas: Accepting as an improvement to the published movie.

feos: Pub.


Similar submissions (by title and categories where applicable):