12

I've been writing a game in JavaScript, and it's time to make it multiplayer. I would like to use AJAX long-polling to get the current game state, as well as implement the lobby.

The server just needs to perform basic functions, like store the gamestate in the mysql database, retrieve the gamestate, and format the scoreboard.

I think that writing it in PHP would be easiest, but that would be a bad idea due to the number of apache processes it would spawn.

What do you recommend? I'm looking for the most straightforward approach.

Edit: StreamHub seems good, but the community edition only allows for 10 concurrent users.

Jonas
  • 97,987
  • 90
  • 271
  • 355
Zack Burt
  • 7,308
  • 8
  • 50
  • 80

3 Answers3

6

I think http://nitrogenproject.com/ have a good comet example here http://nitrogenproject.com/web/samples/comet2

Fu.
  • 446
  • 4
  • 10
2

You'd probably be interested by something called Comet.

About Comet and PHP, you can take a look at these questions and their answers :

And, not necessarily in PHP (which doesn't seem to be that adapted for Comet ; many people seem to recommend using another language / technology for the backend server...) :

I'm seeing more and more of those Comet questions... I'm going to try one day or another, I think... Seems fun ^^

Community
  • 1
  • 1
Pascal MARTIN
  • 374,560
  • 73
  • 631
  • 650
  • 3
    I already mentioned Comet, and that I didn't want to use PHP. – Zack Burt Aug 02 '09 at 22:25
  • Oh, sorry, I mis-understood "I think that writing it in PHP would be easiest, but that would be a bad idea due to the number of apache processes it would spawn" ; I thought it meant you were not sure about PHP and if it was wise to use it or not. sorry :-( – Pascal MARTIN Aug 03 '09 at 10:35
0

Maybe better to use push-channel like juggernaut.rubyforge.org, rather than longpoll?

Max Lapshin
  • 813
  • 7
  • 15