权威的Flash多人游戏服务器:事半功倍?
我正在用 Flash 开发一款益智游戏。这是一款两人面对面的游戏,带有一些实时元素。它不像俄罗斯方块,但玩家互动的程度和移动速度与 Facebook 上的俄罗斯方块之战相似,但稍微复杂一些。
当然,我想通过互联网来匹配玩家。我也想尽可能防止作弊。因此,我正在研究一个权威的服务器解决方案,就像 Colin Moock 在 这个对类似问题的回答。也就是说,服务器运行权威的游戏逻辑,而客户端运行并行模拟,将玩家的动作发送到服务器进行验证。
我的问题是:这本质上不是意味着在客户端和服务器端都实现游戏逻辑吗?更糟糕的是,服务器可能不会在 Flash/ActionScript 中运行其模拟,这意味着您无法共享代码,并且您将用两种不同的语言两次实现相同的逻辑。这听起来像是一场后勤上、漏洞百出的噩梦。我是否误解了这个问题?
I'm working on a puzzle game in Flash. It's a two-player, head-to-head game with some realtime elements. It is not Tetris-like, but the level of player interaction and the rate of movement is similar to, though slightly more complex than, Tetris Battle on Facebook.
Naturally, I would like to match players up over the Internet. I would also like to prevent cheating as much as possible. Because of this, I am researching an authoritative server solution, much like Colin Moock describes in this answer to a similar question. That is, the server runs the authoritative game logic while the client runs a parallel simulation, sending player movements to the server for validation.
My question is this: Doesn't this essentially mean implementing the game logic on both the client and server side? Worse still, the server probably isn't going to run its simulation in Flash/ActionScript, which means you can't share code and you'll be implementing the same logic twice in two different languages. This sounds like a logistical, bug-riddled nightmare. Am I misunderstanding the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我曾在多家制作此类 Flash 游戏/应用程序的公司工作过,我可以告诉您,我还没有遇到过此问题的解决方案。如果你想要安全,一切都需要在服务器端进行评估,如果你想要响应能力,你的客户端需要能够在调用发送到服务器时处理事情。欢迎来到令人兴奋的客户端-服务器通信世界。
话虽这么说,AS3 代码与 Java 极其相似,特别是如果您已将业务逻辑与视图正确分离的话。这使得编写 Java 服务器变得非常容易(我们培训了几位 Flash 开发人员,只需几天的时间即可编写服务器逻辑,但编写完整的服务器需要一些时间)。另外,您可能会幸运地找到 Actionscript 到 Java 转换器(尽管我所看到的所有内容都需要随后进行一些手动更正)。
Having worked at several companies that make Flash games/apps of this type, I can tell you that I haven't come across a solution to this. If you want safety, everything needs to be evaluated server-side, and if you want responsiveness, your client needs to be able to handle things while calls are going out to the server. Welcome to the exciting world of client-server communications.
That being said, AS3 code is extremely similar to Java, especially if you've properly separated your business logic from your view. This makes writing a Java server super easy (we trained several Flash developers to write server logic in a manner of days, but writing the complete server takes some time). Also, you might have luck searching for an Actionscript to Java converter (though everything I've seen requires some manual correction afterward).