SonLVL

Discussion in 'Utilities' started by MainMemory, Mar 29, 2011.

  1. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    I dunno, I like the automatically-detecting-dependencies idea, even if it doesn't support weird hacks the base game tries to get away with.

    Edit: Ninjas
     
  2. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    My particular hack makes it possible for each act in a level to use different chunks, blocks, tiles, etc. sort of like S3K does. I abuse this to essentially make new zones (act 2 of HPZ is my hub world, for example). Part of my fear is that the feature might assume that both acts are linked.

    I guess that's silly though, since it would likely be easier to detect if the .ini file has two or more act definitions with identical chunk files. I just like to have more control over things, but I'm fine with such a feature being automatic as long as the automatic selection works properly.
     
  3. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Again, SonLVL has no idea what zones or acts are, and trying to autodetect that is a really bad idea. It would just detect any levels that share the same chunk list, so for example GHZ1 would load the layouts of GHZ2, GHZ3 and the ending, while AIZ1 wouldn't open any other layouts.
     
    Pacca likes this.
  4. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    I've updated SonLVL with the ability to automatically load additional layout files from other levels that share the same layout format and chunk list, so now you can add/delete/reorder chunks without breaking other levels' layouts.
     
  5. StephenUK

    StephenUK Working on a Quackshot disassembly Member

    Joined:
    Aug 5, 2007
    Messages:
    1,026
    I've finally had chance to try this out, and the new layout is a significant improvement and is very easy to use. Once again, thanks for taking the time to implement this change, it's helped me out immensely.

    In terms of adding features, is it possible you could add options on the pop up menu to delete all tiles / blocks / chunks and an option to add to the relevant lists by a specified amount rather than one at a time. Being able to add and clear in bulk will be a great addition and a huge time saver.
     
    ArcaniaCQ likes this.
  6. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Personally, when I need to do that, I simply delete the files in question. Sonlvl generates new blank files for tiles/blocks/chunks/layouts when it cant find them. As for adding in bulk, I guess that's something Sonlvl lacks for now. I usually just replace files with ones from another level or copy paste the few bits I need. I don't have too much experience with these things, but the work around I talked about makes clearing data easy.

    Edit: You can use the image importer to add multiple chunks at a time, but you need to setup collision, and the feature can be a little weird at times (for example, it can accidently use different palette lines with the same colors)
     
  7. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    Hey MainMemory, did you add some sort of check to SonLVL for loading acts titled [Green Hill Zone Act 1] in the .ini lately?

    I was racking my brain for ages trying to figure out why SonLVL all of a sudden started throwing a "Serialization Exception" whenever I tried to load the version of GHZ1 in my hack. When I copy pasted the contents of another act that loaded fine over the GHZ1 entry it still threw the exception, and that kinda lead me to trying renaming the act, and it started working fine.

    Just a really weird bug, that I've sorted out now, so it's no longer an issue for me.


    Error log in case you care, it seems to be related to the fact I'm using the Sonic 3 object format:
    Operating system: Microsoft Windows NT 6.2.9200.0
    Opening INI file "D:\Sonic\s1mv\Sonic 1 SVN INIs\S1LVL.ini"...
    Game type is S1.
    Loading Green Hill Zone Act 1...
    Loading 8x8 tiles from file "../artkos/8x8 - GHZ.kos", using compression Kosinski...
    Loading 16x16 blocks from file "../map16/ghz.bin", using compression Enigma...
    Loading 128x128 chunks from file "../map256/GHZ.bin", using compression Kosinski...
    Loading layout from file "../levels/ghz1.bin", using compression Uncompressed...
    Loading layout from file "../levels/ghz2.bin", using compression Uncompressed...
    Loading layout from file "../levels/ghz3.bin", using compression Uncompressed...
    Loading layout from file "../levels/ending.bin", using compression Uncompressed...
    Loading palette file "../palette/Sonic.bin"...
    Source: 0 Destination: 0 Length: 16
    Loading palette file "../palette/Green Hill Zone.bin"...
    Source: 0 Destination: 16 Length: 48
    Loading object definition file "obj.ini".
    Loading object definition file "obj128.ini".
    Loading object definition file "objGHZ.ini".
    Loading ObjectDefinition type S1ObjectDefinitions.Common.Ring from "Common\Ring.cs"...
    Loading type from cached assembly "dllcache\S1ObjectDefinitions.Common.Ring.dll"...
    Loading ObjectDefinition type S1ObjectDefinitions.Common.InvisibleBlock from "Common\InvisibleBlock.cs"...
    Loading type from cached assembly "dllcache\S1ObjectDefinitions.Common.InvisibleBlock.dll"...
    Loading ObjectDefinition type S12005ObjectDefinitions.Common.PathSwapper from "Common\PathSwapper.cs"...
    Loading type from cached assembly "dllcache\S12005ObjectDefinitions.Common.PathSwapper.dll"...
    Loading ObjectDefinition type S1ObjectDefinitions.GHZ.Bridge from "GHZ\Bridge.cs"...
    Loading type from cached assembly "dllcache\S1ObjectDefinitions.GHZ.Bridge.dll"...
    Loading ObjectDefinition type S1ObjectDefinitions.GHZ.SwingingPlatform from "GHZ\SwingingPlatform.cs"...
    Loading type from cached assembly "dllcache\S1ObjectDefinitions.GHZ.SwingingPlatform.dll"...
    Loading objects from file "../objpos/ghz1.bin", using compression Uncompressed...
    Loading start position "Level Start" from file "../misc/Start Location Array - Levels.bin"...
    Error loading start position definition Level Start:
    System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at SonicRetro.SonLVL.API.MappingsTile..ctor(Byte[] file, Int32 address, EngineVersion version) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVLAPI\DataTypes.cs:line 1170
    at SonicRetro.SonLVL.API.MappingsFrame..ctor(Byte[] file, Int32 address, EngineVersion version, String name) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVLAPI\DataTypes.cs:line 1299
    at SonicRetro.SonLVL.API.MappingsFrame.Load(Byte[] file, EngineVersion version, Dictionary`2 labels) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVLAPI\DataTypes.cs:line 1271
    at SonicRetro.SonLVL.API.ObjectHelper.MapDPLCToBmp(Byte[] artfile, Byte[] mapfile, EngineVersion mapversion, Byte[] dplc, EngineVersion dplcversion, Int32 frame, Int32 startpal) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVLAPI\ObjectHelper.cs:line 62
    at SonicRetro.SonLVL.API.ObjectHelper.MapASMDPLCToBmp(Byte[] artfile, String mapfileloc, EngineVersion mapversion, String dplcloc, EngineVersion dplcversion, Int32 frame, Int32 startpal) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVLAPI\ObjectHelper.cs:line 97
    at SonicRetro.SonLVL.API.StartPositionDefinition..ctor(ObjectData data, String name) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVLAPI\ObjectDefinition.cs:line 1338
    Drawing block bitmaps...
    Drawing chunk bitmaps...
    Load completed.
    System.Runtime.Serialization.SerializationException: Unable to load type SonicRetro.SonLVL.API.S3KObjectEntry required for deserialization.
    at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)
    at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder holder)
    at System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj, MemberInfo member, Int32[] arrayIndex)
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord pr)
    at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
    at SonicRetro.SonLVL.GUI.MainForm.backgroundLevelLoader_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) in c:\Users\Mike\Documents\GitHub\nonworking\SonLVL\SonLVL\MainForm.cs:line 765
     
  8. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    No, it's your saved layout sections. I moved S3KObjectEntry to SonicRetro.SonLVL.API.S3K.S3KObjectEntry, to match the other types when I added support for custom object formats, but your saved layout sections were trying to load the type by its old name, so it crashed.

    Just delete all the sls files in the SonLVL folder.
     
  9. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    oh, interesting, i think i only used the layout section feature once, to see how it worked, then never again, whoops :p

    e : sorry if i seem a bit flippant, thanks for the explanation
     
    Last edited: Aug 20, 2016
  10. FireRat

    FireRat Do Not Interact With This User, Anywhere!!! Exiled

    Joined:
    Oct 31, 2009
    Messages:
    535
    Is it possible to select multiple 16x16 blocks, and invert their Priority flag all at once?
     
  11. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Editing multiple blocks at once is not currently supported.
     
    FireRat likes this.
  12. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    I've thought of an idea for the FG/BG editors that could make using the editor a lot more fluid, but would also be a bit of a difficult transition, as it's radically different from how things work now and from any other program I've used: merging the "Draw" and "Select" modes.

    The controls would work like this:
    Left click, Hold left and drag: draw with current chunk.
    Double left click: toggle loop flag (where applicable).
    Right click: grab current chunk.
    Hold right and drag: select an area.
    Right click in selection: display context menu.

    If anyone's interested, I could make a test build.
     
    Clownacy, Pacca and NiphFM like this.
  13. StephenUK

    StephenUK Working on a Quackshot disassembly Member

    Joined:
    Aug 5, 2007
    Messages:
    1,026
    I'm interested in seeing a build like that to see how it works, could be quite useful. Any thoughts regarding my suggestion of an option on the context menu for adding in multiple blank tiles at once rather than one at a time?
     
  14. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    MainMemory, can you improve the tool to import art more easily, without change the tile's palette line by hand?
    And also,improve the block/tile/chunk importing, by importe multiple art at the same time instead of one by one? :)
     
  15. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    You already can import multiple chunks/blocks/tiles at the same time. Just make an image large enough to fit multiples and SonLVL will import all of them. You can even import a whole level layout.

    I don't understand what you mean by changing the tile's palette line by hand though. If you import a 1bpp or 4bpp image, SonLVL will assign the tiles to whatever palette line is selected in the palette editor; if you import an 8bpp image, SonLVL will use the indexes to determine which palette lines to use; if you import any other type of image, SonLVL will match each tile to the best fitting palette in the level.
     
    FireRat likes this.
  16. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Oh, I did not even know it!
    Thanks
     
  17. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
  18. LuigiXHero

    LuigiXHero Well-Known Member Member

    Joined:
    Mar 22, 2014
    Messages:
    280
    It doesn't seem as radically different as you let on, it just feels more streamlined. Overall I like it.

    Edit: A thing I don't really care much for is that you cannot move your cursor back over already selected areas to unselect them. So if you accidentally selected something you don't want you have to start over.
     
    Last edited: Aug 30, 2016
  19. LooneyDude

    LooneyDude Back after a long absence! Member

    Joined:
    Feb 1, 2014
    Messages:
    277
    Location:
    EVERYWHERE
    After not using SonLVL for a while, I decided to pick it back up, but noticed 256x256, 16x16, and 8x8 block editing was all in one room, and even after trying it for a few days, still couldnt get the hang of it. Do you think you could add the option to have the different sections for editing them?
     
  20. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    LuigiXHero: would you prefer to just have it start a new selection every time?

    LooneyDude: No. This is why I waited so long before doing it and asked for people's opinions, I can't have it both ways without turning the thing into a huge unmaintainable mess.