I'm in the middle of planning a game built using JavaScript and HTML5.
I'm having trouble understanding how you could prevent someone from simply copying the JavaScript from the web server and either making their own game with it (not my biggest concern), or substituting their own JavaScript functions and dashing any hope for reliable clients in the wild if the game was to eventually support multiplayer.
Can anything be done to prevent just anybody from reading the JavaScript?
If not, should all game processing be taking place on a server somewhere with the client's only responsibilities being capturing user input and drawing graphics?
Answer
Keep all your game data and logics on the server. Part of the game which is on the client side can be copied using appropriate tools anyway (even if it's in Flash or Java), so just accept it and don't care too much about it.
To keep your javascript less copyable, because of bad readability, you can minify it. That's a good practice anyway as it makes the gaming site download faster.
No comments:
Post a Comment