0

How to hide JS code

Hello everyone. I am making a simulator game and I have just added secret cheats. The cheats will give you free money or rewive you when the game is over, but I want to be the only one to know them. Problem is that when you play it on PC, you can press F12 and see JavaScript code. There you can easily figure out what do you need to do. You can find in in my code easily (JS, lines 180 - 331). And my queston is: Can I somehow disable ability to open source code from a broswer, or how can I at least hide cheat codes?

31st May 2018, 2:48 PM
Jan Štěch
Jan Štěch - avatar
5 odpowiedzi
+ 2
you could use a javascript obfuscator, but i‘m not sure which one is the best, since i mainly work on binary deobfuscation. don‘t use jsf*** because there is a tool called jsunf***. using an obfuscator will have a performace penalty
31st May 2018, 3:20 PM
Max
Max - avatar
+ 2
Hi Jan probably the simplest thing is just to minify the JavaScript, makes it hard to understand the code.
31st May 2018, 3:06 PM
Mike Choy
Mike Choy - avatar
31st May 2018, 2:50 PM
Jan Štěch
Jan Štěch - avatar
0
is it really a problem for other developers to cheat your game? most people online have never used f12.
31st May 2018, 3:26 PM
Logan
Logan - avatar
0
Thank you all for your answers. I changed numbers into codes like \x37\x35 and it works. It isn´t very good, but I hope some people aren´t smart enough to put /x away and subtract 30.
31st May 2018, 7:35 PM
Jan Štěch
Jan Štěch - avatar