I have a virtual world game that I developed with jQuery, AJAX and PHP. Virutal World like club penguin. Now, I want to add a game into the virtual world - like bubbles or whatever. The main problem its that the game in ajax, so if the player got 20 points in the game - in the ajax request I have the player points and the player can change the ajax request to any points that he want. How can I do it secured? Thanks
Asked
Active
Viewed 55 times
0
-
1Why do you think, that if this was closed the first time (based on the [on hold] in the question body), that it won't get closed this time? – Bálint Mar 22 '18 at 09:34
-
1@Bálint His question was set on hold at stackoverflow because a moderator suggested him to post here instead – DarkBee Mar 22 '18 at 09:37
-
Ahh, understandable – Bálint Mar 22 '18 at 09:39
-
The short answer is "You can't; run your logic on the server." See also https://gamedev.stackexchange.com/questions/37392/anti-cheat-javascript-for-browser-html5-game and https://gamedev.stackexchange.com/questions/113281/prevent-cheating-in-html-javascript-game. – Vaillancourt Mar 22 '18 at 13:25
-
@AlexandreVaillancourt Hi dude, What to do In the end, I did not really understand what these articles you brought me. Is there any code that actually tells me how to hide the code from the user? – Ben Mar 22 '18 at 14:24
-
"You can't" If the player runs the game logic and the "points" on their own client, there is nothing you can do about it. The solution is to have you game run on your server, so it's only your server that has the authority to "give points" to the player. The other option is to not make the game multi-player, or have them share their score only with the people they know. Ultimately, make the score meaningless and in such a way that it does not affect the other players. – Vaillancourt Mar 22 '18 at 14:29