mspraggs / potentia

Southampton Game Jam 2015
0 stars 0 forks source link

Better asset management #16

Open mspraggs opened 9 years ago

mspraggs commented 9 years ago

Following from the refactorisation issue, I think this deserves it's own issue, since it'll probably be one of the more straightforward things to implement.

One idea I did have for the rooms is this. The char type is basically just an integer that can run from -128 to 127 (or 0 to 255 if unsigned). So, I thought a good way to obfuscate the level files would be to run through each room file, take the numeric value for the chars, cast them to integers, then write those out to file as binary data, combining all the levels together in the process. The disadvantage of this would be that the files would end up four times larger than they need to be.

mspraggs commented 9 years ago

Another alternative would be subtracting the char numeric value from 256 before writing to file.

DivFord commented 9 years ago

What if we convert them to signed chars? That's listed as an integer type, but is still only 8 bits. Thought to be fair, the file size is so small this may not matter anyway...

mspraggs commented 9 years ago

Or alternatively xoring the char value with some integer value.

mspraggs commented 9 years ago

I think whether the variable is signed or not only affects its behaviour in the program. It'll still be stored as the same string of bits.

DivFord commented 9 years ago

If we remove line-breaks and write to binary, isn't that enough obfuscation?

If you add this, would it be possible to include notation for optional blocks as well? eg. {*D} would give either rock or dirt.

mspraggs commented 9 years ago

Is the point of compiling the room files into the binary to prevent the user from altering them, or is it to make the game completely self-contained? If the latter then it doesn't really matter if the user can see the way the level files are encoded or not.

If it's just about ensuring the levels are part of the compiled game, then it would be pretty straightforward to write a Python script to generate a header file for the levels.

DivFord commented 9 years ago

I think it's to make it self-contained. If they want to break their game, let them :P

mspraggs commented 9 years ago

Ok I've written a Python script that'll generate a header file with the game strings in it. I've also written a Room command that generates the blocks from a string, but I need to test as it was segfaulting when I tried it yesterday evening.

mspraggs commented 9 years ago

Ok I've implemented all this, checked it and uploaded my changes

DivFord commented 9 years ago

Is this all finished now?

I've proposed a new notation scheme in the design folder, but that should probably be a new thread.

mspraggs commented 9 years ago

I think we still need some way of integrating the sprite sheets into the executable file if I remember correctly. Otherwise yes, the level files are now incorporated into the binary file.

DivFord commented 9 years ago

At some point, yes, but can I ask that we delay that for a while? It's much easier to test out new art if I don't have to make the game each time.