Sonic Adventure 2 Hacking

Discussion in 'Engineering & Reverse Engineering' started by Turbohog, Feb 20, 2012.

  1. NeilZander

    NeilZander

    Member
    4
    0
    0
    Hi everyone I'm really curious if this has been brought up or anything? Currently I've watched a comparison video of both Sonic Adventure 2 and Adventure 2 Battle and Adventure 2 Battle HD? I wanted to ask has anyone attempted to do what has been done with Sonic Adventure DX and bring back the really good lighting and shading effects? Reason I'm asking is I don't think I'm alone on this but it seems quite sad that SEGA did it yet again with these things and managed to make it look worse in some area's on a HD port no less. Too bright in certain spots. No shadow effect like in the jail cell when sonic is captured and so on?

    So again I'm asking has anyone yet attempted to fix this like it was done with SADX and do a type of Lantern engine for it so we can get the quality it rightfully deserved? Is this at all Possible?
     
  2. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    Anything is possible. However, nobody has made an attempt to fix the lighting yet. I don't think SA2 uses any kind of palette effects for lighting, so it may be just as simple as tweaking the light values until everything looks the same.
     
  3. NeilZander

    NeilZander

    Member
    4
    0
    0
    Oh that's awesome to hear. I was fearing the worse for awhile there since nothing had been brought up about it even it at least being a possibility. It's really great to hear that it's still possible and not like SEGA made that impossible to achieve. Hopefully someone will be able to try there hand at fixing the lighting and shading eventually then Sonic Adventure 2 Battle HD can be played the way it was meant to be and even surpass the Dreamcast original with it's proper quality.
     
  4. Caverns 4

    Caverns 4

    Member
    342
    0
    16
    Sanik Quest: Journey To The Right
    Though SADX and SA2:B are pretty different games, now that we're talking about lighting, I think SA2:B DOES use palette based lighting sometimes, or at least some kind of weird weird technique that only applies it to certain layers or something.
    Any time a character is on-screen at the same time at lighting/glowing effects, their upgrades aren't affected. Look at the Super Sonic transformation if you've never noticed, it's actually really ugly.
     
  5. Shaddy the guy

    Shaddy the guy

    Spend the police budget on femboy hooters Member
    394
    23
    18
    Beaverton OR
    Thinga Comic
    That happens with the crystal ring in SA1. The destroyed past cutscene is one of the most aggravating things I have to look at in the game because of it.

    Though if SA2 does use a similar or the same pallette lighting system as SA1, modifying the pallettes to be more intense or colorful could actually make the game look closer to, or better than SA1. It'd be interesting to see for sure.
     
  6. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    You'd think if the game was using palette lighting, it would have palette files for each stage. I suppose they could embed the information into the code files, but why would they? Different models/objects using different lighting settings is by no means something that would require palette effects, it's just a matter of changing the lighting settings between rendering the different models. IIRC SA2 often renders the upgrade models completely separately from the main model, instead of swapping out parts of the main model as SA1 does.
     
  7. SF94

    SF94

    Tech Member
    776
    2
    18
    Utah
    SA1/2 hax
    Alpha sorting. Hypothetically, palette lighting shouldn't have any effect on this.
     
  8. End User

    End User

    Member
    14
    0
    0
    Supers Over Hedgehogs (SA2)
    The closest I've come to finding anything related to the lighting data of each stage comes from the STGXX_FOG and STGXX_LIGHT.BIN files (XX being the stage's ID). The former affects the stage's lighting and fog, while the latter affects the lighting of the objects and character models for that stage. The LIGHT.BIN files are the same between both versions, for the most part. The only differences are that they're byte-swapped and some stages have extra lighting data - found in stgXX_light_gc.bin - for the Battle version to override specific values (Pumpkin Hill does this to change the lighting of the player character and the ghosts, both of which can be reverted to the original values by removing stg05_light_gc.bin. The exceptions are the Big Foot and Hot Shot bosses (STG60 and STG61, respectively) and some of the multiplayer maps. Removing the _gc lighting data for Big Foot causes Sonic's model to appear completely black, while removing Hot Shot's version does the same for Shadow and the boss itself.)

    The STGXX_FOG.BIN files are a bit more peculiar. In an attempt to replicate the bluish tint of the backdrop seen in Sonic vs. Shadow 1 that was removed in SA2B, I found that tweaking the first 16 bytes of stg19_fog.bin in SA2B gave me the results I needed. If you try to byte-swap the files from Sonic Adventure 2 DC and put them into SA2B, all you'll get is a solid blue screen upon entering the fight. As for the specifics of the files themselves, I'm not exactly knowledgeable on that front. All I do know is that editing them can have one of two effects upon the stage you want to modify. The first is that the entire screen becomes enveloped by the color you've chosen for the fog, while the second scenario only sees this change being applied to the stage itself.

    Much like the LIGHT files, there were more FOG files that were added or significantly changed in SA2B, except the game can crash if the new files are removed. Not all stages have a LIGHT and FOG file associated with them specifically, and the PC version slightly complicates matters because of its... lacking implementation of Battle's changes. The biggest example I can think of is the neat headlight effect for Eggman in Iron Gate and Lost Colony, which was either cranked up to max brightness or not converted to work properly with Windows.

    If the above information was already known and documented, my apologies for restating the obvious.

    EDIT: Upon further testing, editing the FOG files causes the following to occur. Aquatic Mine will be used for reference and both screenshots were taken while Knuckles was underwater.

    SA2B Default
    [​IMG]
    Dreamcast Version (Converted to work with SA2B)
    [​IMG]

    Adding to this, the Battle version of STG07_FOG.BIN only contains the first 16 bytes of data that were modified to give the underwater section a blue tint. The fog's color is determined by the second set of four bytes, in ARGB format for SA2B (FF 00 80 FF). The next set of four bytes affects the intensity of the fog by way of the difference between the two values (44 BB). If 44 is set to 00, the screen becomes completely blue upon diving underwater.

    EDIT 2: After testing almost every stage with the modified FOG values from the Dreamcast version, I found that they all had a few things in common when placed into SA2B.

    • For stages where the Dreamcast's fog data didn't immediately bug out (Lost Colony), the effect was much more intense than normally seen in either version of the game. As an example, here's what STG22_FOG.BIN (Crazy Gadget, Dreamcast version) looks like in both versions. In most cases, SA2B adjusts the FOG parameters so the effects look closer to the Dreamcast version, so this is mainly an example of a potential issue that arose during the porting process that was addressed and fixed before release.

      Sonic Adventure 2
      [​IMG]
      Converted to SA2B's format
      [​IMG]
    • Certain stages have odd implementations of their respective FOG files. The porting team for SA2B most likely ran into this problem and decided to remove these files to prevent these issues from affecting the aesthetics in regular play. As an example, here's what I like to call "Accurate City Escape", which is what you get when you place STG13_FOG.BIN into SA2B. In the Dreamcast version, the backdrop isn't supposed to be affected by the FOG parameters, nor is the effect supposed to be this strong.
      [​IMG]
    • Re-implementing certain FOG parameters into SA2B's stages seems to have no effect, though the only example I can immediately point to is Iron Gate. Considering the fact that SA2B tends to ignore some of its own FOG files entirely (Lost Colony, specifically the bluish tint the level geometry is supposed to have in the outdoor sections), I'll chalk it up as a bug, if not an intentional omission.

    Another interesting thing to note is that, at least in terms of the enemies, Gold GUN Beetles are always set to ignore LIGHT files. After messing around with the data for a bit, the third set of bytes (which I presume controls the enemy lighting for the stage) had no effect upon the Gold Beetle, which was further reinforced by my attempt to edit the main lighting values themselves (the first chunk of data) also having no effect. In terms of structure, the FOG and LIGHT files are at least consistent in the Dreamcast version, so understanding the lighting information for one stage would naturally help with the lighting and fog for the rest of the game's levels.
     
  9. Caverns 4

    Caverns 4

    Member
    342
    0
    16
    Sanik Quest: Journey To The Right
    That would still mean that models from SA2 can't be displayed though, yes?
    Considering how little is known about SA2's model format, is seems like it has virtually nothing in common in SA1.
     
  10. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    SA2B is definitely capable of displaying Ninja Chunk (SA2 format) models, all the characters use them, as well as the Basic Test level. As for how much we know about the format, it's entirely spelled out in the SDK along with the Ninja Basic format used by SA1, so theoretically we should know everything. However, understanding the format and being able to produce and modify models in that format are entirely different things.
     
  11. NeilZander

    NeilZander

    Member
    4
    0
    0
    It's good to know they didn't change the format to a point of it being impossible or anything like some company's do. From the sound of it SA2B is just as hack-able as SADX so will see a lighting and shading mod eventually. I really look forward to that it will make the PC port all the more worth it.
     
  12. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,108
    95
    28
    Formerly Sonic the Fighters
    Some? Don't you mean "all"? Techically the layman was never supposed to be able to access the GD-ROM data in the first place, so it should have been impossible from the get-go. It's amazing how much info we do have, actually.
     
  13. NeilZander

    NeilZander

    Member
    4
    0
    0
    though that's true in most cases. I said some because there are some company's who allow modding in similar nature for there titles. Can't say if it was intentional or not but like the people behind Saints Row. They are fully aware of people messing with the games files even before the SDK came out and openly said do it. Hell the main modder got hired by Volition because he managed to do that. Some other company's have done the same Bethesda was fully aware of stuff like the script Extenders and Nexus and yet they let people tamper with the file structure and if what is to be believed for the new Final Fantasy Windows Edition Square Enix has said they are planing to leave the games files alone because they want it to be as moddable as possible at our own discretion. though if it gets out of hand they will then do something about it. Case in point some company's make it sound like they openly left the files for people to mess around with can't say the same for this but then again look at the EULA for Forces it mentions something about the Lua Scripting Runtime like they knew it would be modded and are actually okay with it. Again can't really say if it was intentional or not but they might have done it that way because they knew people would mess with it.

    Anyways I'm getting off-topic here sorry.
     
  14. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    The only reason we know so much about the Ninja Chunk model format (including its name) is because there's a leaked copy of the Dreamcast Katana SDK that includes descriptions of all the data structures.

    I wouldn't say SA2B is as hackable as SADX at this point, we still have no way to create custom chunk models, and we don't fully understand the new model format SA2B uses, which isn't technically necessary, but would be helpful so we aren't relying on Dreamcast model rips and converting the game's code to use chunk models all the time. Then there's the matter of the character models, which despite my best efforts to follow the SDK to the letter, still manage to confound my parser, rendering it as a mess of random polygons. And our general knowledge of SA2's internals is not quite as far along as SA1's, mostly due to an apparent lack of interest; everyone's so busy making SADX look exactly like the Dreamcast version, that SA2 has just been largely ignored.
     
  15. Speeps

    Speeps

    Member
    116
    28
    28
    I had a look at e0350 (The original game's opening). It's already been converted to SA2B's format by the looks of it, just had fucked pointers. I went through and corrected everything in that and e0350texlist.prs, which seems to have worked judging by the modloader console because the game doesn't die trying to read them now.

    There's another problem now though: e0350motion.bin doesn't exist, so it's still crashing trying to open the event. None of the events in the Dreamcast version have that file either, but that version's main files are a lot bigger (including e0350) so I'm guessing the data would be in there somewhere. I have no idea where exactly it is though, nor anything about the format and how to even begin swapping the bytes if it is there.

    If you wanna have a look here's the edited e0350 and e0350texlist, as well as the DC version's e0350:
    https://drive.google.com/file/d/1fmEfWtEjkoe-7QyofKW9w7kmrTNBea-u/view
     
  16. Caverns 4

    Caverns 4

    Member
    342
    0
    16
    Sanik Quest: Journey To The Right
    I'm gonna say something controversial: I feel like Sonic Adventure 2 is an overall better game than SA1 (Though I'll give Sa1 that it had better consistency between game-play styles, Sonic Adventure 2 was simply more polished in nearly every regard, save a few caveats).

    So in my case, it's not a lack of interest, but rather, a lack of understanding when it comes to cracking code and such that makes things nearly, if not entirely impossible for me. I'd love to even just be able to extract the Character models in T-Pose, but hexadecimal is simply not my forte. That said, with my ammeter experience, is it probable that SA2 uses some undocumented variant of the Ninja format, or maybe it's even just byte/bitswapped?
     
  17. Woofmute

    Woofmute

    Y and -Y and XYZ-X-Y-Z. Member
    184
    0
    16
    Hacking and researching Rez.
    It's more likely the format used was a later version, which won't exist in the western katana sdk's since they stopped including ninja tools there after like r9. if any of the japanese sdk's leak there'd probably be more up to date stuff there since they kept supporting it. that and it was made by sega, so they'd have access to stuff that may not have seen a release in an sdk for other devs anyway.

    you could run the ninja tools we have in a vm but i assume people want to avoid doing that for things they plan on releasing. plus there's no tools there to convert back from ninja.
     
  18. BlazeHedgehog

    BlazeHedgehog

    A "Community Enigma"? Oldbie
    1,460
    5
    18
    This may be depreciated now that we have a SA2 mod loader n' such, but to whom it may concern: it seems like "Sonic Adventure 2: The New Challengers" no longer works. I just spent like 30+ minutes fighting to get it to load on a Twitch stream.

    Every time, it would freeze just before the title screen and cause my entire Steam client to panic (as in, once I forced TNC to close, nothing else on Steam would work properly until I closed and reloaded the client).

    It used to be my defacto go-to for playing Sonic in Shadow's levels, but I suppose I should finally get with the times and grab the mod loader, huh
     
  19. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,412
    67
    28
    SonLVL
    Yeah, the Character Select mod has most of the same features, though it does use a slightly different control scheme. That said, there's no reason why TNC shouldn't work.
     
  20. BlazeHedgehog

    BlazeHedgehog

    A "Community Enigma"? Oldbie
    1,460
    5
    18
    Tell me about it. I don't remember TNC having any problems just, say, six months ago, when I was last using this desktop. The Twitch stream goes on for a while, but I tried validating my install and then re-installing TNC over it, I tried windowed, full screen, I checked to make sure the refresh rate on my monitor wasn't causing problems

    Vanilla SA2 works, TNC doesn't, and if I try to launch TNC, it freezes, and then I try to launch Vanilla SA2 afterwards, it won't work until I close and relaunch Steam.

    And sometimes TNC freezes before showing the intro FMV (the classic, pre-Battle SA2 logo animation) and sometimes TNC freezes just before displaying the titlescreen.