Preventing access to content of game files (png, mp3, .ini)

Previous topic - Next topic

r0ber7

Yesterday I had a conversation with my musician. He asked about the possibility of "hiding" the mp3 files used in game from the user, so that they would be hard to find and we could release the soundtrack of the game seperately.

This has got me thinking. I'd thought about it before, because right now all my level files are simple .ini files and I'd rather not have the user edit them for obvious reasons. If possible, I'd also like to protect the png files from editing in some way.

I've thought of these possibilities:

1. Encryption.
All files could be encrypted in some way (basic XOR encryption would suffice). When a level gets loaded from the game, it could decrypt the appropriate files, write them down temporarily, and load them with LOADSOUND(), LOADANIM(), etc. While this would definitely work, it has drawbacks I'd rather not have:
- longer loading times (really don't like this)
- unnecessary writing to disk

2. Store everything in big files
All files could be appended to eachother, seperated by a marker so the game would know where to look for specific data. The game would load the file and seperate the data. But then, what to do? Do I write those to disk, so that I can load them with LOADSOUND() etc.? If so, there would still be writing to disk of large chunks which I'd like to avoid as much as possible. Or is there a way to use any of the READ() functions and then store that data in memory and somehow assign a sound index/ sprite index to it so I can use the data with DRAWANIM/PLAYSOUND etc.? That would be ideal.

3. Rename files
Lastly, I could just rename the files to things like vcxzvrsfds.bin, making it harder to find the data. But, this would mean:
- a lot of editing
- not so good a way of protection
- confusing myself

Thoughts? :)

theprotocol

Check out GLBasic's SETSHOEBOX command. There's a Shoebox utility bundled with GLBasic under the "Tools" menu as well.

This lets you put your data in a compressed "pack." GLBasic can read from it directly. This will work for any graphical and audio assets and interfaces with GLBasic's commands, like LoadBMP and Playmusic etc. I'm not sure how secure this is. I bet a determined user could figure out how to unpack the file.

r0ber7

 =D

Hahahaha, once again GLBasic surprises me. Best. Language. Ever.

theprotocol

Quote from: r0ber7 on 2012-Jun-14
=D

Hahahaha, once again GLBasic surprises me. Best. Language. Ever.

I'm not sure you can put your levels in it though, since the packs are more for media assets. Either way, it's best to encode your level files into binary, rather than plain ini files.

r0ber7

Quote from: theprotocol on 2012-Jun-14
Quote from: r0ber7 on 2012-Jun-14
=D

Hahahaha, once again GLBasic surprises me. Best. Language. Ever.

I'm not sure you can put your levels in it though, since the packs are more for media assets. Either way, it's best to encode your level files into binary, rather than plain ini files.

Ok, thanks. Will do the same for save states. That's no problem though. Loading the .ini files takes just a few ms, so the time it takes to decrypt those will be negligible.

spacefractal

Shoebox is no protection and is easy to unpack them again, and it's have some issues with some commands. There is no encryption in them.

Best if sound/music could load from memory (a pointer, blitzmax can so that), but not sure it's good idea on mobile, but would been more seamless player. Glbasic is not best for sound here.

for jungool, which I created music for, did not protect anything (I did not care of it at all). So here I simply taggede all files so I got credits when played in media player, but quality was made as game, and bitrate lower than normal anyway (96kbit still Sound Nice contra filesize).

For png files, you can scramble them which I did similar for greedy mouse. But for jpg, diddent mind.

For protection levels, do a chr32 check to detect if level have been modified or not or crypt your file.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

okee

There is software like:

VPacker
Supports a lot of Languages incl. Darkbasic, Purebasic, Blitzbasic
I don't think GLBasic is included but should be easy convert over
http://www.smartpacker.nl/vpacker.html

SmartPacker pro
This turns your application into a single executable
http://www.smartpacker.nl/smartpackerpro.html
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)