Sonic Chaos was released for the Sega Master System in 1993. In this game sonic gains 2 new abilities: spindash and peelout. This makes the pace of Sonic Chaos much faster compared to the previous 2 games for Master System.

Game objectives

Emulator used: Bizhawk 2.2.1

Beat the game with best ending by getting all of the emeralds

Goal Choice

This TAS is an improvement of 1981 frames (33.017 seconds) over #2605: mike89's SMS Sonic Chaos in 14:28.55. Note that the improvement only appears to be 1375 frames but current TASes require the BIOS which adds another 606 frames. The goal of this TAS is to beat the game with the best ending, which requires collecting 5 emeralds throughout the game, causing a 6th emerald to drop after the final boss.

I started working on this TAS to contribute to the Dega Project: http://tasvideos.org/forum/viewtopic.php?t=19272 which aims to remake the SMS runs that use the Dega emulator with Bizhawk instead. When redoing runs for this project I prefer to start from scratch and search for any possible improvements. The main timesave is from lag reduction but there are a few seconds of timesave from other tricks, techniques and routing. Mike’s run was extremely well optimized considering the strategies known at the time and the tools available at the time (lag reduction is extremely difficult without TASstudio).

Timing

As with many Sonic games there are some theoretical situations where it’s faster overall to delay finishing the level in order to reduce a lengthy time bonus countdown. I avoid slowing down on purpose for this, but it is extremely uncommon and only happens at the end of some special stages where the tradeoff would save less than 20 frames. So optimizing purely for real time would only cause a difference of around a second from this TAS.

There is a speed bonus at the end of the level which is given in km/h and is between 000km/h and 999km/h. The hundreds digit of this counter is determined by your ingame time, if it’s less than 30 seconds the hundreds digit will be 9 and if it’s 30 or more the hundreds digit will be 8 and so on. Strangely the last 2 digits are determined by ring count. The formula for the last 2 digits is (rings+89)%100. So if I finish in under 30 seconds and have 0 rings the speed bonus will read 989, but if I get 11 rings it will read 900. Ticking down 100 units of speed bonus takes roughly 20 frames, so when it is less than roughly 20 frames out of my way, I try to get 11 rings in a level. I only ever had to slow down 2 or 3 frames to achieve this.

In Game Timer

The timer uses 3 bytes: minutes, seconds and frames. The minutes and seconds are reset when you finish a level but the frames carry over. This makes in game time a particularly bad metric for measuring speed through a level.

Another thing is that the in game time ticks up during lag even though sonic doesn’t move during lag. This means that lag reduction is quite important if you’re trying to get a good ingame time. When playing this game on PAL is runs at 83% the speed of NTSC which makes it much slower for the TAS. However, due to this speed decrease PAL is less laggy, so that causes the in game times on PAL to be faster than NTSC. This is the reason that sometimes tool assisted runs don’t beat the times on the sonic center http://www.soniccenter.org/rankings/sonic_chaos/times (also the subseconds carrying over is another reason).

Note that the PAL timer still ticks up a second after 60 frames even though it runs at 50 frames per second, making a second ingame on PAL actually 1.2 seconds in real life. But this perfectly cancels out the slower movement. As far as I can tell it’s the reduced lag that makes PAL so much faster for ingame times.

Special Stages and “Best Ending” vs “Bad Ending”

Best ending can be viewed like “100%” and bad ending can be viewed like “any%” this run gets best ending. Collecting 100 rings in a stage sends you to a special stage where you can collect an emerald. To get best ending I need all 5 emeralds before beating the final boss. Interestingly in any% there are some levels where it’s faster to enter a special stage and fail it by dying which sends you to the next level. For simplicity I’ll call this special stage abuse. Special stage abuse is sometimes faster mainly because finishing a level normally gives a very long signpost spin and score screen. There are 6 levels where special stage abuse is faster than finishing the level normally: 1-1, 2-1, 3-2, 5-1, 5-2, 6-1. So routing in 5 emeralds for best ending was just a matter of replacing 5 of these failures with successfully getting the emerald. Note I still fail 1 of the 6 special stages. This special stage failure strategy is yet another reason why in game time is a terrible measure of speed for this run.

There’s another glitch called special stage skip which is used in conjunction with special stage abuse. If you get 100 rings to enter a special stage the frame before the in game time ticks up a second, it causes the special stage to fail as soon as it loads. This is about 44 frames faster than manually failing a special stage (manually failing is only possible in the first special stage which happens if you have no emeralds). This glitch is a huge inconvenience since the subseconds carry over between levels, essentially causing a huge global frame rule of 60 frames if I want to do a special stage abuse. However there’s a third glitch which eliminates this frame rule.

If you pause and unpause you can start the game time running again after you hit an end of level signpost. Using this in the level before a special stage I can line up the exact subseconds to hit the 100 rings on exactly the right frame without having to lose time by waiting for the right in game time. The only time lost is the 2 frames to pause and unpause. This is much easier said than done since the in game time ticks up during lag and there is a lot of lag and it’s very inconsistent. Levels can vary by roughly 10 frames even if they are both perfectly optimized for lag reduction, just depending on seemingly negligible factors like the in game time and what frame you started the level. This means that to pull off an optimal special stage skip I might have to completely redo the level several times, possibly even more than 10 times! This makes a best ending TAS so much easier to optimize than a bad ending TAS since there are 5 less special stage skips in best ending.

Since the community is much more focused on “beat the game” (bad ending) I’ve also made a TAS demonstration of this category which is essentially an edited video of this 100% TAS. I don’t have a button file for this since it’s video of several different segments edited together. A video can be found here: https://youtu.be/snMpXdE17B8

Useful RAM addresses

X Position (3 bytes)

1512, 1511, 1510

Y Position (3 bytes)

1515, 1514, 1513

X Velocity (2 bytes)

1517, 1516

Y Velocity (2 bytes)

1519, 1518

IGT Seconds

12BF

IGT Frames

12C2

Rings

129A

Boss HP

1726

Boss iframe stuff

171F, 1734

General Movement

This game adds 2 new forms of movement: spindash (down+ 1/2) and peelout (up+1/2). Both require you to be standing with 0 velocity beforehand. Unlike the Megadrive Sonic games, you don’t need to charge up spindash since it always sends you to your facing direction at 7 velocity (same for peelout). Note that walking speed is 4. This means that the optimal spindash/peelout is pressing down/up for one frame then 2 (or 1) for one frame and hold right (or left). Peelout is preferred over spindash gradually slows down due to rolling.

After a spindash or peelout if you jump you will move through the air at a maximum of 7 speed. Once you land from the jump you will hit the walking cap of 4 speed again, here you have 2 options. The first option is to slow down to a stop then peelout again. The other option is to enter a roll when you hit the ground then jump out of it. When jumping through the air out of a roll, the speedcap is 6 (normally from walking it’s 4). You still have to accelerate from 4 to 6 but rolling then jumping is often much better than stopping again to do a peelout. If there is a long uninterrupted section of ground, it’s often worth stopping and doing a peelout rather than constantly roll jumping.

Another form of movement is the rocket boots which can be found inside boxes in some levels. The speedcap for these is 7 but you need to accelerate from 0 to 7 when you grab them. These run out after a certain amount of time and I haven’t been able to find a way to get rid of the boots before this apart from taking damage which is slow. Whether or not these are faster depends stongly on the situation and also lag.

Tricks and Techniques

Corner Clipping

Unfortuntely this didn’t find a use in the TAS except for a similar glitch done in the first level.

Air Dash

To do this glitch you need to be in a rolling state while airborne (achieved here by bouncing off a ring box out of a roll). Then if you turn around, when sonic hits 0 velocity he will exit the rolling animation in the air. This allows you to duck (this duck can be buffered) and then spindash out of it. You dont lose height while charging the spindash but you do lose height when ducking. I've tried jumping out of this but it didn't work. Also I cant seem to peelout with this technique either. This trick only had one use in the run which was to get the ring boxes faster in Electric Egg 1. A video of this glitch can be found here: https://youtu.be/9WrsB0T_f3A

Optimal Level ending

When you finish a level the signpost spins then the screen unlocks. Sonic needs to run off the screen to the right to have the screen fade to the totals screen. You should peelout off the right side of the screen and be about to hit the edge the frame it unlocks, so you are right as soon as possible. Also it’s important to line up the pixels and subpixels so you are rightmost without bonking the edge, since the peelout only hits very far apart position values.

Boss running skip

After beating a boss sonic runs to the right for a short time before the screen fades out to the totals screen. By positioning yourself on the right spot with the right speed you can skip this run to the right, saving a lot of time. Essentially you should be at the right of the screen moving to the right just as the screen unlocks. If you’re at the speed of a peelout or spindash this won’t work. The original method is to jump into the right of the screen. But I found a new method which is to peelout into the right side of the screen but press left just before hitting the edge, then press right again. My speed goes from 0700 to 06F0 and the next frame it would be 0400 (the required speed for the glitch) but as long as the next frame will be 0400, the glitch triggers. This means I can squeeze some extra speed out of the last few frames rather than being at 0400 the whole time.

Lag Reduction

Lag reduction is possibly the biggest factor in optimizing this game. This game lags so much and so unpredictably that you essentially need to brute force the movement to optimize the lag. Whenever I have to make a jump I try every possible frame to start the jump and every possible length of holding the jump. Furthermore, sometimes strategies that should be slower actually end up being faster because of lag. For example, in some levels if I wait to peelout until the frame after the first possible frame, I might save 2 or more frames of lag, which gives an overall faster time.

Another intense area of lag reduction is with the rocket boots. This is the hardest lag reduction to do because there are so many options. You don’t need to hold right with rocket boots but if you do then it can cause different lag. You also have the option of up and down to affect lag.

Individual Level Comments

Turquoise Hill 1

This level is just faster with a special stage abuse, thanks to the clip at the start. To do the clip at the start, I position my subpixels and peelout. There’s a method to get this RTA which involves a jump, but this is slower. The clip also causes some graphical glitches. What happens during the clip is I hit the bottom of the floating platform and zip up to the top of it where the boots are. The rest of this level is careful ring routing to make sure I have 100 for the special stage. I opt to complete the special stage since there isn’t a level before this to set up the subseconds for a skip. In a bad ending TAS you would wait out the subseconds to do the skip.

Special Stage 1

Once you break the box there’s nothing you can do to make sonic go any faster so this stage comes down entirely to lag reduction.

Turquoise Hill 2

This is the only level with speed shoes, which are pretty much unavoidable. This just makes all of your movement speed caps 6, so with speed shoes your peelout is actually slower! The good part of this is I don’t have to roll before doing a jump or worry about stopping to do peelouts.

At the end of this level I have the option to get the rocket boots or to complete the level normally. This decision actually comes down to lag. Sometimes it’s faster to grab the boots and sometimes it’s not, but most of the time the boots are worth it. In this run of the level getting the rocket boots was 8 frames faster than no boots. I’ve had another run where rocket boots were 1 frame faster and a run where they were 1 frame slower.

Turquoise Hill 3

I want to hit the spring at the start as soon as possible. Once I hit it I do some precise movement left and right to load the spikes on the exact frame I want. The frame I want causes the spikes to be up for long enough that I can hit the side to stop my movement for a peelout, but then the spikes go down the frame after so I can peelout right away.

The boss has a different strategy from the published run. Instead of hitting it once before getting to the right of it, I do all the hits from the right which is faster. By carefully adjusting subpixels to get as right as possible, I can get to the right quite early.

Gigalopolis 1

I found a new route for this level which takes the lower path rather than the upper path, saving significant time. This level is mainly jumping then using walls to stop movement then using peelouts. When jumping out of a tunnel you can jump so early that a one frame jump would hit the roof and fall back down, but if you hold the jump you stick to the roof and then gain more height once you leave the tunnel. This is used to jump over some springs without getting too much height just before entering the lower path.

Gigalopolis 2

Special stage abuse is quicker in this level. I tweak some ring routing over the published run in order to fall down to the last ring boxes earlier. If I had finished the level 1 frame earlier I would have gotten the special stage skip glitch, which would have been a lot easier than trying to line up a pause glitch at the end of another level. Unfortunately there were no more frames to save here so I have to do a pause glitch later in the TAS instead.

Gigalopolis 3

I take a different route in this level than the published run. Instead of going through the loop I sacrifice some time at the start of the level to get a peelout which lets me go over the loop. This route is also used in the latest RTA runs.

Shortly before the boss spawns, the camera scrolls up. But I found that by jumping at this time, I make the camera scroll up quicker and the boss spawns 61 frames earlier! Unfortunately this does mean that I’m not on the ground to hit him as soon as he spawn which loses 9 frames. So the glitch saved 52 frames overall.

The boss fighting strategy involves a lot of getting bounced down rather than up. This is extremely precise but it is a crucial part of landing the hit as soon as possible. If you bounce up instead then by the time you bounce again, the boss is still invincible from the last hit so you can’t hit him again. Due to the bouncing ball at the end I bounce up instead of down but I bounce off of specific collision so I can land the last hit quickly.

Sleeping Egg 1

This level has 2 distinct paths: down and up. On the surface it seems like up would be quicker but when both have optimized lag reduction, down is faster.

Sleeping Egg 2

This level is much faster when using a special stage abuse. When breaking the last ring boxes in the level I monitor my speed carefully off the ramp so that I don’t get too much height. If I had too much height I would have to wait to break the ring boxes.

Special Stage 3

I found a new strategy where you can avoid bouncing off the invincibility boxes with some precise positioning. This saves time since I can enter the pipes quicker but it does sacrifice some time since it takes longer to turn around. It’s faster than bouncing overall.

Sleeping Egg 3

This level has some of my favorite tech in the run. Some slopes have the potential to completely stop your movement, but then make you walk back at a small speed so you can’t get a peelout from it. But the 45 degree slopes in this level stop your movement but aren’t so steep that you slide down them. This means I can jump into a 45 degree slope then instantly start a peelout upon landing if my position is precise enough.

I start the boss by bouncing on him. While I would rather bounce between him and the right wall, if I do this then he jumps up off screen which costs a lot of time. I go between him and the edge of the screen at the end when I can get all the hits in before he jumps up.

There are some points of the bosses pattern where dealing the last hit will skip the explosion animation and instantly start the running to the right to finish the level. It was previously thought that the only time to do this was after a big bounce off the screen, but I managed to find a time to do this without the big bounce. It was also thought that the explosion skip and running off the right side of the screen were mutually exclusive. However, you can get a frame perfect jump after explosion skip which gives you enough time to line up for the running to the right skip. I also once managed to get the running to the right skip off the bounce to the ground from the last hit of the boss (skipping the jump after the last hit) but to achieve this I had to use the method with the big bounce off the screen from the boss which is slower.

Mecha Green Hill 1

This is a straightforward level. I make sure to space my movement so that I get 11 rings for the reduced speed bonus.

Mecha Green Hill 2

At the end of this level I jump over the box rather than going under. Going up causes a slight bonk on the box but it’s significantly faster than going down due to lag.

I pause and unpause just before the level fades out to do the in game time glitch which sets up the special stage skip glitch for Aqua Planet 1.

Mecha Green Hill 3

This level has lots of rolling and jumping on those sloped ground bits. If you come to a stop you fall through so roll jumping is the fastest movement.

For the boss it doesn’t matter how quickly I get the first hit since it’s on a fixed cycle of rising and falling and being vulnerable so I chose the solution which allows me to hit the last hit as soon as possible while causing the least amount of lag. Due to the layout of the boss arena I wasn’t able to perform the running to the right skip.

Aqua Planet 1

This is the level where I do the one special stage skip in this run. Due to the previous level being a boss I had to go all the way back to Mecha Green Hill 3 to do the pause glitch to setup this skip. The skip was definitely the most routing intense part of the run and it required several redos of Mecha Green Hill 3 and Aqua Planet 1 due to lag differences.

Special Stage 4

I could have used 1 more pair of rocket boots but due to the spacing with the boxes it’s slightly faster to skip the pair that I did and go on foot.

Aqua Planet 3

At the start of the level I break the ring box then jump up to the spring above. This is exactly as fast as using the lower spring to get to the upper spring but with the bonus of reducing the last 2 digits of the speed bonus in the totals screen.

I take the upper path with the invincibility box rather than dropping through the breakable ground. This saves a lot of time.

I attempted to do a corner clip to speed up the section leading to the boss, but the corner clip didn’t work. Furthermore some of the tiles inside the wall aren’t solid so if I could get a corner clip into the wall I’d be stuck inside rather than zipped up to the top.

The goal with the boss in this level is to get it to pin me against the left wall so I can keep bouncing and dealing damage on the soonest possible frame after his invincibility period. During this it’s also possible to manipulate hit bounces so that he doesn’t bounce away while you’re landing hits.

I had some cool playaround during the missile phase where I could stay off the top of the screen and keep bouncing on the boss, but due to lag this was much slower so I stayed on the ground instead.

Electric Egg 1

This level is much faster when using a special stage abuse. The main difficulty in this level is the ring boxes on the pipe near where I get the 100th ring. The pipe is not solid so these ring boxes are essentially in the air.

Simply bouncing on the boxes one by one is not too slow but I found a method to speed it up even further. I end up in the walking animation before hitting the first box so I land on that box and roll off it causing a bounce. This is very similar to a normal bounce but with the crucial difference that I’m in the rolling state rather than the jumping state. If you’re in the rolling state you will have some velocity. But if you pull back and get this velocity to 0, sonic exits the rolling state. This has 2 effects. The first is that if you were moving upwards, you will instantly be moving downwards with a little bit of speed. This makes the bounces much lower and faster. The second effect is that you can spindash out of this in the air by holding down when sonic exits the rolling animation then pressing the jump button once ducking. Without this glitch you can break the last ring box without a bounce up but with a spindash you can break the last 2 without a bounce up, which saves a lot of time.

Electric Egg 2

There are many potential routes for this level but the one used in this TAS is fastest by far. The main technical part of this level is deciding when to roll jump and when to peelout. There is a long section for which a peelout would be perfect but there are enemies on the path. When doing a peelout you get a slight period of invincibility at the start. Using this, I stop shortly before the last enemy then use the invincibility to get through it and take the peelout all the way to the pipe.

Electric Egg 3

Getting to the boss is fairly simple. The upper path is much faster than the lower path. I tried to get a clip into one of the corners here but there was no place where this was useful. Instead I jump off the slope rather than the platform to get into the pipe in the ceiling.

The first phase of the boss is quite simple, but I just make sure to manipulate him to not duck in places where ducking would have been bad.

The second phase is a single hit, but once you deal the last hit to Ivo, he has to fly off the right side of the screen before the screen unlocks to finish the level. In general it’s better to hit Ivo once he gets to the right side of the screen because his movement to the right in the fight is much faster than his movement to the right after you’ve beaten him. If you hit him on the last possible frame then you’re still in the air when the screen unlocks which is not good. Instead I hit him so that the screen unlocks exactly the frame after I land so that I peelout exactly as the screen unlocks. This is only a few frames earlier than the rightmost frame you can hit him.

Before ending input I have to reach the spot where the emerald will drop. I can simply spindash to the right when the screen unlocks which would allow me to not press anything after the spindash input (because the velocity is lost extremely slowly while in a roll). But unfortunately spindashing causes me to overshoot the spot where the emerald lands. I had many ideas such as: peelout and let go of right at some point, peelout into a jump (with no right), spindash and brake, spindash and jump, peelout jump and roll, and so on. But the fastest method was to peelout then break (to get to 4 velocity) them roll so I can retain speed for more time. I have to brake before the roll because you can’t roll out of a peelout.

Thanks

Thanks to mike89 for making the current TAS which was a great reference throughout the entire making of this TAS. There were some strategies in that TAS which really helped to bring the time down for this game.

Thanks to icy who was extremely helpful and encouraging with this. Also for providing a really good timing comparison spreadsheet for this game of all known TASes, telling me about the special stage abuse strategy and some other useful strategies, making a bad ending TAS which had a lot of really useful strategies to learn from and having RTA world record which was a great reference for making this.

Thanks to Sonikkustar too for making some TASes of this game, which helped with the making of Mike’s TAS and this TAS. Also thanks to Sonikkustar for finding running to the right skip in boss stages.

Thanks to the Sonic Chaos speedrunning community (both full game and individual level) for continuing to push this game to the limit.