don't click here

Sonic CD Quirks/Deconstruction

Discussion in 'Engineering & Reverse Engineering' started by Devon, Jul 11, 2022.

  1. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    So, I took a dive into the Nemesis compressed graphics/objects in the stage files, and came across some stuff.

    Collision Chaos

    [​IMG]

    This is a teleporter. It can be found in the 510 prototype, albeit with broken mappings. 3 of these will circle around, and when Sonic enters one, he gets teleported to another one within the circle.

    [​IMG]

    Tidal Tempest

    [​IMG] [​IMG]

    First, some unused platforms. Interestingly, despite the fact it doesn't seem to fit, the one on the left came from the past. The others come from the future.

    [​IMG]
    [​IMG]

    This is some kind of electric beam? The code for it can be found in the 510 and v0.51 prototypes. Only the v0.51 prototype has working collision detection, where touching it makes it stop. The code was removed by the 712 prototype.

    [​IMG]

    I wonder if these unused sprites are related... they are also found in Tidal Tempest's sprite data...

    [​IMG]

    Stardust Speedway

    [​IMG]
    [​IMG]

    So, as you may know, in earlier prototypes, Stardust Speedway didn't have searchlights. They instead used horizontal interrupts to move a lit up section up and down. These sprites were gonna be placed at the edges of the lit up section. As is, it would've looked something like:

    [​IMG] [​IMG]

    [​IMG]

    This is a duplicate set of those mesh tiles that would've been placed as objects.

    Metallic Madness

    [​IMG]

    This is a trap door. This was actually used in later prototypes, but got scrapped in the final.

    [​IMG]
     
    • Like Like x 8
    • Informative Informative x 5
    • List
  2. Black Squirrel

    Black Squirrel

    sometimes the real thing™ Wiki Sysop
    9,118
    2,989
    93
    Northumberland, UK
    not making new christmas avatars
    I was going to suggest it was maybe for the boss, to block Sonic from the later section. But if you're finding it in the present version, guess not.
     
  3. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    Also the fact that it was programmed to deactivate when you touch it, and also included a variant for the past alongside the present and futures as well.
     
    Last edited: Jan 28, 2023
  4. JayKuriN

    JayKuriN

    Defeated Dreamer Member
    No, this is exactly what I was talking about! I suppose I expected the objects to not be so haphazard at this point. (which, lol, it's Sonic CD what was I expecting?)

    After going back through an old backup of my disassembly and actually mostly finishing it, I can safely say there's basically nothing in R11B that's different from R11A program-wise.

    My apologies for the confusion!

    I guess since I'm here I'll add some tidbits of potential substance (yum) for anyone else reading:
    I have posted some of this in Hidden Palace's Discord before, so it may be a reiteration of information that's been spreading elsewhere.

    I believe I said it before in the R2 discussion thread, but the IPX file, which is responsible for keeping track of player progress in the final game, could fit into the initial program on the CD due to just how simple it really is. It literally calls R1 and that is it. After executing all the relevant R1 MMDs, it is hardcoded to load the Comin' Soon screen. Prior to this specific build of the game (0.02), it appeared to have just run the level select after the title (if even that):

    upload_2023-1-30_10-12-4.png

    The Time Attack screen in 0.02 is so haphazardly built and awful, it seems to be directly built off of the SEGA SCREEN PROGRAM. It even still has some of the Megadrive initialization routines left over. It also appears to actually have started work on BuRAM support too, since the SubCPU portion of the program has some strings for setting all of that up(?) I'll probably amend this post with additional information later.
     
    • Informative Informative x 3
    • List
  5. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    Well, of course, it still does handle going into the Time Attack mode. After the MMD file is run and exits out, the return code is the stage ID, and is used in a table that only has 2 entries, which are the Sub CPU command IDs for loading act 1 and act 2 of Salad Plain/Palmtree Panic. This does mean that any claim that there are "lost levels" that can be accessed by accessing the other selections in the menu are untrue. The zone ID will get set, but whatever command is sent is trash data, since it's out of bounds of the actual defined array.

    The reason why glass bumpers even work by doing that is because of the fact the zone ID is set to Collision Chaos. There IS leftover code for handling them (and the bumpers), and will be activated when the zone ID is set accordingly. Other than that, the file loaded is still one of the R1 files, due to sheer coincidence.

    Here's a disassembly of the time attack code in IPX for reference:
    Code (Text):
    1. ROM:00FF0154 ; =============== S U B R O U T I N E =======================================
    2. ROM:00FF0154
    3. ROM:00FF0154
    4. ROM:00FF0154 TimeAttack:
    5. ROM:00FF0154                 moveq   #$D,d0                      ; Run menu
    6. ROM:00FF0156                 bsr.w   RunMMD
    7. ROM:00FF015A                 move.w  d0,($FF0594).l              ; Save selection ID
    8. ROM:00FF0160                 beq.w   GameLoop                    ; If exiting, branch
    9. ROM:00FF0164                 add.w   d0,d0                       ; Get stage load command ID
    10. ROM:00FF0166                 move.w  .FileLoadIDs-2(pc,d0.w),d0
    11. ROM:00FF016A                 move.b  #1,($FF0580).l              ; Set time attack flag
    12. ROM:00FF0172                 bsr.w   RunMMD                      ; Run stage
    13. ROM:00FF0176                 move.l  ($FF1222).l,($FF0590).l     ; Get resulting time
    14. ROM:00FF0180                 bra.s   TimeAttack                  ; Loop
    15. ROM:00FF0180 ; ---------------------------------------------------------------------------
    16. ROM:00FF0182 .FileLoadIDs:
    17. ROM:00FF0182                 dc.w 1                              ; R11A
    18. ROM:00FF0184                 dc.w 7                              ; R12A
    19. ROM:00FF0186
    20. ROM:00FF0186 ; =============== S U B R O U T I N E =======================================
    21. ROM:00FF0186
    22. ROM:00FF0186
    23. ROM:00FF0186 RunMMD:
    24. ROM:00FF0186                 move.l  a0,-(sp)
    I took a look into it myself, and the Sub CPU program side of the Time Attack menu is basically mostly just a basic command handler for CD specific tasks, like managing Backup RAM. At the start of the Sub CPU program, it initializes Backup RAM management and attempts a read. If the read fails, Backup RAM is reset, with the data being the default Time Attack times (5 minutes for every stage).

    Backup RAM data is managed at the start of Word RAM and 2 of the commands you can send are to read from Backup RAM into Word RAM, and write from Word RAM into Backup RAM. The only other command is to fade out the music. The Main CPU program side actually tells the Sub CPU to run these commands. The times you achieve in Time Attack mode are indeed saved into Backup RAM.
     
    Last edited: Jan 31, 2023
    • Informative Informative x 4
    • List
  6. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    So, in most of the stage files, there are 2 unused sets of stage layout data. They are layouts for Green Hill Act 2 and 3 from Sonic 1.

    What I think happened is that each stage started off with all 3 acts of Green Hill in the stage layout data, and just replaced act 1 with the proper stage layout. The loading routine always loads the first entry, hence why act 1 is missing. These leftovers date as far back as v0.02!

    The only exception is R11A, which had a few optimizations not applied to the rest of the stage files, which included removing those leftover layouts.
     
    Last edited: Feb 2, 2023
    • Informative Informative x 5
    • Like Like x 4
    • List
  7. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    In between v0.02 and 510, before the background was changed to the final one, the palette was slightly altered to make the sky a little less saturated. This palette data can be found leftover in the final game.

    (Left = v0.02, Right = Alteration before 510)
    [​IMG] [​IMG]
     
    • Like Like x 6
    • Informative Informative x 4
    • List
  8. This makes me question why they didn’t just put all the Round Data in single files if they had the room for extra zone layouts. Could’ve had 28 stage files, each containing the three zones of the round’s time period, and yet the final has 70 stage files instead…
     
  9. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    Because the chunk data wasn't consistent between acts and time zones. Of course, with some work, they probably could have combined them all, but they didn't...

    Anyways, new quirk. Explosions and flowers are flipped depending on the direction of the badnik in the original version of Sonic CD.
    [​IMG]
    [​IMG]

    This is because the way the explosion and flower are spawned are by sequentially changing their object ID and resetting their routine ID back to the initialization one. However, during re-initialization, it fails to reset the flip flags, and that's why it does that.
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    Usually, using OR to combine bits with previously set ones are used by stage objects placed in the stage layout to retain settings set by the layout data. They probably just copied that line without much thought into the explosion and flower objects.

    This does not happen in the 2011 remake.
     
    • Like Like x 7
    • Informative Informative x 1
    • List
  10. PimpUigi

    PimpUigi

    ------- Route Magician ------- Sonic CD Technician Banned
    The hitboxes are very different in the Psycho-Egg boss in CD11 compared to CD93.
    Robotnik's center hitbox is large enough to hit him without getting damaged by the wings, allowing the player to even hit him twice by the time he rises back up to the ceiling:
    [​IMG]

    In a minor tradeoff, when Robotnik goes to do his Wing Throw attack, he is no longer able to be hit in CD11:
    [​IMG]

    After Robotnik throws his wings, they retain the same hitbox that they have when attached to the Psycho-Egg:
    [​IMG]
     
    • Like Like x 2
    • Informative Informative x 1
    • List
  11. PimpUigi

    PimpUigi

    ------- Route Magician ------- Sonic CD Technician Banned
    When the wings are flashing, they don't have a hitbox that will damage Sonic, but the moment they stop flashing, that hitbox returns for one frame:

    [​IMG]
     
  12. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    Here are examples of the original hitboxes here:
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    Videos:

     
    Last edited: Feb 8, 2023
    • Like Like x 8
    • Informative Informative x 1
    • List
  13. PimpUigi

    PimpUigi

    ------- Route Magician ------- Sonic CD Technician Banned
    Holy crap! No wonder it was so hard for me to replicate the same behaviors. What a difference!
     
  14. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    There are some invisible blocks placed in Metallic Madness.
    [​IMG] [​IMG]

    They don't exist in the 2011 remake.
    [​IMG] [​IMG]
     
    • Informative Informative x 7
    • Like Like x 3
    • List
  15. muteKi

    muteKi

    Fuck it Member
    7,898
    147
    43
    So that's how they fudged the collision in that section! It all makes sense now, I suppose
     
  16. Bobblen

    Bobblen

    Member
    441
    222
    43
    I did find it quite annoying having to do that area 'properly' in the remake :-P (IE time the crusher instead of just landing on the tiny edge whilst the crusher is down, then waiting for it to rise up)
     
  17. Blue Spikeball

    Blue Spikeball

    Member
    2,535
    1,072
    93
    Huh. I always thought it felt janky how you could stand on that area's edge even when you shouldn't be able to. You're telling me it was intentional?
     
  18. Devon

    Devon

    La mer va embrassé moi et délivré moi lakay. Tech Member
    1,423
    1,740
    93
    your mom
    Considering the placement of those invisible blocks, yes I am.
     
  19. PimpUigi

    PimpUigi

    ------- Route Magician ------- Sonic CD Technician Banned
    I really always felt that was intentional in CD93 and I was surprised when it was gone in CD11. I always considered it CD11 jank.
     
  20. Mookey

    Mookey

    Member
    165
    98
    28
    I don't get it: Wouldn't it have made more sense to just move the crusher further right? Or is the extra collision block just there to help the crusher crush?