保护javascript游戏时机 [英] Securing javascript game timing

查看:51
本文介绍了保护javascript游戏时机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个基于画布的游戏,它有一个重要的计时元素。完成游戏后,用户的完成时间将发送到服务器上的PHP / MySQL,以便与其他玩家进行比较。

I'm creating a canvas-based game that has an important timing element to it. Upon completion of the game, the user's completion time is to be sent to PHP/MySQL on the server for comparison with other players.

服务器端计时(即提交请求时间的开始请求时间)似乎可能会导致加载时间影响用户的实际时间,因此在这种情况下效率低下。

Server-side timing (i.e. begin request time to submit request time) seems like it could introduce load times as affecting the user's actual time and therefore inefficient in this case.

我遇到的问题是确定一种确保发送时间合法的方法。如何阻止某人使用他们的控制台并以提交虚假时间的方式编辑客户端代码?

What I'm having trouble with is determining a way to assure that the time sent is legitimate. How can I stop someone from using their console and editing the client-side code in such a way as to submit a false time?

任何帮助将不胜感激。

推荐答案

你做不到。 永远不要相信客户。您的服务器的每个请求都可能被欺骗。

You can't. Never trust the client. Every request to your server could be spoofed.

这篇关于保护javascript游戏时机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆