使用RoR和Active Record Session实现无作弊的游戏服务器
我正在深入研究 RoR 并计划建立一些网站。除了网站之外,我还想使用 RoR 构建一个简单的 RESTful 游戏服务器 API,可用于编排我正在编写的两人 iOS 游戏。该游戏是基于谜题的时间挑战(第一个解决谜题的玩家获胜),玩家大约每十秒到五分钟才会与游戏服务器进行一次通信,并且进出服务器的数据量可能会获胜。不能超过几百字节。客户端-服务器流程将如下所示...
- 匹配发生在客户端上,使用 Game Center API 生成两个玩家(客户端)的列表
- 两个客户端均通过游戏服务器签入并进行身份验证以开始新游戏,然后游戏服务器同步两个客户端上的游戏开始
- 两个玩家都开始解决谜题,当任一玩家完成(解决谜题或退出)时,客户端将结果发送到服务器。
- 当两个玩家都完成后,服务器将结果存储在数据库中并将结果发送回两个客户端,然后游戏会话结束。
如果没有实现这一点,这似乎与 RoR 配合得很好。然而,作弊是一个问题,我的解决方案是使用 Active Record Session 的 RoR 概念在游戏开始时对玩家进行身份验证。也就是说,服务器仅允许在上述步骤 2 中经过身份验证的客户端发出的请求。
- 您认为使用 RoR 实现这种回合制游戏服务器有什么问题吗?
- 如上所述,我试图通过限制通过我的 iOS 应用程序进行的玩家身份验证来防止作弊。有哪些方法可以确保我的 iOS 应用程序正在请求身份验证?
- 假设我可以有效限制玩家对我的 iOS 应用程序进行身份验证,我是否错过了玩家仍然可以向服务器发送虚假数据和作弊的任何明显方式?
预先非常感谢您的所有帮助!
I'm diving into RoR and plan to build a few websites. Alongside the websites, I'd like to use RoR to build a simple RESTful game server API that can be used to orchestrate a two-player iOS game that I'm writing. The game is puzzle-based time challenge (the first player to solve the puzzle wins) and the players will only be communicating with the game server about every ten seconds to five minutes and the amount of data coming to/from the server probably won't be more than a few hundred bytes. The client-server flow will go something like this...
- Matchmaking occurs on clients using the Game Center API to generate a list of two players (clients)
- Both clients check in and authenticate with the game server to start a new game, then the game server synchronizes the start of the game on both clients
- Both players begin solving the puzzle, when either player finishes (solves puzzle or quits), the client sends the results to the server.
- When both players finish, the server stores the results in the DB and sends back the results to both clients, then the game session is ended.
Without having implemented this, is seems like this will work fairly well with RoR. Cheating is, however, a concern and my idea for a solution is to use the RoR concept of Active Record Session to authenticate players when the game starts. That is, only allow requests by clients that were authenticated in step 2 above to be honored by the server.
- Do you see any problems with using RoR to implement this kind of turn-based game server?
- As mentioned above, I'm trying to prevent cheating by limiting player authentication to occur through my iOS app. What are some ways I can ensure the authentication is being requested by my iOS app?
- Assuming I can effectively limit player authentication to my iOS app, am I missing any obvious ways players can still send the server false data and cheat?
Thanks so much in advance for all your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)