建立多人游戏网站
我正在建立一个与个人对战国际象棋网站有很多共同点的网站。我正在考虑使用 Rails 作为前端(用户注册、导航等),并使用 Scala 或 Erlang 之类的东西作为引擎(游戏状态,也许还有 AI)。我想知道 -
- 这是使用这种设计的好情况吗?
- 究竟如何最好地划分组件之间的功能?
- 他们如何最好地相互沟通?
我对任何技术或想法持开放态度。
I am building a site that has a lot in common with a person-on-person chess site. I was thinking of using Rails for the front-end(User Registration, Navigation, etc) and something like Scala or Erlang for the engine(Game state and maybe AI). I was wondering -
- Is this a good situation to use that type of design?
- How exactly would be best to divide up the functionality between the components?
- How would they best communicate with each other?
I'm open to any technologies or ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果您使用 Rails 作为前端,为什么不使用 Ruby?
如果您喜欢使用 Scala,为什么不在前端使用 Lift 呢?
If you're using Rails for the front-end, why not use Ruby?
If you like the idea of using Scala, why not use Lift for the front-end?
国际象棋是回合制的,并且有一个非常简单的棋盘,可以通过 HTML 和/或 Javascript 增强功能进行处理 - 因此基本模型可以很好地与现有的 Web 框架配合。
考虑到这一点,Rails 是创建基于 Web 的应用程序的绝佳选择。 Rails 不仅限于 CRUD 应用程序,事实上我认为可以用 Rails/Ruby 编写整个应用程序 - 你实际上并不需要有一个外部引擎。
在浏览器空间内,可以使用 XMLHttpRequest 轮询回合更新,并且数据库可以维护当前游戏和回合状态。
Chess is turn-based, and has a very simple board that can be handled with HTML and/or Javascript enhancements - so the basic model flows quite nicely with existing web frameworks.
With this in mind, Rails is a great choice for creating a web-based application. Rails is not just limited to crud applications, and in fact I think can write your entire app in Rails/Ruby - you don't really need to have an external engine.
Within the browser space, polling for turn updates can be done using XMLHttpRequest and a database can maintain the current game and turn state.
对我来说,这看起来像是一个简单的 Lift 应用程序。请注意,我对 Lift 没有经验,但它似乎并不比常用的聊天应用程序复杂已演示。
Looks like a simple Lift application to me. I'm not experienced with Lift, mind you, but it doesn't seem particularly more complex than the chat application that is so often demoed.
我首先阅读http://www.htdp.org/如何设计程序。您提出的问题非常广泛,如果不在语句前加上“我相信...”就很难回答,
我会用 clojure 对其进行编码(但这只是我)。
I would start by reading http://www.htdp.org/ How to Design Programs. The questions you have asked are very broad and difficult to answer without prefixing statements with "I believe that..."
I would code it in clojure (but that's just me).
我目前正在使用 Scala 开发一套在线游戏。这绝对是太棒了 - 我的游戏逻辑更容易正确处理静态类型等,并且通过使用 Google Protocol Buffers 使处理服务器/客户端协议(在本例中为 Flash 客户端)变得更简单。
如果您是 RoR 的忠实粉丝,请务必使用它。我认为大多数静态类型语言都很难用它来编写网站(Java,我在这里看着你),但是 Scala 消除了 90% 的痛苦,并提供了更多的安全性。
当然,这可能不是你喜欢的。但我会尝试在 Scala 中完成整个事情,如果这不太适合您,则添加另一层。
I'm currently developing a suite of online games, using Scala. It's been absolutely fantastic - my game logic is much easier to get right with the static typing etc, and dealing with server/client protocol (a flash client, in this case) is made simpler via the use of Google Protocol Buffers.
If you're a huge fan of RoR, by all means use that. I think most statically typed languages are terrible to program websites in (Java, I'm looking at you here), but Scala gets rid of 90% of the pain, and gives even more safety.
Of course, it might not be your cup of tea. But I'd try just doing the entire thing in Scala, and adding another layer if that doesn't quite do it for you.
对于问题 1 是
对于 2 和 3,您需要提供更多信息才能获得对您有帮助的答案。
现在我正在做像你一样的事情,但对于前端我将使用 Grails。原因很简单:我喜欢 Grails、Scala,我想混合使用它们:)
For question 1 Yes
And for 2 and 3 you need to give more information in order to get an answer that could help you.
Now I'm doing something like you but for the front end I'm going to use Grails. The reason are very simple: I like Grails, Scala and I want to mix them :)