pinkyponky Posted January 23, 2017 Share 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 Link to comment Share on other sites More sharing options...
mattstyles Posted January 23, 2017 Share 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 Link to comment Share on other sites More sharing options...
bruno_ Posted January 23, 2017 Share 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. Nikos123 and mattstyles 2 Quote Link to comment Share on other sites More sharing options...
BobF Posted January 23, 2017 Share 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. mattstyles 1 Quote Link to comment Share on other sites More sharing options...
pinkyponky Posted January 24, 2017 Author Share Posted January 24, 2017 Hmmm... OK Thank you to everybody. Take care all of you and Bbye. Quote Link to comment Share on other sites More sharing options...
Raggar Posted January 24, 2017 Share 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 Link to comment Share on other sites More sharing options...
ClusterAtlas Posted February 4, 2017 Share 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 Link to comment Share on other sites More sharing options...
semk Posted February 8, 2017 Share 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 Link to comment Share on other sites More sharing options...
bruno_ Posted February 8, 2017 Share 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. mattstyles 1 Quote Link to comment Share on other sites More sharing options...
semk Posted February 9, 2017 Share 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 Link to comment Share on other sites More sharing options...
pinkyponky Posted February 10, 2017 Author Share Posted February 10, 2017 Thank you everybody Quote Link to comment Share on other sites More sharing options...
mattstyles Posted February 10, 2017 Share 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 Link to comment Share on other sites More sharing options...
Nikos123 Posted April 4, 2017 Share Posted April 4, 2017 Or just make it open source. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.