0

I'm working on a project for fun. I've never created a multi-player game before so I decided to build one. For the sake of simplification; let's just say this game is online poker because the game mechanics are the same. Think: players sit at table; players take turns (timed) making moves; chat; etc.

My current setup is the following. Rails3 website hosted on Heroku. The website contains working logins (devise + heroku db) and a websocket chat room.

What I'm wondering is; seeing as all the Rails stuff is session based. How do I handle the turn timer? Don't I need some piece of the equation that holds the state across all the sessions and is able to keep track of time / throw events? Do I need a separate server? Or can I run this thing via my current setup?

If I do need another server; how do I do this with Rails? Another Heroku app? Is this possible under Heroku? Kinda new to Rails; so any help understanding this would be very much obliged.

Btw; any articles related to this topic would be much appreciated.

Can this be done with Delayed Jobs?

user852740
  • 19
  • 1
  • 5

1 Answers1

0

Have you looked into EventMachine?

Dru
  • 9,632
  • 13
  • 49
  • 68
  • Is eventmachine often used for this type of solution? I'm not familiar with EventMachine; but I will research it more today. – user852740 Nov 28 '11 at 18:48
  • When I read your question, I thought about Node.js, but it seemed that you wanted something rails-related and EventMachine is said to have inspired Node.js If you're comfortable with javascript you may also want to checkout Node.js Many [games](http://nodeknockout.com/entries) have been built on the Node.js framework. Here's a [post](http://stackoverflow.com/questions/5540490/eventmachine-vs-node-js) comparing the two solutions. – Dru Nov 28 '11 at 18:57
  • Is there any reason why Delayed_Jobs wouldn't work here? I figure all I need is a delayed job to that delays 20 seconds or so (whatever the player's turn time is). When the delayed_job fires; it would check the database to see if the player ended up taking his turn; if he didn't it would resign his turn and start the next players turn. Does this sound like a decent solution; or am I missing something about delayed_jobs? – user852740 Nov 29 '11 at 19:14