why not just use something like AES-256 and encrypt it?
Encryption is on my list of options... obfuscating the source was the lazy option. Seeing as it is apparently very easy to reverse the obfuscated code, I'll be looking at encryption again.
Umm, Return 0, you still haven't answered the question many have asked:
Why do you care about obfuscating/encrypting your code? Why do you want to publish your code at all, if it will be obfuscated? Just keep it to yourself!
[Edit]: Of course, publishing the binaries is as safe as encryption/obfuscation, so you can still sell your product.
Maybe I'm going about this the wrong way. To clarify, I want to make it impossible for someone to decompile my engine/game. What would be the best option? I've never attempted this so I have no clue. I realize that even decompiling my exe will not result in the same code I wrote and is more likely to produce a representation in assembly.
Decompiling your .exe in a human-readable/comprehensible form will be as hard as writing your program from scratch (not to put down your work here: decompiling/disassembling code in human readable form is *VERY* hard).
In other words, no need to worry about it: if you don't publish your code, noone will find out your trade just by looking at your .exe.
not to put down your work here: decompiling/disassembling code in human readable form is *VERY* hard).
Not at all. Honestly I didn't know if this was something I should worry about, but based on everyone's feedback it appears it may not be an issue. The full source will never be available as this is not a personal project, but the engine its self and some tools will be... eventually.
Good luck with it. Are you planning on selling it?
At some point I plan to, starting with the rpg I'm working on, followed by the engine. I've been thinking about providing a weaker version of the engine for free at some point maybe with some game scripting language (gamemonkey, etc...) or just plain old lua... we'll see how it goes. We're not talking unreal engine quality obviously :), but it'll be fairly decent with a robust tool set.
The obfuscation techniques listed in Bazzys post won't even change the binary and titon is right in what he said about decompilation: It doesn't nearly work as you imagine. The control structures in C++ are very abstract and there are many ways compilers can implement them in the binaries, often, it isn't even theoretically possible to tell what control structure a specific piece of binary code originated from.
Now imagine a C++ code where:
- Control structures are randomly replaced with others
- All names of identifiers are lost
- Everything in a single code file
- Functions aren't in classes anymore, attributes become variables
- Functions may be inlined
- Namespaces, interfaces etc. are totally lost
- ...