Does HTML 5 Gaming use Canvas and Javascript? How to prevent cheating in this case?

北战南征 提交于 2019-12-08 21:48:43

问题


Does HTML 5 Gaming use Canvas and Javascript? How to prevent cheating in this case?

For instance, what if a user uses GreaseMonkey or some tool to alter the script so that it just reports a perfect game score to the server every time?


回答1:


I'll answer your question with a question of my own: Why don't we see rampant cheating in World of Warcraft? Or any other MMORPG for that matter?

The answer is because the game manufacturer keeps all game state serverside.

  • If I'm the client and I'm in charge of reporting damage done to the enemy, or my location, yeah of course I can cheat and tell the server I did 1 million damage.

  • On the other hand if the server keeps track of state and I only inform the server of changes to state, all I can do is tell the server "I moved left" or "I fired my gun" <-- anti-cheating is built into the architecture of the game

Of course, you did bring up the point of "perfect actions" - the case would be an action game, a shooter, etc. where objects could be identified and the "perfect action" send. And to that I'd say: this sort of cheating already exists, really. And it's existed for many years. So I don't see how anything changes just because these are javascript games.




回答2:


Instead of sending scores from user, send actions to server side everytime and calculate scores at server side




回答3:


Obfuscation. Its google, and your, number one tool against prying javascript eyes. Google Javascript Obfuscation and you'll come across a million tools.

http://www.javascriptobfuscator.com/Default.aspx for one.



来源:https://stackoverflow.com/questions/2711072/does-html-5-gaming-use-canvas-and-javascript-how-to-prevent-cheating-in-this-ca

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!