Nifflas' Support Forum

Level Editing Support => Knytt Stories Level Editing Support => Topic started by: egomassive on July 03, 2010, 18:48:52

Title: Calculate the number of rooms in your level
Post by: egomassive on July 03, 2010, 18:48:52
KS level designers and players are forever interested in the number of screens in a level. Counting the rooms is tedious and prone to error. So, I decided to figure out a clever way of doing it.

*Warning* If you're not 100% confident in your computer skills, back up your level before proceeding.

Step 1: Decompress your map.bin file. It's found in your level's root folder. DO NOT alter the original file or you may lose your level. DO NOT re-compress the decompressed version. I use a free program called 7zip to do this. The resulting file is simply named "map" with no file extension.

Step 2: Find the number of bytes in the file. Megabytes and Kilobytes will not work. In Windows, right click and choose properties. Look for where it lists the file size in bytes. Ignore where it says size on disk. That's the wrong number.

Step 3: Subtract 10 then divide by 3020. Round off the answer and you have the number of screens on your map.
Spoiler: Technical Jargon (click to show/hide)

Step 4: Delete "map". DO NOT delete map.bin.

I hope this helps. I know it sounds complicated, but it'll be a huge time saver over counting large levels. By the way, this info comes from looking at actual levels and their files. I have never look at the KS source. I don't have the compiler for it, so I don't look.

Spoiler: Why this works (click to show/hide)
Title: Re: Calculate the number of rooms in your level
Post by: Dataflashsabot on July 03, 2010, 20:13:16
Pretty cool! I might make a program that does this automatically.
Title: Re: Calculate the number of rooms in your level
Post by: Miss Paula on July 03, 2010, 23:16:05
doesn't the thingy by xoft or whatever his name was (the level enhancement editor whatever thingamajig) count the number of screens?
Title: Re: Calculate the number of rooms in your level
Post by: Purple Pineapple on July 03, 2010, 23:33:31
Why are you so afraid of deleting your level? That's what the .bkup are for. :P
Title: Re: Calculate the number of rooms in your level
Post by: egomassive on July 04, 2010, 01:11:11
@Paula: I wouldn't be surprised if there is an editor or tool already out there that does this, but I don't have it. Nevertheless, people still count.

@Dataflashsabot: You should see if Paula's right before you invest the time.


Edit: @Paula and Dataflashabot: I installed Xoft's level composer (http://nifflas.lpchip.nl/index.php?topic=165.0) and it keeps a running count in the status bar at the bottom. So, I guess there's an even easier way to do this once you install his "xoftware."

@Pumpkin: I know about those. It only backs up what was done since the last time it was saved in the editor, so you could still lose some work. Its better to not destroy any of your own work. Also, I was testing other people's levels. I didn't have backups of them. (I'm really just protecting myself against angry designers who screw it up and blame me. Now, I can say, "Don't blame me. I told you of the dangers.")
Title: Re: Calculate the number of rooms in your level
Post by: Purple Pineapple on July 04, 2010, 01:48:50
It only backs up what was done since the last time it was saved in the editor, so you could still lose some work. Its better to not destroy any of your own work.
You just seemed extremely paranoid.
Title: Re: Calculate the number of rooms in your level
Post by: Pick Yer Poison on July 04, 2010, 04:21:29
@Pumpkin:

Odd, I don't seem to recall pumpkin or PumpkinBot posting in this topic. :P
Title: Re: Calculate the number of rooms in your level
Post by: AA on July 04, 2010, 09:41:18
I'd like to add that, other than from the variable length of the header (which depends on the name and author of the level), there may be another small error factor if the room coordinates of your level vary a lot. It's rarely the case that a level maker creates rooms in places other than near x1000y1000, but when they do, this affects the rooms' length by a few bytes. Of course it doesn't matter much, as the error margin is still negligible in any case.

Xoft's Level Composer parses the whole level before giving out the room count, so it's perfectly accurate.

Odd, I don't seem to recall pumpkin or PumpkinBot posting in this topic. :P

Bah! pumpkin, PumpkinBot, Purple Pineapple, Pick Yer Poison, they all start with P. Aren't they the same person anyway? XD
Title: Re: Calculate the number of rooms in your level
Post by: Purple Pineapple on July 04, 2010, 21:55:26
Aren't they the same person anyway? XD
Yes. I am. Right, Pick Yer Poison?
Title: Re: Calculate the number of rooms in your level
Post by: egomassive on July 05, 2010, 00:49:11
Sorry, P. and P.P. for confusing who I'm talking to. I think there's a naming scheme here I was unaware of when I signed up. I hope no one picks the name Poisonous Pineapplebot.

Anyway, there were discussions in two threads I was following about the trials of room counting. It will continue despite my efforts here and Xoft's efforts there. I recommend using Xoft's level composer for it's useful tools like room counting. I'm not sure about level editing with it yet, but that discussion doesn't belong in this thread.
Title: Re: Calculate the number of rooms in your level
Post by: Poisonous Pineapplebot on July 05, 2010, 10:10:00
*cough* *cough*
Spoiler: mods.... (click to show/hide)
Title: Re: Calculate the number of rooms in your level
Post by: Pick Yer Poison on July 05, 2010, 17:43:49
*cough* *cough*

Pfffffffffffbahahahahahahahaha

I actually laughed out loud at that. XD

And just to keep things on topic from my end, I think this is a great thing you've figured out here, egomassive. :D I'm going to go see if I counted the number of screens in Outer Reaches correctly right now. :3