DSO and bitmap file encryption
by Samme Ng · in Torque Game Engine · 11/30/2004 (6:37 pm) · 21 replies
As our game going to gold, I would like to ask if there is existing method to encrypt the DSO and all bitmap (PNG/BMP/JPG) so the user cannot alter/read those files easily.
I know the DSO already encoded, but the text string will keep in the DSO and I want it is a non-readable format.
Also, I don't want those PNG/BMP/JPG file being read or modified by user and would like to have a encoded format, do you think there are any support from TGE?
Thx.
I know the DSO already encoded, but the text string will keep in the DSO and I want it is a non-readable format.
Also, I don't want those PNG/BMP/JPG file being read or modified by user and would like to have a encoded format, do you think there are any support from TGE?
Thx.
#2
12/01/2004 (7:03 am)
Obfusication is probably easier and more efficient performance-wise than encryption.... rename all your jpgs to dsos and dsos to jpgs? Afterall, it's just to stop the casual busybody.
#3
As has been said time and time again, there is no way to absolutely secure anything you deliver to the client (as long as it works anyway) from a determined cracker, so you're ultimately just weeding out the casual people that might play around with things and break them. With this in mind, you need to accurately determine what your goals are with encryption or obfuscation, and implement accordingly.
12/01/2004 (7:15 am)
I tend to agree with Eugene--once we get near the release point (years from now) we will probably run an obfuscator algorithm on both script/art file names, as well as on function names.As has been said time and time again, there is no way to absolutely secure anything you deliver to the client (as long as it works anyway) from a determined cracker, so you're ultimately just weeding out the casual people that might play around with things and break them. With this in mind, you need to accurately determine what your goals are with encryption or obfuscation, and implement accordingly.
#4
12/01/2004 (7:24 am)
There is a good bit of zip encryption in TGE. I've been meaning to clean up the source for this and submit it as a resource but have yet to do it. Maybe I should start now.
#5
Basically I not intented to avoid cracker or expert to explore the game's data, as it is no easy to do that.
Putting all file into ZIP is work, but in my game, it is only work to group all .dso. Since it is a MMOG, and images, which is sometime large, it is not a good idea to patch all of the images file (if they are in the same ZIP) everytime some changes in one of the file.
At last, I would like to know if .MIS can be changed to .DSO, since I didn't found a DSO in mission folder. The root's main.cs also can't be a DSO.
12/01/2004 (7:29 am)
Thanks for all of the advise.Basically I not intented to avoid cracker or expert to explore the game's data, as it is no easy to do that.
Putting all file into ZIP is work, but in my game, it is only work to group all .dso. Since it is a MMOG, and images, which is sometime large, it is not a good idea to patch all of the images file (if they are in the same ZIP) everytime some changes in one of the file.
At last, I would like to know if .MIS can be changed to .DSO, since I didn't found a DSO in mission folder. The root's main.cs also can't be a DSO.
#6
Take a look at my BOR V1.07 demo from www.inoculousgames.com and tell me if what I've done is something close to what you're looking for.
12/01/2004 (7:38 am)
Samme,Take a look at my BOR V1.07 demo from www.inoculousgames.com and tell me if what I've done is something close to what you're looking for.
#7
EDIT: Whoops! Guess I should say, "didn't know you had already released!"
12/01/2004 (7:43 am)
@Akio: Congrats man, didn't realize you were so close to release! (just looked at your web page).EDIT: Whoops! Guess I should say, "didn't know you had already released!"
#8
I only need to consider how to add addition images/data while the game update......
12/01/2004 (7:50 am)
@Akio: Yes, your method is closed to my idea. I know it is possible to use ZIP but not really know it can passing the password to open the password-protected ZIP.I only need to consider how to add addition images/data while the game update......
#9
@Samme: When you speak of additional images/data, are you talking about something like add on packs?
12/01/2004 (7:57 am)
@Stephen: thanks. It's my first game and has been released for a month now. Sales are moderate but should get better as I gain more experience.@Samme: When you speak of additional images/data, are you talking about something like add on packs?
#10
12/01/2004 (8:05 am)
@Akio:Normally, a MMOG need to be updated regularly, new character images/texture, sprite data, GUIs, maps, etc.
#11
1) in main.cs file (my demo has no main.cs file but it's compiled into .exe as a string file, hence, the strings around the paths shown below) you can add additional directories for future updates, e.g.
2) Then for each trackpack that I release, it will contain a zip file of the pack directory. What's important here is you add a main.cs file for each pack. My trackPack0 main.cs is shown below:
3) Somewhere in your main release should contain a script that will look for these packs.
12/01/2004 (8:17 am)
I think I understand what you're after, and I'll describe how I implemented add on packs in my game and maybe you can adopt a similar method.1) in main.cs file (my demo has no main.cs file but it's compiled into .exe as a string file, hence, the strings around the paths shown below) you can add additional directories for future updates, e.g.
"$modPath = pushback($userMods, $baseMods, \";\"); \n" \ "$modPath = pushback($modPath, \"trackpack0\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackpack1\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackPack2\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackPack3\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackPack4\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackPack5\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackpack6\", \";\"); \n" \ "$modPath = pushback($modPath, \"trackpack7\", \";\"); \n" \ "echo(\"setModPaths=\" @ $modPath); \n" \ "setModPaths($modPath); \n" \
2) Then for each trackpack that I release, it will contain a zip file of the pack directory. What's important here is you add a main.cs file for each pack. My trackPack0 main.cs is shown below:
package TrackPack0 {
function onStart()
{
Parent::onStart();
echo("\n--------- Initializing trackPack0 ---------");
}
function trackInfo()
{
echo("track Pack 0");
}
function onExit()
{
Parent::onExit();
echo("\n--------- Exit trackPack0 ---------");
}
}; // track package
activatePackage(TrackPack0);3) Somewhere in your main release should contain a script that will look for these packs.
#12
For the additional data, I think it is not the same as add on packs, since those additional data is just seperate files, no much relation (e.g. adding one texture for a newly created enemy in the game server and a new client system using some GUI/texture).
Thank you for your advise and I hope I can ask you some question regarding releasing the game to public.
12/01/2004 (8:33 am)
@Akio:So you put the whole main.cs as strings inside the exe, I think it is a good idea.For the additional data, I think it is not the same as add on packs, since those additional data is just seperate files, no much relation (e.g. adding one texture for a newly created enemy in the game server and a new client system using some GUI/texture).
Thank you for your advise and I hope I can ask you some question regarding releasing the game to public.
#13
Yes, I didn't think what I proposed really fit your needs, but the implementation sounds interesting. Maybe you can share that with us in the future.
As far as including the main.cs file as a string, here is additional info that may help:
I created a file called maincs.h file, and it starts out as:
Then I modified the [engine/game/main.cc] file.
I hope this helps.
12/01/2004 (8:49 am)
Samme,Yes, I didn't think what I proposed really fit your needs, but the implementation sounds interesting. Maybe you can share that with us in the future.
As far as including the main.cs file as a string, here is additional info that may help:
I created a file called maincs.h file, and it starts out as:
const char maincsfile[]= \ "$baseMods = \"common\"; \n" \ "$userMods = \"game\"; \n" \ "$displayHelp = false; \n" \ . . .Take a look at your main.cs file and you'll see something similar.
Then I modified the [engine/game/main.cc] file.
#include "maincs.h"
// Executes an entry script; can be controlled by command-line options.
bool runEntryScript (int argc, const char **argv)
{
// Executes an entry script file. This is "main.cs"
// by default, but any file name (with no whitespace
// in it) may be run if it is specified as the first
// command-line parameter. The script used, default
// or otherwise, is not compiled and is loaded here
// directly because the resource system restricts
// access to the "root" directory.
Con::executef(2, "eval", maincsfile);
return true;
}I hope this helps.
#14
Also, if you do it correctly, it won't be *that* easy to break. Nothing is secure as long as someone has access to it, but you could just do some simple key-encryption and store the key in different variables in the executable, then combine them in different ways for the different file types. For example
Say you have 32-bit encryption. So you have 4 8-bit variables which define the key.
key1 = v1 | v2 << 8 | v3 << 16 | v4 |24;
key2 = v2 | v3 << 8 | v4 << 16 | v1 << 24;
Or something like that. You need to decide how secure you want it, and how much time you are willing to spend on it.
12/01/2004 (9:02 am)
This would be pretty easy to add, really. Just grab one of the numerous encryption libraries, or do some kind of simple bit-twiddling thing (XOR or something, I don't know) before it loads the file and you will be fine.Also, if you do it correctly, it won't be *that* easy to break. Nothing is secure as long as someone has access to it, but you could just do some simple key-encryption and store the key in different variables in the executable, then combine them in different ways for the different file types. For example
Say you have 32-bit encryption. So you have 4 8-bit variables which define the key.
key1 = v1 | v2 << 8 | v3 << 16 | v4 |24;
key2 = v2 | v3 << 8 | v4 << 16 | v1 << 24;
Or something like that. You need to decide how secure you want it, and how much time you are willing to spend on it.
#16
For other things, I found that you have compress the common folder into ZIP with password, however, is it required a change in TGE to work?
12/01/2004 (6:44 pm)
@Akio:Thanks for sharing the cheat to main.cs, I have added it works!For other things, I found that you have compress the common folder into ZIP with password, however, is it required a change in TGE to work?
#17
Yes, there are some changes required in the head to make this work. I've been meaning to clean up what I have and submit it as a resource, but I'm currently swamped and also have minor crisis with animation exports to work on that right now. I can start working on it as soon as I get this problem resolved.
I hope you're not in a rush.
12/01/2004 (10:45 pm)
Samme,Yes, there are some changes required in the head to make this work. I've been meaning to clean up what I have and submit it as a resource, but I'm currently swamped and also have minor crisis with animation exports to work on that right now. I can start working on it as soon as I get this problem resolved.
I hope you're not in a rush.
#19
If you have free time, maybe I can I send the files to you directly and have you test it. Otherwise, I'll have to merge what I have back into TGE release 1.3 and test it when I have time.
Let me know.
12/02/2004 (8:57 am)
Samme,If you have free time, maybe I can I send the files to you directly and have you test it. Otherwise, I'll have to merge what I have back into TGE release 1.3 and test it when I have time.
Let me know.
#20
It is great if you can send to me. I will try to merge to our TGE version. ^^
Thanks!
12/02/2004 (4:05 pm)
Akio,It is great if you can send to me. I will try to merge to our TGE version. ^^
Thanks!
Torque Owner Mz
It wouldn't be especially difficult to code yourself, I s'pose, just realize it won't stop anyone with decent computer skills.
Or an internet connection and a search engine, once one person with decent computer skills penetrates your security. :)