How to implement turn based multiplayer using only LAMP stack and http client?
My web hosting solution is a very cheap cpanel account - I can only run php scripts in response to http requests or cron jobs at long intervals (I开发者_JAVA技巧 think 10 minutes). I'd like to implement a multiplayer game wherein:
- a lobby is created by the game creator
- other players join slots in the lobby
- the creator decides when to start the game, whilst looking at the slots
- whilst the game is in progress, the clients all swap their scores regularly - say every few seconds (this is the only interaction between players during gameplay)
- when the game is complete (due to the time being up) a summary is sent out to all players
Using PHP and MySQL I can sort of accomplish this, but the fact that all my php scripts are running in different processes is making me wonder what the best way to do this is. Does anyone have any advice? I know about table locking, but am wary of a solution which relies heavily on this feature in case it doesn't scale.
Thanks, Charlie.
You're looking for Comet.
精彩评论