SFML community forums
Help => System => Topic started by: Dennis on December 01, 2016, 08:36:04 pm
-
I don't want people to see all photo's and data files of the game. because they can cheat and its annoying to send them all one by one. i can put them in a winrar file but not everyone has winrar. so is there a way i can put all
files in the exe file?
-
every windows computer can extract .zip files
I'm sure every mac and linux can too
if your game is worth cheating then people are going to cheat
they'll just use cheatengine or something else
putting everything an exe would make it huge
if its even possible
how would you do character saves ?
-
Images (etc.) are usually pretty easy (to some extent) to "rip" regardless of security steps.
Storing each file separately isn't the worst thing ever.
That said, you could "pack" them into a single file (it doesn't have to be compressed) by just having them all concatenated.
It is possible to build resources into the executable file. There are a few ways to do this depending on the operating system. One way is to convert your resource file into a series of comma separated values and add them to a header file as a const object. Note this may slow down your build.
-
A lot of games use custom data containers to obfuscate assets, which wouldn't be hard to implement, and would be enough to deter most. For a small dataset I'd use a simple format of [id, filesize, data] for each asset, then concatenate. You'd reference the assets in your code by id, load the entire dataset upon loading, find the asset you require with a simple linear search, and call for example texture.loadFromMemory() instead of texture.loadFromFile. For bigger projects you may want to separate the data from the metadata, to allow loading the data only when needed (and fancier things like binary-search). A helper tool to create the container from a directory would be recommended to ease asset updates.
A step beyond that would be encrypting the file so that the assets couldn't be retrieved with file dump tools (so they'd need to dump the files from memory), but that seems like overkill on what may already be overkill.