pinkyponky 0 Report post Posted January 23, 2017 Hello Masters, I am a JavaScript toddler and I have created the Tic Tac Toe game using Plain JavaScript. Now how can I encrypt or protect my code so that no one could copy or steal it? Note: I am not asking this question to save my Tic Tac Toe game but in future IF I make good games Thank you. Quote Share this post Link to post Share on other sites
mattstyles 667 Report post Posted January 23, 2017 In short you can't. You can obfuscate, which might solve your problem, but you can't actually encrypt. You could compile to ASM or WASM (I'm assuming you can go JS->WASM, I've only ever done C->WASM), this isn't encrypted either. The web must remain transparent or bad things™ will happen (very bad things). So ask yourself if there are better ways of 'protecting' your game. The web is currently transparent, so even if your code is obfuscated junk it must be transmitted and that can be hijacked/stolen even without copy-pasting from your browser. Encryption alone doesn't stop anything being stolen in any language anyway, if it runs it can be moved and run again. Think of other ways to protect your game, the absolute best is to continually improve your game so that players want to keep playing and keep playing the latest of your game. Quote Share this post Link to post Share on other sites
bruno_ 70 Report post Posted January 23, 2017 The majority of game developers have great technical skills. Most can copy your game without looking at the source, because they know how to do it. Use your time to have great ideas and be the first to release them. However, you should bundle and minimize your js files for size download reasons. 2 mattstyles and Nikos123 reacted to this Quote Share this post Link to post Share on other sites
BobF 39 Report post Posted January 23, 2017 You can't prevent people from stealing client-side code, the best you can do is make the code harder to read and understand. JavaScript minification with variable renaming will do that a bit, or you can Google "javascript obfuscator" to find solutions that may make your code even more difficult to read (and could also introduce bugs). The best protection is to run some/all of your code server-side and send the results to the client, but that will increase your server costs. 1 mattstyles reacted to this Quote Share this post Link to post Share on other sites
pinkyponky 0 Report post Posted January 24, 2017 Hmmm... OK Thank you to everybody. Take care all of you and Bbye. Quote Share this post Link to post Share on other sites
Raggar 140 Report post Posted January 24, 2017 I have rewritten code from a deminified Javascript source once. It was really trivial. Handle as much as possible on the server, making it harder for people to copy, as they have to emulate your back-end. If your game isn't too complex, or needs to be very responsive, you can run the game on the server and use a dumb client. Quote Share this post Link to post Share on other sites
ClusterAtlas 7 Report post Posted February 4, 2017 best you can do is to minify & obfuscate it, and keep most of the functions in the server's side. Quote Share this post Link to post Share on other sites
semk 2 Report post Posted February 8, 2017 one thing to consider is if you use cordova and publish an app out of your html/js game then that's a pretty strong way of hiding the code since people with the app won't be able to break it down back to js Quote Share this post Link to post Share on other sites
bruno_ 70 Report post Posted February 8, 2017 1 hour ago, semk said: one thing to consider is if you use cordova and publish an app out of your html/js game then that's a pretty strong way of hiding the code since people with the app won't be able to break it down back to js Actually, you can. If you download the apk and unzip it, your js files will be there. 1 mattstyles reacted to this Quote Share this post Link to post Share on other sites
semk 2 Report post Posted February 9, 2017 On 2/8/2017 at 11:33 AM, bruno_ said: Actually, you can. If you download the apk and unzip it, your js files will be there. you're right, not sure what i was thinking, maybe iOS Quote Share this post Link to post Share on other sites
pinkyponky 0 Report post Posted February 10, 2017 Thank you everybody Quote Share this post Link to post Share on other sites
mattstyles 667 Report post Posted February 10, 2017 11 hours ago, semk said: you're right, not sure what i was thinking, maybe iOS Nope, you can break it open on iOS also Quote Share this post Link to post Share on other sites
Nikos123 6 Report post Posted April 4, 2017 Or just make it open source. Quote Share this post Link to post Share on other sites