Hi all,
I’m in the process of learning ajax and rails so I’ve made a very simple
ajax game on my site where people can log in and play. But now I want to
extend it further so that they can play against each other.
It’s a very simple alphabet game, but in order to calculate the score
for a player I have to take into consideration what the other players
did. So when the game is finished after 2 minutes all the players’ moves
has to be collected, compared and the score for each one calculated and
sent back.
I don’t really know how to tackle this, do I have to send all player
moves to a database table in order to collect information from all
players? How can I in a way get information from one user to another
without going through my DB?
And how can I make the game start and stop at the same time for all
players?
Can I make some kind of global observer that can listen to several
different userIDs? Or is there a way that my server can access and write
data into several user sessions?
Ok this post became much longer than I intended it to be about a useless
game. But all I wanted to learn was more about sessions and different
ways of communicating between users. So If anyone have any good
tutorials or other webpages to share, I’d be very happy.
–Robi