gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > compressing level data?

#103367 - spinal_cord - Thu Sep 21, 2006 10:52 am

I am working on a game where I would like to share levels with other people worldwide (through a website rather than wifi networking) so I would like to have the level data as small as possible so people dont have to enter much into the ds.
my levels consist of a 22x16+1 (535) array with each value being between 0 and 23.
I have never done any sort of compression before, i was origionally going to use some sort of lookup table or different combinations of tiles, but that would take forever to calculate.

can anyone point my in the right direction? (or do it for me? :P)

thanks.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#103378 - PypeBros - Thu Sep 21, 2006 2:00 pm

you want to enter levels by hand, that's it? well, the only time i've seen something like that is in Worms, where the level was actually generated randomly (using some parameters) and where you could ask the comp. for the parameters it used to generate the terrain...

And that's fairly simple if everything is indeed coming from a simple (pseudo) random source: you just need to give the user the seed that has been used by the random generator. The same seed will always lead to the same (pseudo)-random sequence...

Now if you mean really hand-edited maps, the only thing you could do would be using some sort of RLE-compression so that you e.g. express your level as "N tiles of wall, then X tiles of open space, then M tiles of wall again ..." and let the user type "NXMzzXzMMNu"... etc. (which could be of variable length and probably too boring to encode).

What about just exchanging the map files on a web server and let your players load them on CF/SD medium, then just load the files from /usermap/* ?
_________________
SEDS: Sprite Edition on DS :: modplayer

#103569 - spinal_cord - Fri Sep 22, 2006 9:24 pm

i was thinking of having the levels as files on the cf card, but lots of people use different types of cart.
The was i was hoping it would work would be similar to polarium.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#103583 - Sausage Boy - Fri Sep 22, 2006 10:00 pm

It's a nice idea, but these maps are so big that the users will probably curse you many times for making them type in hundreds of letters and numbers, and probably ending up typing it in wrong and having to do it again.

The few devices you might not support using a file-based solution are not nearly enough for making all users suffer extreme pain.
_________________
"no offense, but this is the gayest game ever"

#103597 - josath - Fri Sep 22, 2006 11:01 pm

Sausage Boy wrote:
It's a nice idea, but these maps are so big that the users will probably curse you many times for making them type in hundreds of letters and numbers, and probably ending up typing it in wrong and having to do it again.

The few devices you might not support using a file-based solution are not nearly enough for making all users suffer extreme pain.


I agree...go with file support first. Then if enough people complain, or you feel nice, add support for SRAM. This should cover pretty much everyone. If someone has a weird device which doesn't support files OR SRAM, then they can't use most homebrew anyway, so no need to worry about them.

The reason Polarium can do it, is that their dataset is so small. Their levels are what, 20x20 at the biggest? And they only need to store 3 values (white,black,or empty). I'm not sure what format polarium uses, but lets assume base64 (64 bits per character)

20*20*2bits = 800 bits / base64 = 13 characters
in your case, 535 tiles * 5 bits = 2675 bits / base64 = 42 characters

I guess that's not terrible, but it still might be a bit annoying.

Now lets say you use base36 (only upper case characters, and 0-9), then it becomes 75 characters for your game.

and once they type in the custom level, wont you want to save them? and if you are going to support files or SRAM for saving, why not for loading in the first place?