Hiding "game.js"

Is it possible to hide the game logic from a user who attempts to read my .js files with something like Chrome developer console? From a paranoid standpoint, doesn’t that make stealing people’s browser-based games very easy?

You could run it through minify or some special obfuscation library. It can always be reverse engineered, but it’s not so easy and not worth it then.

I agree : minification and obfuscation are the main tools.
If you want more complex things to be able to be reverse engineered, then start to code in WASM :wink:

A possibility would be to use node.js server scripts for game logics and only use outputs/render or certain parts that are not possible to outsource on the server.
It requires more ressources and - well - a server that is able to host the node.js application. You need websocket communication and so on so on.

1 Like

hi.


https://javascriptobfuscator.com/
use google and search JavaScript obfuscator or simply uglify your production code with webpack or something like this

2 Likes

Note that you’ve also have beautifier tools, which help to unobfuscate a bit: https://beautifier.io/

If you’re not 100% attached to your project being an online web “site”, you could consider using Electron and go the “app” route. Electron allows you to disable the dev console. I haven’t looked too deeply into how hard it is to circumvent Electron’s security, though.

@Robin_McLaut Hit the real answer, which is to hold logic on your server.