如何在客户端/服务器场景中确保一系列掷骰子的安全?
想象一下游戏中的以下情况:向玩家呈现一系列随机数。每个数字都会向玩家显示一小段时间,然后才会转到下一个数字。玩家的目标是选择一个高的数字。他或她只需要在适当的时候“点击”,然后就会选择号码。
问题是如何在客户端/服务器场景中以安全的方式实现此场景。
这意味着有一个显示上述场景的游戏客户端,并且有一个需要将所选数字(以任何方式)发送到的服务器。问题是要保证这个东西的安全,这样作弊(例如通过修改客户端)就不可能了。
Imagine the following situation in a game: A series of random numbers is presented to the player. Each number is shown to the player for a short period of time before it goes to the next one. It is the player's aim to pick a high number. He or she just needs to 'click' in the right moment and then the number is chosen.
The question is about how to implement this scenario in a secure way in a client/server scenario.
That means there is a game client which displays the above mentioned scene and there is a server to which the chosen number (in whatever way) needs to be send. The catch is to get this thing secure so that cheating (e.g. by modifying the client) is not possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确实没有办法让它完全安全。即使不修改您的客户端,人们所需要做的就是让另一个程序在后台运行,读取监视器并寻找出现的特定数字,然后将鼠标单击事件发送到您的客户端程序。这可以在根本不修改客户端程序的情况下完成。即使您以某种方式设法确保其安全,以便他们无法与您的程序同时运行任何其他程序或服务,他们也可以将网络摄像头指向连接到另一台计算机的屏幕来进行光学数字识别,通过 USB 将鼠标单击事件发送到运行程序的计算机。
幸运的是,您也许能够解决这个问题。一般来说,如果某件事是“掷骰子”,那么您想要一个随机的“基于运气”的结果。通过允许他们在特定时间点击,您可以将其变成基于技能的游戏,而不是基于运气的游戏,因此不是真正的掷骰子游戏。你可以做到这样,从他们点击到骰子停止滚动之间有一个轻微的“延迟”,这样他们就会看到它滚动,点击,它就会减慢速度并落在一个数字上。这样,当他们实际点击时显示的数字并不决定结果,而是该数字之后的下一个(随机)数字,这将消除作弊的可能性,并使这是基于运气而不是基于技能的掷骰。
There's really no way to make this completely secure. Even without modifying your client, all someone needs to do is have another program running in the background reading the monitor and looking for a certain number to appear and then send a mouse click event to your client program. This can be done without modifying your client program at all. Even if you somehow managed to make it secure so that they couldn't run any other programs or services at the same time as your program, they could just point a webcam at the screen hooked to a different computer to do the optical digit recognition and send a mouse click event over USB to the computer running your program.
Fortunately, you may be able to get around the problem. Generally if something is to be a "dice roll" you want a random "luck based" outcome. By allowing them to click at a certain time you are making this a skill based game instead of luck based and therefore not really a dice roll. You could make it so there's a slight "delay" from when they click to when the dice stops rolling, so they see it rolling around, click, and it slows down and lands on a number. This way what number was displayed when they actually click does not determine the outcome, but the next (random) number after that one, which would eliminate the possibility of cheating and make this a luck based roll instead of skill based.