Forum Logo Welcome, Guest. Please login or register.
Did you miss your activation email?
November 16, 2018, 15:48:58 | See new unread posts
Home Help Search Arcade Chat Login Register

nifflas.ni2.se  |  Nifflas' Support Forum  |  Level Editing Support  |  Knytt Stories Level Editing Support  |  Topic: Utility to count screens in KS levels « previous next »
Pages: [1] Print
Author Topic: Utility to count screens in KS levels  (Read 3155 times)
Vegetal Gibber


Total My honestly gotten stars: 140
Offline Offline


Sorry excuse for a game designer


View Profile WWW
« on: January 08, 2016, 18:29:49 »

I cooked up this really simple, really badly coded program to help me count the number of screens in my levels. It's not exactly an elegant solution to the problem, but I thought it might be helpful to other authors, so I decided to release it here.

[ Download KSMapSize utility ]

To use it, just unpack the ZIP file to any folder you want, then drag'n'drop the Map.bin file of your KS level onto the "ksmapsize" executable (you can also create a desktop shortcut to the program and use that instead). A console window should pop up and tell you the number of screens in that level.

Obligatory disclaimer: This program is released "as is", be careful and use it under your own responsibilty, yada yada, blah blah, etcetera etcetera. You know the drill.
Logged

Some KS levels by me:
Vegetal Gibber


Total My honestly gotten stars: 140
Offline Offline


Sorry excuse for a game designer


View Profile WWW
« Reply #1 on: February 22, 2016, 15:52:24 »

UPDATE! I found a strange issue with a few levels that causes this tool to report an incorrect (and really huge) number of screens on them. The best example of this is egomassive's Customnibus, which reports a whopping 7970 screens despite having only 4 filled rooms. Apparently, there's an undiscovered bug in the original KS level editor that causes some levels to have their Map.bin file filled with useless null data, which increases the uncompressed map file size by A LOT (about ~30MB in some cases!). If you use this tool on your own level and get an unexpectedly large number of screens (i.e, more than 1000 in a small level), it's very likely that your level is affected and has a big chunk of null data inside the Map.bin file.

This is basically harmless and won't prevent you from playing those levels and/or keep editing them, so you can just ignore it. Also, the GZ compression that KS uses for the Map.bin file pretty much cancels the increase in data size, which is why you don't end with a +30MB level folder and probably never notice this is happening internally. However, while this doesn't damage the actual level data in any way, some third party tools (like this screen-counting tool and KSLC) will report incorrect values and/or have trouble opening these levels. I'm thinking of updating this tool and including a simple check that will detect this error and ask you if you want to generate a fixed Map.bin file. I could also produce a standalone small tool just for that.

Edit: Just to be completely clear, this is not something caused by this tool :P2 If you get an incorrect (and absurdly high) number of screens when using the program on a level, it means the Map.bin file *already* had this issue from the start.
« Last Edit: February 22, 2016, 21:29:53 by Vegetal Gibber » Logged

Some KS levels by me:
sergiocornaga
Beta Tester


Total My honestly gotten stars: 129
Offline Offline





View Profile WWW
« Reply #2 on: February 23, 2016, 03:10:45 »

I'm thinking of updating this tool and including a simple check that will detect this error and ask you if you want to generate a fixed Map.bin file. I could also produce a standalone small tool just for that.

I'm a big fan of destroying null data, so I'll look forward to this! Do you think it's something I could run on the entire Worlds folder to save a paltry amount of hard drive space?
Logged
egomassive


Total My honestly gotten stars: 232
Offline Offline



View Profile WWW
« Reply #3 on: February 23, 2016, 10:43:20 »

I was curious to see if Level Composer could fix Customnibus. Once upon a time it salvaged a world that would no longer load correctly in KS or Loki's level editor. To my surprise, KSLC showed the huge room count, but otherwise didn't work with the level at all. On rare occasion I use KSLC to copy large sections of maps. If this tool can fix corrupted map files so they can once again work with KSLC, then it may prove useful one day.
Logged
Vegetal Gibber


Total My honestly gotten stars: 140
Offline Offline


Sorry excuse for a game designer


View Profile WWW
« Reply #4 on: February 23, 2016, 16:30:23 »

@sergio: Well, since it's a command line program, I can make it so you can use it inside a FOR loop and process all the Map.bin files inside the Worlds folder recursively. However, you probably won't free any noticeable amount of drive space, because only a few levels are affected by this (so far, I've only seen this issue in some of ego's and farik's levels, and also in "Remembrance" by Si). Moreover, the Map.bin files are already compressed with GZIP, which pretty much nullifies the huge increase in size of the raw data (the garbage data is just a lot of 00 bytes, so the compression ratio is incredibly high). The only real benefits to fixing a bugged level are making it work properly with third party tools and a slight improvement on the loading times.

@egomassive: As a matter of fact, removing the garbage data from the affected levels does make them work again with KSLC :)  I can send you a fixed version of the level if you want.
« Last Edit: February 23, 2016, 16:32:04 by Vegetal Gibber » Logged

Some KS levels by me:
egomassive


Total My honestly gotten stars: 232
Offline Offline



View Profile WWW
« Reply #5 on: February 24, 2016, 05:44:16 »

I don't need to do any editing on my old levels. I was thinking of TToK. My temples in that game have full duplicate versions, so I use KSLC to make the copies. Though, if it became corrupted I could get a hex editor and clean it myself if I had to.
Logged
Pages: [1] Print 
nifflas.ni2.se  |  Nifflas' Support Forum  |  Level Editing Support  |  Knytt Stories Level Editing Support  |  Topic: Utility to count screens in KS levels « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines