don't click here

SADX/SA1 Hacking/Modding

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Aug 15, 2009.

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    http://youtu.be/r_NtLOS5_UA
    http://mm.reimuhakurei.net/sadxmods/trunksghost.7z
     
  2. Jase

    Jase

    ~~(_ _C^> Member
    My god that's awesome. Would it be possible to move ghosts around using online multiplayer systems (sending players input, dead reckoning, ect)? Also would the ghost be able to have collisions with other players?
    This got me imagining some crazy MMO-style Sonic Adventure DX. I can imagine roaming around Station Square with lots of people doing random shit (Think San Andreas: Multiplayer) :v:
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    Anything is possible in theory, but I have no idea how to make something like that actually happen. It would have to be done using actual player objects rather than the much simpler ghost object, and spawning multiple players has its own problems.

    + - But if it does happen, I want to see SF94-Serv ported.  
     
  4. Jase

    Jase

    ~~(_ _C^> Member
    Ah I see. Are there fatal problems with having multiple players? I guess the two main things that would ruin something like this would be if it crashes from having too many players, or if all the players are controlled by 1 input, preventing players being moved individually.
    I have all the logic for online multiplayer nailed down from making games using the software MMF2 (I'm sure it's not as simple in other languages but I'm willing to learn), but that software has limited RAM reading/writing tools and I've only got so far in the past with making mods.
    If I were to learn a programming language or software, which would be most suitable for (hopefully) rapid development involving networking capabilities/RAM editing?
     
  5. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    If you don't initialize/destroy the extra players properly the game crashes when the level ends. It's really frustrating.
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    The only ways I can see online multiplayer working are either having other players as ghosts or ensuring that everyone is on the same level at all times. You'd have to create a whole new UI for selecting a level and character, and which character's specific version of the level to use, then you'd have to rewrite a whole bunch of stuff to not be character-specific.

    If you're asking which language to use for modding SADX, C or C++ are the only options.
     
  7. This is amazing. Brb making a million ghosts.
     
  8. Jase

    Jase

    ~~(_ _C^> Member
    Ah damn. I still feel optimistic for at least an online ghost mod :P

    Well, a built-in "sonic.exe" mod would be extremely difficult (I wouldn't even know where to begin), but perhaps if we used an external running software that attaches to SADX, we'd have a better shot? If we did that, then we could use the software to detect the current state/level/segment and according to what is going on, we could make the software send different functions to SADX to make it create/initialize/destroy/position characters. This is somewhat how I made my really crappy attempt for a SA2 online mod in this video. In the video, the software wasn't constantly sending the players position to eachother, it detected when the position was changed and then sent it (not the best method but it was merely a test to send/receive addresses of a game's RAM over the network and apply it, and I reckon this same sort of method could be used for a SADX online mod). This makes me believe that writing an entire C/C++ application wouldn't be exactly necessary (defiantly necessary for efficiency and stability perhaps). As long as there's a way to be able to compare variables and edit the RAM (and also call in-game functions?) then this could be achieved easily.

    Maybe I'm being way too optimistic for my own good, but say for example, (and maybe I'm being dumb and ignorant but hear me out), if there was any possible way for an external source to create a ghost object on command (Maybe for example, setting a specific address value to "1" would create a ghost and reset itself to "0", so that address can be repeatedly set to 1 to create lots of ghosts), and also be able to predict/locate the newly created ghost's properties (and also destroy them on command), then that would be an excellent starting point. Again, probably being too optimistic, it's probably extremely complicated to create a ghost on demand.
    In your mod, are ghosts only able to be created at the start of a level or can they be created at any time? When the ghost used to disappear at the end of the stage in your mod, was it merely going invisible or was it being removed entirely from the RAM?
     
  9. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    The best way to be able to call SADX's functions and change its variables reliably is to make a DLL mod with the mod loader.
    Because a DLL is loaded into the same address space as sonic.exe, you can retrieve and modify any of its variables without using ReadProcessMemory/WriteProcessMemory, you can call any of SADX's functions (including LoadObject) directly, and you can insert jumps, calls or pointers to code or data in your DLL and SADX will happily jump into your code or read your data.
    If you're trying to override the controller data for example, you can insert a jump right at the end of the function that updates the controllers, and override it right there, as opposed to an external program, which may or may not have any effect depending on exactly where in the game loop SADX is when you write the data.

    As for the ghosts, even in the "Trunks Edition", there is only one ghost object, loaded after the player character is and destroyed along with everything else when the level ends. It uses a loop to render all the ghosts, and it would be possible to dynamically add and remove ghosts.
     
  10. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    So, if you have been watching the sa_tools repo on github, you might have noticed that recently, split and struct generation support was added for the path data (formerly known as autoloop).

    [​IMG]

    Now that you can get at this data, you'll obviously want something that can import and export this path data. I present to you my SADX scripts, now with path import and export:
    https://github.com/jcorvinus/SADXScripts

    The export script generates almost the same data as the importer, except for 2 values in the path format which we currently don't know how to generate. However, 0 values work in many cases so you can at least make the most common things like ground-run paths and camera paths.

    Also pictured in that image is the improved obj export for SA1/SADX models (SALVL, SADXLVL2). Before it was generating a ton of duplicate data as well as omitting a significant amount of face data. It doesn't support sa2 models yet, but that is planned for the future.

    obj import for salvl has also been improved. It was crashing before, now I've gotten it to successfully import a test model:
    [​IMG]

    More stuff is in the works.
     
  11. Dark Sonic

    Dark Sonic

    Member
    14,631
    1,611
    93
    Working on my art!
    It lives!

    Hopefully one day someone can figure out more high-res textures so we can have some somewhat more modern looking levels (Always amazing comparing Speed Highway SADX to Generations, it's the only 3D level that was revamped to the extent of the classic levels)
     
  12. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    Could you possibly hijack the tails/sonic race mode?
     
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    I don't see how that would help?
     
  14. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    You wouldn't need to make the ui for selecting characters or stages, nor would you have to make sure that both players were in the same part of the level since all of tails' stages are one-segment stages
     
  15. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    So your solution is to have no options at all. If nothing else I'd rather have a debug text UI or external config.
     
  16. Dude

    Dude

    Tech Member
    3,138
    0
    16
    Southbridge, MA
    Random VR/AR trash
    For anyone out there who is still using the nodetable 1.5 exporter, a critical bug has been fixed. This bug would cause a large number of duplicate objects to be spawned in the scene. Two other fixes were included: all face indeces are now exported as integers (the way they were supposed to be), and the exporter now supports all axes of rotation.

    Get it at GitHub:
    https://github.com/jcorvinus/SADXScripts (sadxNodetable1_5.ms)

    Updates on level import coming soon.
     
  17. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    I have updated both versions of the ghost mod so that you can now record ghosts on Twinkle Circuit.
     
  18. SpaceyBat

    SpaceyBat

    Member
    2,037
    309
    63
    United States
    Freedom Planet 2
    Might I request a mod that keeps the game running even if the window isn't on top? (With keyboard input disabled of course.) There's a similar mod for SA2, which makes legit Chao raising a lot more convenient.
     
  19. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,785
    367
    63
    SonLVL
    I can definitely make it keep running, but making it ignore keyboard input will be more difficult.
     
  20. SpaceyBat

    SpaceyBat

    Member
    2,037
    309
    63
    United States
    Freedom Planet 2
    Cool, thanks!
    If disabling keyboard input is too hard, do you reckon I could work around it by leaving a controller plugged in? I think I remember SADX ignoring keypresses automatically if it detects a controller.