The only way to protect it is so that all calculations and checks are done on the server side. The way it was done on almost all online games. The client should never be trusted with an online connection, and you should always make sure that the server is really doing something real on the server side. (In any case, in practice, you should somewhat trust the client for compensating for the backlog and uploading some non-critical things to the client side).
For this reason, javascript is not a very good language for developing an online game, since each action needs to be processed and verified by the server. For other programming languages, this is not such a huge problem, because you can create your own communication protocols using TCP / IP for the server and client. However, this is not possible for javascript, because you must rely on the HTTP protocol and XMLHTTPRequest handlers, which make a very inefficient connection between the client and server.
As you said, you can always work with the interface in javascript, but for security, you still need to do a lot of server-side stuff, and this certainly does not work for games that require more action-oriented management. Thus, you are pretty much limited to cornering games if you need security.
Rithiur Mar 30 '10 at 9:08 2010-03-30 09:08
source share