English 中文(简体)
铁路的游戏逻辑在哪里?
原标题:Where does game logic go in Rails apps?

(分流:在铁路上我很新)

我正试图在铁路中采用国际铁路运输协会式的机车,尽管这个问题可能适用于任何国际船舶和公司式框架。

我有游戏和游戏。 运动员可以参加游戏,直到游戏充分。 试图加入一整条游戏(或两条游戏)就是一个错误,即: yada yada。

Below are three pieces of game logic that I am unsure where to place, or at least where they are typically placed.

  1. 如果游戏是全面的,那么它就应当开始并做与此相关的事情(例如,让所有参与者了解游戏已经开始,随意分散军队。

  2. When a player executes moves during his turn it seems reasonable to have that logic in the controller. What about when his turn ends and it is time to message the next player? Would that code go in the same controller as

  3. 假设某一角色在24小时内不填写,就丧失了轮椅。 我需要定期看一下我所有的游戏,看看一看一个角色是否在24小时多之前就开始。 这种逻辑在哪里?

www.un.org/Depts/DGACM/index_spanish.htm 我的问题是:上述物品在铁路/机动车道上是否合乎逻辑?。

从某种意义上讲,除<条码>3.外,我可以将其全部放在最后一项行动的控制器中。 例如,我可将<代码>1.的逻辑列入参与者-加入-加梅控制器方法(如果游戏在每一参与者加入之后全部完成,如果开始,1.相关逻辑)。 这似乎好像可能是错的地方,但也许会看它如何做。

最佳回答

Rails convention is "fat model, thin controller". so I would suggest that the state of the game should be held by the Game model.

你们的网吧是零或更多游戏,每个游戏都由1个或更多参与者组成。

The state of "full", or the state of "game begun" are properties of the game, and should be held by that model.

因此,在最后参与者加入(或也许所有现有参与者都投票开始游戏)时,游戏状态(动物财产)将被定为“手枪”,拥有目前活跃角色的财产将被设定,而“

对2人来说,游戏在动物控制器中采用一种“廉价移动”方法,以检查实施移动的参与者是目前的角色,然后会实施反对游戏模式的行动。 内部的游戏模式将知道搬迁是否有效,结果是什么,下一步是什么。 它将再次利用诸如延迟工作等内容向下一位角色传达信息。

同样,第3号也可以规定推迟工作以完成时间分配。 关于如何安排延迟工作,或者如果再有可更好地工作的灰色/红.,则不算100%。 但是,这项工作将要求动物控制者在规定时间检查游戏状况。 如果参与者没有移动,那么就执行适合逻辑,这再次成为游戏模式的一种方法。

每一角色的状态可以在运动员模式中,或者在游戏模式中,视游戏而定,在运动员模式之间可能有多少互动。

就风险游戏而言,我认为,参与者模式会很薄弱,因为委员会的状况更多地涉及哪一个角色拥有一个国家,以及他们拥有多少军队——这更是游戏状态,然后是每个参与者的状态。 我期望,在风险游戏中的参与者模式更注重实际参与者的元数据——用户名称、胜/损失、技能水平等。

在像Supremacy这样的游戏中,参与者有资源、天花等,因此有更多的数据储存在运动员模式中。

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签