Sonic 3 A.I.R. (Angel Island Revisited)

Discussion in 'Showroom' started by Eukaryot, Oct 14, 2018.

  1. Eukaryot

    Eukaryot Newcomer Trialist

    Joined:
    Oct 10, 2018
    Messages:
    4
    Hey folks!
    I just thought I‘d take a chance, register here in the forums and present the project I‘ve been working on for the last two years.
    It's not a ROM hack, but a standalone port of Sonic 3 & Knuckles.

    You might know it already from the SFGHQ forum, or an earlier version submitted for SAGE 2018. But I felt like a showcase thread was missing here, where I can go more into details about the technical stuff.

    [​IMG]

    Sonic 3 – Angel Island Revisited (Sonic 3 A.I.R.)

    A straightforward port of Sonic 3 & Knuckles for PC, with some fixes, improvements, and widescreen support (at 400x224 pixels).


    About the project

    The main goal here is to provide a very accurate, but slightly modernized version of S3&K. Trying to stay very close to the original, but also adding new features and a few gameplay tweaks to iron out some of the small annoyances of the game.

    In addition, this is also a playground for adding some more experimental features, like an unlockable Knuckles & Tails mode and a Time Attack that allows you to race against multiple ghost versions of your previous runs.

    [​IMG] [​IMG] [​IMG]


    Technical background

    The game runs on a direct port of the original game code to a custom script. No emulator involved here, it can only execute what was ported to script already.

    The script language is quite simple, and was designed specifically for the purpose of resembling 68K functionality (registers, memory access, etc.) in a more high-level language way. This is a necessity, as I‘m quite bad at working with disassembly. :(

    An additional aim for the script language was to allow for automatic conversion of 68K code to script, so that I‘m having a basis to start from when porting over stuff.

    Here‘s an example:
    [​IMG]

    On the left, the disassembly (this is from the Sonic Retro Github), here a small piece of code from the Blue Spheres special stage.

    The center image shows the same piece of code in script, after automatic conversion of the 68K machine code from the ROM. Variable and function names have been replaced here already, taking into account all definitions added manually in script before.

    And on the right side, the end result with some manual refinements and commenting.

    The manual rework usually includes only few changes to make the code work and do the same thing as in the original game. Except when VDP commands are involved, these have to be manually translated into custom rendering commands.

    And of course, the obvious downside of this approach: Manual changes whenever a functionality does not work with widescreen out-of-the-box – this includes things like changing object positions, screen border limits, or taking care of empty spaces / visual garbage that would not get visible in the original 320x224 resolution.


    Requirements & Download

    Sonic 3 A.I.R. still uses the Sonic 3 & Knuckles ROM just as the original game code (inside the ROM…) does, so that exact ROM is required to play A.I.R. - in this case the ROM that is part of the Sonic 3 & Knuckles Steam release, or a S3&K ROM that is fully compatible to it.
    If you have the Steam version, A.I.R. should automatically find the ROM on first startup.

    Download of latest version:
    http://85.214.142.96/sonic3air_demo.zip

    I‘d also recommend the remastered music done by GalacticG, more info here on SFGHQ:
    https://www.sonicfangameshq.com/forums/threads/sonic-3-a-i-r.221/page-4#post-2530
     
    Last edited: Oct 14, 2018
  2. Natsumi

    Natsumi Markey's Member

    Joined:
    Oct 7, 2011
    Messages:
    645
    Location:
    Otter's lap
    This is very fascinating stuff, and I congratulate for taking the time to work this out. I have yet to try this out (specifically because SHC is taking most of my free time - and since I am making a S3K hack, I do not want more S3K in my life lmao), but I am definitely wanting to look at this when I have some more time on my hands. Also, after working with S3K so long, I can definitely understand the pain that is recreating this... Mess! Any possibility of maybe seeing the source (or parts of it) to help, with my gained knowledge, to create better documentation for this game? What about mods, are you planning on letting people to mod this? This could have some very fantastic possibilities as far as modding goes. Also planning to fix bugs in the original game? Because I sure as hell know tons of them and easy ways to fix them.
     
    Eukaryot, MarkeyJester and AkumaYin like this.
  3. Eukaryot

    Eukaryot Newcomer Trialist

    Joined:
    Oct 10, 2018
    Messages:
    4
    Thank you very much!
    This means a lot to me, especially from someone making a hack as impressive as Battle Race. Honestly, even after more or less replicating the basic VDP functionality, I'm still wondering how you and MarkeyJester did most of the transition effects. This is just amazing!

    At the current project state, I don't want to share the complete script code, it's essentially the source code of the game. But parts of it is totally fine - I just don't know which parts would be most interesting to you. Feel free to PM me (for now, only on Twitter @Eukaryot3K, or on SFGHQ)!

    Here's a public starting point already, of only a few script files: http://85.214.142.96/sonic3air_script/sonic3air_script.zip
    This includes the script with all the variable definitions at fixed RAM locations that I've added so far (in "defines/defines_global.lemon").
    When having a look into the scripts, please don't wonder too much about some strange namings. Many of the variables got their names without checking other resources, like the Sonic Retro Github disassembly or RAM documentation.

    I'm thinking a lot about this topic.
    The problem is, as long as I'm not finished with the script, and consequently am making lots of changes / renamings / refinements even to most basic stuff, making scripting publicly available is more or less off the table, making any kind of code modding hardly possible at all. This might change later on, of course, but I don't want to make promises here.
    That still leaves modding of resources like level layouts. Probably I'll sooner or later add some kind of compatibility with SonLVL, like loading of bin files for level object & ring placements.

    Indeed I am planning to fix all the bugs I can get my hands on. This is most of the fun of this project, so I'm being selfish here and try to do as much as possible on my own. Especially the easy ones. :)
    However, bug fixing is not high priority at the moment, not as long as there is so much other things to do - completing the port, fixing the widescreen issues, and especially making my own experiments with the game (I never got into ROM hacking, so this is my first chance to try out all the things I've always wanted to change).
     
    Last edited: Oct 14, 2018
    Natsumi likes this.
  4. HyaDoki

    HyaDoki Previously RaideinSlash Member

    Joined:
    May 10, 2013
    Messages:
    126
    Location:
    Devon
    Would this happen to be a spiritual successor to Sonic 3 Complete of sorts? I would love to have a more modern S3C experience maybe with a dropdash and no worries about having to generate a new rom for graphical changes.
     
  5. Eukaryot

    Eukaryot Newcomer Trialist

    Joined:
    Oct 10, 2018
    Messages:
    4
    Not really, sorry. Though I'm adding a few changes from S3C, there are no plans to reimplement all of it.
     
    HyaDoki and Natsumi like this.
  6. Natsumi

    Natsumi Markey's Member

    Joined:
    Oct 7, 2011
    Messages:
    645
    Location:
    Otter's lap
    It involves a lot of timing and some quite cool code - but I am not going to spoil the exact tricks, for obvious reasons =P


    Mostly I am very interested in object code, object library and the level rendering codes for now, those generally have really poor documentation and it would certainly help me a lot in building up some. However, I shall contact you about this when I actually get to it.

    This is one of the things I am looking to do; Create good and well documented naming scheme for variable names and routine names. There is little consistency on the Git disassembly so that is definitely something that needs changing.

    Well given you seem to know a lot more about the base game than most anyone on the scene, I doubt you'd have too much trouble picking up hacking lol
     
    Eukaryot likes this.
  7. Eukaryot

    Eukaryot Newcomer Trialist

    Joined:
    Oct 10, 2018
    Messages:
    4
    Now you got me even more curious. :)

    Alright, I'd be happy if the scripts can help you improve the documentation. Just let me know!

    Yes, a consistent naming would be a very good thing.
    And I'd be very interested in taking over the names afterwards into the scripts. Maybe it makes sense to make some script name changes beforehand already, like for functions and variables that are very frequently used - things like the "Draw_Sprite" vs. "RenderObject" in the first post's example screenshots.

    Oh, don't overestimate... :D
    One double-edged property of the automatic script porting process is that there's no actual need to understand what the code does. Of course, things get more interesting as soon as there's a fix, widescreen adaptation or other extension needed. That's usually the point where I start to dig into the code and comment it. But huge parts of the scripts did not need that treatment yet, and are actually still quite coarse.
     
    Natsumi likes this.
  8. TruffledToad

    TruffledToad the pirate that doesn't do anything Member

    Joined:
    Feb 2, 2017
    Messages:
    32
    Location:
    Behind you
    A Sonic 3 hack with promise? Well slap my face and recite the hedgehogsoup copypasta! I'll be sure to try this out when I get back home!
     
  9. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    730
    Location:
    Portland, Maine
    @TruffledToad Give the first post a bit of a closer look, though I don't blame you for assuming this is a hack considering what forum is about.
     
    TheInvisibleSun and AkumaYin like this.
  10. Natsumi

    Natsumi Markey's Member

    Joined:
    Oct 7, 2011
    Messages:
    645
    Location:
    Otter's lap
    Yeaa, using the insane naming schemes for the S&K disassembly is no good way to keep yourself sane. I am sure at this point I am not anymore.

    Well I can count with my fingers the amount of people I know have a good enough grasp on the actual game, its objects, and the code. And then some of these people are not all that technical either, and more know it because they have made layout hacks or whatnot. So while you may try to claim you have very little knowledge, so does everyone else =P
     
  11. TruffledToad

    TruffledToad the pirate that doesn't do anything Member

    Joined:
    Feb 2, 2017
    Messages:
    32
    Location:
    Behind you
    Oh. Well there goes me being dumb again. Still looking forward to this though.
     
  12. Trickle

    Trickle Newcomer Trialist

    Joined:
    Jan 18, 2018
    Messages:
    5
    Amazing job Eukaryot! It's so great to finally play Sonic 3 in widescreen. It's a shame Sega won't greenlight Taxman and Stealth's pitch. But this is the next best thing! Maybe there will be S1 and S2 ports like this one day. It would be nice to not have to resort to BlueStacks to play those wonderful remastered versions. I'm definitely excited about this project!