使用RoR和Active Record Session实现无作弊的游戏服务器

发布于 2024-09-27 03:42:52 字数 784 浏览 2 评论 0原文

我正在深入研究 RoR 并计划建立一些网站。除了网站之外,我还想使用 RoR 构建一个简单的 RESTful 游戏服务器 API,可用于编排我正在编写的两人 iOS 游戏。该游戏是基于谜题的时间挑战(第一个解决谜题的玩家获胜),玩家大约每十秒到五分钟才会与游戏服务器进行一次通信,并且进出服务器的数据量可能会获胜。不能超过几百字节。客户端-服务器流程将如下所示...

  1. 匹配发生在客户端上,使用 Game Center API 生成两个玩家(客户端)的列表
  2. 两个客户端均通过游戏服务器签入并进行身份验证以开始新游戏,然后游戏服务器同步两个客户端上的游戏开始
  3. 两个玩家都开始解决谜题,当任一玩家完成(解决谜题或退出)时,客户端将结果发送到服务器。
  4. 当两个玩家都完成后,服务器将结果存储在数据库中并将结果发送回两个客户端,然后游戏会话结束。

如果没有实现这一点,这似乎与 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...

  1. Matchmaking occurs on clients using the Game Center API to generate a list of two players (clients)
  2. 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
  3. Both players begin solving the puzzle, when either player finishes (solves puzzle or quits), the client sends the results to the server.
  4. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枫以 2024-10-04 03:42:52
  1. 我不认为使用 Rails 或任何其他网络语言有任何问题。
  2. 我相信满足您要求的正确身份验证方法是 OAuth。
  3. 如果我是您,我会考虑将您的客户限制为一次只能登录 1 次。
  1. I don't see any problem with using rails for that, or any other web language for that matter.
  2. I believe a proper authentication method for your requirements is OAuth.
  3. If i were you, i'd consider limiting your clients to only 1 login at a time.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文