Page 1 of 1

javascript hacking

Posted: 03 May 2013, 19:24
by garcia1968
While I'm developing my game, I'm wondering what the mechanisms or methods(BGA wiki documentation) are to make my or others games more hack-proof on the client/javascript side?

In other words if I'm playing a BGA game and can easily see and add/modify/delete the js variables/tokens, does that mean I need to repeat validate every move and action on the server end also?

For example in the reversi tutorial, there is a possibleMove class which prevents players from playing on squares which shouldn't be played, but its easy to add this class to any square via firebug,etc.

No problem if the games depend more on an honor or reputation system between players.

Thanks

Re: javascript hacking

Posted: 03 May 2013, 19:53
by Rudolf
just care of 'results' array , what is in PHP is difficult to see (must be good coder), what is in JS is easy to see (because client side), so care to give strict minimum information to each player when transfering data.

Re: javascript hacking

Posted: 03 May 2013, 22:01
by sourisdudesert
Hello,

What is on client side (Javascript, CSS, HTML) can be modified at 100% by players. What is on server side (PHP) cannot be modified by players.

If your PHP logic forbid the forbidden moves and never send private information to the wrong player, then your game is safe :)

Note: with your example: you can modify possible moves on client side with firebug, but when you send your move to the server the PHP code does the check too and you will get an error. I should add that you will get an "unexpected error" that is reported to BGA admins so your attempt to cheat is reported (tsssssss ;) ).

Cheers,

Re: javascript hacking

Posted: 04 May 2013, 02:47
by pikiou
And when you get reported three times as a cheater, you get invited to BGA Studio in order to work on new games!
Or maybe I've been watching too many movies.

Re: javascript hacking

Posted: 04 May 2013, 10:00
by Rudolf
bad guy ! :)