Hi,
I started writing games via cocos2djs - it’s really great. The apps also need to be available via web.
So I published some first test versions, but couldn’t find a way to effectly obfuscate my code.
The official tutorial seems to be out-of-date. The mentioned “obfuscate.py” file does not exist in current versions.
I tested the online Closure Compiler Service, but it only works in simple mode. As far as I understood, the advanced mode needs to be configurated, so it knows what to exlude and so on.
Would be really great if some dev could describe how to get advanced obfuscating working. Many thanks in advance…
For obfuscating your javascript code to publish on web, you can simply use our cocos console tool. It can obfuscate all the engine code (only the modules you need) and your game code to a single js file using closure compiler. The command is:
cocos compile -p web -m release --advanced
advanced means closure compiler’s advanced mode, if no advanced specified, it will be compressed under simple mode.
I just tested it and both simple and advanced mode worked perfectly. Very easy to use!
Also thanks for the updated document/manual link. Looks like there’s some interesting stuff for me.
Somehow I missed it before…
Many suggest the usage of cocos compile -p android -m release from command line, I need to know if i could get the exact same result when running it from cocos code IDE v1.2.0? is it enabled by default? what is the type of obfuscation used?