don't click here

Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    Specifically, "reduce tiles" lowers the number of tiles it takes to make a full sprite, but it comes at the potential cost of using more sprite pieces (you only get 80 total in one state to work with if the horizontal resolution is set to 320px, also only 20 sprite pieces per scanline, each piecing ranging from 1x1 tiles to 4x4 tiles). It really depends on what you need, but for a standard Sonic hack, you'll more than likely be fine with tile reduction. Basically, you'd pick based on if you prioritize lower VRAM usage or a lower sprite count.

    Say, I have this sprite here:
    [​IMG]

    In tile reduction mode, it'd do something like this to make up the sprite:
    [​IMG]
    4 sprite pieces, but only 6 tiles. Since it's able to be split up like that, tiles can be flipped, and thus increase the tile savings.

    Another potential scenario in tile reduction mode is this:
    [​IMG]
    Compared to the scenario above, sprite usage is cut in half by adding in 2 blank tiles so that the 1x2 and 1x4 pieces can be merged into 1 2x4 piece. Mirroring is still applied to save on tile usage.

    Which of the 2 scenarios above Flex 2 does, to be honest, I have not a clue; I don't really use Flex 2 all that often and have not paid that much attention.

    However, in mappings reduction mode, I know that it'd do this:
    [​IMG]
    Only 1 sprite piece, but 16 tiles! Since it's not split into 2 sprite pieces, it's impossible to apply the mirroring trick.

    It's kind of a pick your poison scenario. Choose what you think would be most appropriate to use.
     
    Last edited: Aug 13, 2022
    • Informative Informative x 1
    • Useful Useful x 1
    • List
  2. SEGACast

    SEGACast

    Member
    49
    10
    8
    Yeah, this is more than likely an issue on my part. I managed to fix the palette issue. I think I had accidentally inserted the palette file 2-3 times in my project file, so that probably had something to do with it! :eng99:

    @Ralakimus This is a very detailed explanation. Thank you for that! :thumbsup:


    I've started working on sprites for the Special Stage and HUD related elements, but I'm having trouble getting their respective files to load.

    I've also tried changing the compression method, but that didn't work either. That might not be necessary with the disassembly, though.

    For example; There's Art, Mapping,and Palette files. Special Stage Tails doesn't have a DPLC file but I assume this is because there's no collision (I believe that's how DPLC works? I'm just guessing).

    ...There's also an Animation file for Tails, but I have no idea what that would be used for since I apparently only needed the other four.

    Creating a new object and inserting the Special Stage files just gives me a blank row, so nothing actually loads. I have yet to do anything in Flex 2 besides editing Tails sprites, so I've hit yet another obstacle during my journey. :V
     
  3. Rrose80149

    Rrose80149

    Member
    75
    7
    8
    ObjID_Tails (Obj02).
     
  4. DON'T DO THAT, unless you're willing to change the subroutine used to then decompress and load these and potentially have to change registers (!!!)
     
    • Informative Informative x 1
    • List
  5. SEGACast

    SEGACast

    Member
    49
    10
    8
    Ah, that's not good. I didn't save the file that I tried that on, so I'm hoping nothing serious would've happened?
     
  6. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    Could you lay out the exact process you've done so far to get you to this point? If I read back correctly, you're trying to replace Tails' sprites?
     
  7. SEGACast

    SEGACast

    Member
    49
    10
    8
    That is correct. I made a project file and placed it into the root of the disassembly, then made an object in the Project tab and inserted Tails' Art, Mapping, DPLC and Palette files from the disassembly. I also set the Game Format to Sonic 3&K Player.

    I've been inserting sprite sheets as I make new sprites and have been placing the sprites above the ones I'm replacing, then I delete the Tails sprites once I get my sprites in the proper places.

    I've been doing Reduce Mappings for all of my sprites since that's the default option that the program gave me. I believe the main Art file for the characters fit within 128 KB, which is amazing. My art file managed to get to 108 KB with just the few Tails sprites I've replaced, haha. :eng101:

    Then I go into Build Scripts > buildS3Complete.bat and compile everything into a functional ROM. I had a bit of trouble getting it to work at first, but once I did it worked perfectly fine, with collision and all (which I wasn't confident about in the beginning!).


    As of right now, I'm trying to figure out how to edit other sprites like Special Stage character sprites and HUD icons. I made a new object in the Project tab, then inserted the Art and Mapping files for "SStage Tails" and set the Game Format to Sonic 3&K Player for that as well since I assume it works the same.

    However, clicking load on "Object" doesn't load any sprites, and it just draws a blank. I'm almost positive I'm doing everything correctly, so I don't know what could be wrong here.

    upload_2022-8-13_20-13-52.png
     
  8. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    Okay, for the special stage I took a look into that, and it turns out that the mappings and DPLCs are merged into 1 file ("General\Sprite\Tails\Map - SStage Tails.asm"). Unfortunately, I couldn't get Flex 2 to load just from the 1 file, so I had to split them out into 2 files, and those loaded just fine. I did make a copy of "word_908EA" for the DPLCs file, since that was shared between the 2. If you want a reference for how I split the file up, just in case for future reference, here you go. I did see that the same deal applies to Tails' tails. Just don't forget to also include in the split out DPLCs file in your disassembly.

    As for the HUD, the data is found in "General\Sprite\HUD Icon". Unfortunately, the mappings for the HUD were not designed for editing in an editor (I wouldn't be surprised if all the of the game's mappings were done by hand; I'm starting to believe more and more that was the case), but you can still edit the art by itself, at least. The file you are looking for should be both "Tails Life Icon.bin" and "Miles Life Icon.bin" (they interchange depending on region), and they are compressed in Nemesis.
     
    • Informative Informative x 1
    • List
  9. i'm not sure how the decompression routines work, but since the original sprites are uncompressed, compressing them without using the decompression routine, it would make the tiles a garbled mess
     
    • Informative Informative x 1
    • List
  10. SEGACast

    SEGACast

    Member
    49
    10
    8
    Ah, thanks for looking into that for me. It took a bit for me to figure out how to split them going by what you said, but I managed to do it for SStage Tails tails. :thumbsup:

    However, I came up with two more questions as I was doing what you said.

    Once I inserted the files needed to load SStage Tails, I ran across an issue; Sonic and Tails' palette isn't used for Blue Spheres, and the sprites require another palette.

    I looked through the Disassembly, but I wasn't able to find the right palette used for Sonic and Tails' Special Stage sprites. In fact, I also wasn't able to find the exact palettes used for Super Transformations and while underwater among others. :V

    And I tried loading Tails' Life Icon, except I wasn't sure how to go about that either. There doesn't seem to be a DPLC file for it and the only Map file in the HUD Icon folder was MAP - HUD (there was no mention of PLC in the file itself), and I would like to assume that the sprites use Sonic and Tails' palette but I'm unsure of that.

    upload_2022-8-14_5-31-0.png
     
  11. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    "General/Special Stage/Palettes/Main.bin", first (Sonic) and second (Tails) lines. Keep in mind though, that the spheres to share this palette, so do be careful.

    PalCycle_SuperTails, color data is put in as assembly data. There are no underwater variants for Tails, or even Knuckles.

    You could just make a throwaway set of mappings for importing the new art onto, just ignore said throwaway mappings in the disassembly.

    Regarding DPLCs, those are designed to pick out art for a sprite frame from a large bank of uncompressed tiles, such as it does with Sonic, Tails, and Knuckles, since not all of those tiles can fit in VRAM. The HUD does not use DPLCs because it's simply not necessary, and also the HUD icon is compressed anyways, so it'd be impossible to use DPLCs with it.
     
    • Informative Informative x 1
    • List
  12. SEGACast

    SEGACast

    Member
    49
    10
    8
    I see. I think I figured it out now? I set the Palettes line in the Project tab to 2, however it doesn't automatically change the palette. The only way to do this seemingly is by shifting Line 1 (in the Palettes tab next to Art) to Line 0's spot, which would push Line 0 up by one. I couldn't figure another way to accomplish this, so I hope I'm doing it right. :ohdear:

    Could you elaborate on this further, please? I'm not entirely sure what you mean by making a throwaway set of mappings and ignoring them in the disassembly. I believe you're telling me to make a "fake mapping" that will allow the program to load the sprites, but I don't know how you would want me to do that.
     
  13. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    Basically just create the mappings yourself in Flex 2 purely for the purpose of importing the new graphics over it. It's not to be used in game or anything, just to aid you in importing the art.
     
  14. Nik Pi

    Nik Pi

    Member
    @SEGACast, maybe you should try to use SonMapEd?
    I don't know about the differences between this tools.. but maybe MapEd will be more comfortable for you?
    P.S.: If you want to find a graphics, or another data, but can't, try to search it through asm code.
    Code of Super Tails has a link to code of ST palette cycling, and code has a link to palette file :)
     
  15. SEGACast

    SEGACast

    Member
    49
    10
    8
    I think I figured out the HUD stuff now, but I'm unable to test my ROM to make sure.

    When I attempt to build the ROM, this text appears:

    upload_2022-8-15_10-11-52.png

    Here's the code from the DPLC - SStage Tails tails file that I had split from the original mapping file. I inserted your SStage Tails files into the disassembly, since you already split them for me. (Thanks again, by the way!)

    Let me know if you would like to see split code from the other Special Stage files as well.

    Code (Text):
    1. PLC_SStageTailstails:dc.w word2_91124-PLC_SStageTailstails
    2.         dc.w word_91196-PLC_SStageTailstails
    3.         dc.w word_9119A-PLC_SStageTailstails
    4.         dc.w word_9119E-PLC_SStageTailstails
    5.         dc.w word_911A2-PLC_SStageTailstails
    6.         dc.w word_911A6-PLC_SStageTailstails
    7.         dc.w word_911AA-PLC_SStageTailstails
    8.         dc.w word_911AE-PLC_SStageTailstails
    9.         dc.w word_911B2-PLC_SStageTailstails
    10.         dc.w word_911B6-PLC_SStageTailstails
    11.         dc.w word_911BA-PLC_SStageTailstails
    12.         dc.w word_911BE-PLC_SStageTailstails
    13.         dc.w word_911C2-PLC_SStageTailstails
    14.         dc.w word_911C6-PLC_SStageTailstails
    15.         dc.w word_911CA-PLC_SStageTailstails
    16. word2_91124:     dc.w 0    
    17. word_91196:     dc.w 1    
    18.         dc.w $5000
    19. word_9119A:     dc.w 1    
    20.         dc.w $8006
    21. word_9119E:     dc.w 1    
    22.         dc.w $500F
    23. word_911A2:     dc.w 1    
    24.         dc.w $5015
    25. word_911A6:     dc.w 1    
    26.         dc.w $701B
    27. word_911AA:     dc.w 1    
    28.         dc.w $8023
    29. word_911AE:     dc.w 1    
    30.         dc.w $502C
    31. word_911B2:     dc.w 1    
    32.         dc.w $5000
    33. word_911B6:     dc.w 1    
    34.         dc.w $8006
    35. word_911BA:     dc.w 1    
    36.         dc.w $5032
    37. word_911BE:     dc.w 1    
    38.         dc.w $5015
    39. word_911C2:     dc.w 1    
    40.         dc.w $701B
    41. word_911C6:     dc.w 1    
    42.         dc.w $8023
    43. word_911CA:     dc.w 1    
    44.         dc.w $502C
    I'm pretty sure I figured out how to split the files, but it appears like the issue is sourced from them for some reason. I compared the SStage Tails tails Mapping and DPLC files to your SStage Tails files and they're almost 1:1 aside from having different bytes of course, so I'm really confused.

    I assume you're suggesting that I open the .asm file of Super Tails in a text editor to find the section that would hold the palette, similar to how a Mapping file can share both the Mapping and DPLC components. However, Super Tails doesn't have a .asm file. I looked through the .asm files that Tails does have, but it doesn't seem like any of them mention anything outside of what they're used for.

    If you're talking about something else, then I unfortunately don't know how to look through that.
     
    Last edited: Aug 15, 2022
  16. Nik Pi

    Nik Pi

    Member
    O_O

    Dude.. you have a lot to learn)
    Super Tails code is in main asm file (s3k.asm)
     
  17. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    Put "PLC_SStageTails:" before the inclusion of the DPLC file.
     
  18. SEGACast

    SEGACast

    Member
    49
    10
    8
    Yeah, I suppose I do. Before a few days ago, I had never set foot into the ROM hacking scene. There have been quite a few obstacles I've hit (and may very well continue to), but once I overcome them I hope that the end result will be something I, and hopefully others, will like.

    I'm unsure as to what you mean by "before the inclusion of the DPLC file". I tried making a line and writing that before SStage Tails' DPLC file code itself, but that gave the same error. If you could elaborate on this as well, I should (hopefully) be able to figure it out. :psyduck:
     
    Last edited: Aug 15, 2022
  19. Devon

    Devon

    There's nothing left but faith Tech Member
    771
    454
    63
    Code (Text):
    1. PLC_SStageTails:
    2.     include "General/Sprites/Tails/DPLC - SStage Tails.asm"
     
  20. SEGACast

    SEGACast

    Member
    49
    10
    8
    I believe I have found the section where the SStage files are referenced in the assembly. However, Tails isn't listed here. I said earlier that I put the files in the assembly file earlier, but I meant the Tails' Sprites folder that's part of the disassembly. I apologize for that typo.

    Code (Text):
    1. ArtUnc_SStageSonic:
    2.         binclude "General/Sprites/Sonic/Art/SStage Sonic.bin"
    3.         even
    4. Map_SStageSonic:
    5.         include "General/Sprites/Sonic/Map - SStage Sonic.asm"
    6.  
    7. ArtUnc_SStageKnuckles:
    8.         binclude "General/Sprites/Knuckles/Art/SStage Knuckles.bin"
    9.         even
    10. Map_SStageKnuckles:
    11.         include "General/Sprites/Knuckles/Map - SStage Knuckles.asm"
    12.  
    13. ArtNem_SStageShadow:
    14.         binclude "General/Special Stage/Nemesis Art/Shadow.bin"
    15.         even
    16. ArtNem_GetBlueSpheres:
    17.         binclude "General/Special Stage/Nemesis Art/Get Blue Spheres.bin"
    18.         even