How to make a secure game in javascript ?

Posted by rnaud on Stack Overflow See other posts from Stack Overflow or by rnaud
Published on 2010-03-30T08:48:14Z Indexed on 2010/03/30 8:53 UTC
Read the original article Hit count: 433

Hello,

I'm working on games using javascript some html and css, and I was wondering if there was any way to secure the game so that the user can't just call game.php?result=victory to finish the game and earn some point.

As of right now here are the solution I have.

  • For a chance game, start the page with the result already in place, win or loose, then just do some animations to show it, but all the score and win/loose stuff is done server-side.

  • For a battle game, just get the action from the javascript call, and do the damage calculation, reaction of the oponent on the server and just send back the data.

but the last solution imply that I will have to send actions each time the user do anything. This might work for a turn by turn battle game, but I think it would be to slow for any other kind of game. So my question is, is there some kind of secure way I can prep my javascript to secure the infomation sent.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about game-development