don't click here

SonLVL

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Feb 7, 2011.

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    The reason SonLVL modifies all those files, by the way, is because it has no concept of which data has been edited by the user, so it has to save everything every time, and doing so often involves recompressing data, which produces different results than Sega's original compressors.

    The disassembly has now been fixed, so if you're using Git, you can pull in the changes, or if not, you can manually patch it: https://github.com/sonicretro/skdisasm/commit/ae598f8aee501ea709a408103fd8397bed98e8b7
     
  2. Chainspike

    Chainspike

    Stealing rings since 1994 Member
    173
    90
    28
    Death Egg Zone
    S3C Delta
    Wow, that was fast, thank you both for looking into this. This isn't the first time that I've had problems with the sound driver. I've applied the fix and everything should be good to go now.
     
  3. Andrew75

    Andrew75

    Technical Artist Member
    2,030
    107
    43
    Project AXSX(Sonic Xtreme) + Misc Projects
    Heya!, Am I missing something, or is there no way to export level map layouts with the Hex overlay as seen in the image below?

    [​IMG]
     
  4. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    There is not. I'm not sure in what circumstance that would be useful.
     
  5. Andrew75

    Andrew75

    Technical Artist Member
    2,030
    107
    43
    Project AXSX(Sonic Xtreme) + Misc Projects
    I'd use it as a guide for our project by opening it in photoshop and turning on grid to help split up the tiles visually. It's kinda hard to see the tiling hex when all the digits are clustered together in the editor. The text Feels hard to differentiate between where one set begins and or ends.

    Also off topic , but when exporting with the transparent background feature ticked, it exports the collision tiles as transparent too if they are same color as background's color.
     
  6. Hey, can someone here help me with a problem I'm having with editing Sonic 1? I went into GHZ 3 and used the "remove all objects" tool to remove the act's standard layout, and then erased all of the chunks within the act so I could start fresh (as I've done with acts 1&2). However, after working on the opening area for a few minutes and building the rom to test it out, I went in to see the entirety of act 3's object layout still completely intact. After going back into SonLVL, the editor was still only displaying the things I had added in (a bridge segment to close a gap).

    After poking around for a bit and not finding anything helpful, I went digging into the disassembly and found a folder named objpos, which has .bin files for (what I assume are) the object positions for every act in the game (I'm using the github disassembly). In there, I noticed that several acts have seperate files for revision 01, while others have a single file. I wasn't sure what to do here, until I remembered that the disassembly contains INI files for both revisions, and I've been using revision 00 by habit. After switching to using revision 01, the objects seem to be working correctly again, but I wanted to know if there might be any other things like this that I don't know about, and if I might have messed something up with the editor. Again, I think I probably fixed the issue, I just want to be completely sure before I actually do make an irreversible mistake. Thanks in advance.
     
  7. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    The disassembly can be configured to build a REV00 or a REV01 ROM. You were editing the REV00 object layout but building with the REV01 object layout. You've solved the problem by switching INI sets and don't need to do anything else. You should be aware however that object layouts are not the only files that can be different between REV00 and REV01, always check first.
     
    • Informative Informative x 1
    • List
  8. Ok, thanks again.
     
  9. Sorry for the double post, I'm trying not to pester people anymore, but I have a few questions that have built up over the past few days (yes, I searched through the entire thread, but I have a job and can't spend forever laying in bed reading walls of posts).

    1. I'm trying to import objects from MZ into GHZ. What's the easiest way to fix the art for the objects (not worrying about palettes, I can fix that later) and ensure that this will work for all the zones?

    2. Same as the first question, but with tiles, blocks, and chunks. I read about the deep copy feature, but while the collision works fine, the art in the editor and the actual game is a mess. Again, palettes can be adjusted later.

    3. How would I go about setting up a fourth act for editing? I saw some information on this, but the files in the github disassembly don't match.

    Any help is appreciated. Have to go to work now.
     
  10. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    The first question isn't even SonLVL-related, unless you just mean making the object appear in the editor, which is just a matter of copying the object definition from one zone's ini file to the other.
    For the second question, Deep Copy should work, if it doesn't, either your level is full, or I have work to do.
    For the third question, assuming you're talking strictly about the editor and not making a fourth act work ingame, just copy the definition for act 3 and change the numbers in the filenames to 4. If the files don't exist they will be created automatically.
     
  11. Thanks for the answers.

    1. I don't really need the objects to appear in SonLVL, and they function perfectly in-game, aside from the sprites being garbled. I'll look around and try to find the fix.

    2. I read somewhere that Sonic 1 can only handle 52 chunks in a stage unless the art is uncompressed (forgive me if I'm wrong), but I deep copied the MZ chunk over one of the empty chunks in GHZ's default list, meaning it can't be the amount I have (unless I'm just really ignorant). What's the limit for tiles and blocks? I copied chunk $09 from MZ (which didn't seem too large), and the collision works great, but the art is completely whack. sonlvl2.PNG Here's what it looks like in the editor, the Chunk selector, and in-game. In terms of the "level being full" I assume you mean the amount of art and stuff, not what I actually have within the playable level. But if the latter is the case, I did this in a 30% complete layout of GHZ 3 with only enough objects to complete what I have in testing.

    3. Both, really. I need (or rather want) a playable fourth act in each zone, and editing capabilities as well. I know it can't be too hard, as I've seen hacks that incorporate a fourth act like it's nothing. I know Sonic 1 has them lying around or something, as SBZ 3 is treated as LZ 4, with FZ being SBZ's act 3. All I need is another playable act. I don't need music, or palettes, or camera tricks, I just need a playable, editable stage, with art and objects.

    All of these issues are part of a bigger idea I had to flesh out this test hack I'm working on; see if you can guess what it is. Thanks for the patience with my noob knowledge of rom hacking.

    EDIT: Just remembered, SonED2 had a feature where you could inject code into your roms using the "run batch" option. One of the listed features was changing which acts you go to when you clear others. Would it just be as simple as this? I remember seeing something in there mentioning 4th acts, but I stopped using SonED2 because somethings just stopped working and were irreversibly messing up my roms (and SonLVL is just better, honestly. Far more intuitive). I can't check that now without jumping through a bunch of hoops, but if it sounds familiar at all, I hope it helps.
     
    Last edited: Sep 4, 2019
  12. Wafer

    Wafer

    Find me on Twitter instead Member
    255
    75
    28
    2. Looks as though you're hitting the tile limit. You could try "Delete unused" in chunks, blocks and then tiles to free up space, but be aware that you will lose art for the other acts in the zone, because SonLVL only deals with one act at a time. You'll also run into issues with objects that have art hardcoded to them, like moving platforms. The correct method is to start figuring out how to cram your content into VRAM. This is the reason that levels generally use a single art style, so that tiles can be reused to save VRAM. Adding an art style from a completely different zone that uses different tiles is a sure fire way to make a large increase on your VRAM usage. Honestly, starting a whole zone from scratch is easier than trying to cram new stuff into existing zones.

    3. Not a SonLVL question. Sonic 1 supports 4 acts per zone, but there's a whole bunch of places in the asm where they need to be hooked up. This guide is for the hivebrain asm and covers adding a whole new zone, so it's not all relevant to your task, but it should give you an idea where to look. At the very least, you'll need to enable it in the level order and (as you noted, SonEd had a function for this) and include your new act layout bin. I'm afraid I'm not super familiar with the S1 disassembly, so I can't give you specific advice on that.

    You didn't ask, but I'm gonna tell you: if you haven't already, start looking at some of the how-to guides, since you'll need to get acquainted with asm at the scope that you seem to want to work in. It doesn't matter if the guide doesn't cover something you want to do, the important thing is that you make an effort to understand the methods the guide is using. Along the way, you should hopefully gain some insight into how the S1 disassembly and Sonic engines in general are set up. Play around, make mistakes and learn from them.

    Lastly, questions about things that aren't covered in the SonLVL UI are probably better asked in the basic Q&A thread. SonLVL is mainly limited to art editing and object placement.
     
    Last edited: Sep 4, 2019
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    Actually, the "Delete unused" buttons should be completely safe now, as SonLVL will load the layout data for all acts in the Zone (assuming the INI was set up for it, which they should be). Object art can still be a problem, as well as animated art that's loaded to a specific location and will overwrite whatever was there before. You are correct in that Sonic 1 normally has a limit of 52 (hex) chunks, unless you rewrite the game to load them from ROM.
     
    • Informative Informative x 1
    • List
  14. The object I was trying to import was the floating platforms from MZ that sit in the lava and have grass on them. They sure don't seem animated to me, so it's probably a simple fix I can find on the site if I look around long enough (I've tried using the search before, it doesn't help much). I'll try the delete unused option and see how it goes. As for the fourth acts, my brother knows a bit of asm so I'll see if he can help me learn the flow of the code.
     
  15. Wafer

    Wafer

    Find me on Twitter instead Member
    255
    75
    28
    Okay, we were really covering point 2, but it seems like you're still focused on point 1. At the risk of backseat modding, I'll stress again that questions like this are more suited for the basic Q&A thread, if only so they get more exposure. We're really talking general methods and engine stuff as opposed to SonLVL specifics.

    Anyway, remember this?
    Assuming you're talking about object $2F or "Grassy Platform", it just so happens that object has art hardcoded to it. What I perhaps wasn't clear about is that the object has level art hardcoded to it. Your object doesn't know that it's in GHZ instead of MZ, so it's just loading the equivalent tiles from GHZ instead of MZ. You'll find this a lot in the Sonic games - if it looks like terrain, it's almost certainly using terrain art in order to save VRAM, meaning the tile ID in SonLVL is significant.

    But just for illustration's sake, let's make sure I'm on the money here. If we look in SonLVL INI Files\MZ\MovingPlatform.xml we see lines like this:

    Code (Text):
    1.   <Images>
    2.     <ImageFromMappings id="img1">
    3.       <ArtFile filename="LevelArt"/>
    4.       <MapFile type="ASM" filename="../_maps/MZ Large Grassy Platforms.asm" frame="0" startpal="2"/>
    So we know that if we look in _maps\MZ Large Grassy Platforms.asm we can see the mappings that tell us what tiles from the level art we use for the object (don't ask me the format of the mappings because I don't know and can't find a reference in less than a minute). So if you want the object to look right, you need to port over the tiles from MZ to GHZ using the same tile IDs.

    For the rest of this post I'm just guessing, so ignore me if I'm off-base.

    So, since you're wanting to use the fourth act and combine assets from two adjacent zones, it looks as though you're trying to make transition acts between each pair of zones. Neat!

    Without wanting to discourage you, there's a problem with your current approach. So far you want just one chunk and one object added into GHZ, and we've already hit the tile limit without even getting them working. Have a look at MZ chunk $09 and count the individual unique tiles. I started to, but it's already late and I lost count. Add on to that the fact that your object requires its art tiles to be in places already used by GHZ level art and the problem is compounded. We're only at the second zone, and we haven't started in on the palettes yet.

    The most straightforward approach I can suggest to solving this would be to familiarise yourself with asm to the point that you can add whole new zones with a single act each, with new tilesets that combine tiles from both the zones you're trying to transition. Another option would be to have the engine overwrite the level art and palettes on a per-act basis, again this is an asm solution. You'll also need to inventory the tiles (if any) used by each object you intend to use so that you can avoid clashes between adjacent zones, or else just avoid using objects with level art altogether. Also, you'll need to split your palettes to support both zones.

    To say that as a first hack this is ambitious would be to put it lightly, and so I say this: scale back your ambitions. It's a noble plan, but you're going to hit so many roadblocks that you risk losing interest. Start with something smaller, learn some asm and move on from there. What you're planning isn't impossible, but it's definitely not First Hack material.
     
    Last edited: Sep 5, 2019
  16. Yeah, no. I tried it, but it just destroyed the art and collision and I can't find a way to undo it (no, I didn't save, I made sure, but I can't figure out how to get my custom levels back to working order). So I'm wiping the slate clean, and taking a slower approach to this (but I'm not giving up!!).

    Yeah, I thought so. Glad you like it!

    As previously stated, my brother can help with this. He taught himself asm just by looking through game files (I guess it just comes naturally to some people)! He said he just needs to learn the patterns and language of the genesis games and we should be set!

    Yeah, this sounds more and more like a last idea to implement. I really just need the chunks and art at minimum. I don't need palettes though, I can make art edits if I need to, but it wasn't part of the initial plan.

    As I said before, I'm not giving up! But... it doesn't help that I have a fever while working on all of this. I'll ask the questions thread for advice on working with the github disassembly, but I appreciate everything you have shared with me here, and I'll be back if I have more SonLVL questions. ;)

    EDIT: Forgot to mention, I got a fourth act working in SonLVL's editor. No effort required! Thanks MainMemory!
     
  17. InvisibleUp

    InvisibleUp

    friendly internet ghost Member
    139
    13
    18
    Re: #1 and other garbled art, I'm not sure how familiar you are with how graphics in Sonic 1 work, so let's clarify that.

    The Mega Drive/Genesis has a fixed, rather small amount of video memory, or VRAM. This is normally packed very tightly, without a lot of room to add things. For instance, here's Green Hill Zone. It includes level art (the top third), badniks (the middle third), sprite attribute and background data (the garbled-looking bits), HUD stuff, Sonic, etc.

    What bits of art are loaded to what places in VRAM are stored by the game's engine in lists called Pattern Load Cues. You can see these lists in "_inc/Pattern Load Cues.asm" in the Git disasm. If you look at Green Hill Zone in particular, you get a list containing the level art, individual badniks, and larger gimmicks. To edit what gets loaded for the entire zone, you can add and remove entries from this list, so long as you have room in VRAM.

    A few caveats with that, though. First off is compression. You can't load only part of the graphics for something. It's all or nothing, unless you want to split up a large graphics file into several smaller files. Which is perfectly doable, but is a little bit of a pain.

    Secondly, you'd be editing the assignments for the whole zone. Fixing this is hard. You have a few options, none of which are particularly nice.
    1. You make a new zone for each transition stage (what Wafer was talking about) with unique art and/or pattern load cues
    2. You do some asm wizardry so that you can set art per-act (start at LevelHeaders.asm and work backwards)
    3. You would have to sacrifice some bits of art for the entire zone to make room for the few new assets you want in the final level.
    4. Create a dynamic level event (in DynamicLevelEvents.asm) that loads a given pattern load cue, overwriting what was there before. You'll want to place this during a one-way segment like an elevator or an S-tube. Make sure that you only load the art once!

    Thirdly, objects. Within the object code is a load into the object struct member `obGfx`. This will be the VRAM address of wherever that object's art is. If you move stuff around, you will have to change this address. (This is what Wafer was talking about.) If you have it in different locations per zone, you will have to check for that and set the VRAM address accordingly. If you're doing the dynamic level events thing, you better plan that out well.

    Hopefully that gets you steered into the right direction.

    EDIT: typos
     
  18. Thanks! I'm still sick, so I'm thinking about less brain-intensive things right now, but I can tell this is all useful!

    Yeah, this was my ultimate goal with this. Honestly, this actually sounds simpler than editing the stage art. My brother will probably know how to help me set this up. I assume you mean loading art from other areas in the game, and not just different art from the same place. Also, is it possible to set up the cue to load different art depending on which way you are moving when you trigger it (a la Sonic 3)?

    (Sorry if this is deviating too much from the SonLVL material).
     
  19. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    SonPLN is a new plane mappings editor, based on SonLVL. For those who don't know, plane mappings are used to store an arrangement of tiles to be displayed on one of the Megadrive's two scroll planes. Usually these are things that don't move much, like the title screen emblem, or the level select text.

    [​IMG]

    Features:
    • INI-based project file stores data for multiple sets of mappings in a single file, making switching between sets in the editor easy.
    • Based on SonLVL's foreground layout editor, includes ability to select and modify sections of the mappings all at once. Includes zoom and grid features.
    • Includes tile editor, palette editor, and import/export features from SonLVL.
    • Ability to resize the current mappings set (note: you will need to edit the ASM code to make the game load it correctly).
    Text Editing

    [​IMG]

    SonPLN features advanced text editing capabilities. Simply select an area you wish to edit by dragging with the right mouse button held, then right click inside the selection and choose "Edit Text". All the text in the selected area will be converted to strings, which you can then edit in the dialog shown above. All non-text tiles in the area will be blanked out, so be careful (it will warn you before doing so). SonPLN is capable of mapping more than just letters and numbers, as seen above, symbols are also available (only characters in the Unicode BMP (0000-FFFF)).
    To enable text editing, your mappings definition in the project file must declare a text mapping, which can be defined as a simple string in the textmap field for single-tile letters, or a path to a separate ini file in the textmapfile field for multi-tile letters.
    The simple format begins with a single character (A) or a pair of characters separated by a hyphen (A-Z) to indicate a range of characters, followed by an optional colon and a tile index in hex or decimal, and a pipe character to mark the end of one definition and the beginning of another. If the colon and index are omitted, the character will be assigned the index immediately following the previous character/range of characters.
    The complex format begins with specifications for the Height of all characters in the font and a DefaultWidth to be used if the characters don't override it. Then you begin defining the characters, starting with the character itself in brackets [A], followed by an optional Width, and definitions for all the tiles to be used in each row.
    Code (Text):
    1. Height=2
    2. DefaultWidth=2
    3. [A]
    4. Row1=1, 2
    5. Row2=3, 4
    6. [I]
    7. Width=1
    8. Row1=0xE
    9. Row2=0xF
    10. [.]
    11. Width=1
    12. Row1=0 ; all characters must be same height, so we put a blank tile here
    13. Row2=0x20
    Download
    You can download SonPLN from the SonLVL Updater, or on this page.
    Also, a project file for the Sonic 2 GitHub disassembly can be found... on the Sonic 2 disassembly GitHub!
     
    • Like Like x 4
    • Useful Useful x 2
    • List
  20. WhoWhatWhenWhale

    WhoWhatWhenWhale

    Member
    5
    0
    1
    Is there any way to force sonLVL to load uncompressed chunk and block mappings? I'm using a disassembly that seems to compress them on the fly, so all the map_16 and map_256 files aren't compressed.