Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8256741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:57:43+00:00 2026-06-08T01:57:43+00:00

I’m building a multiplayer game in PHP. Each game is split into stages that

  • 0

I’m building a multiplayer game in PHP. Each game is split into stages that last a set amount of time – currently 2 minutes. In each stage, players work together for a set amount of time until the game either advances to the next stage, or the stage (and hence the game) is lost, and a new game starts again.

I have a vision of playing the game on an HTML page, where users can see how much time is left in the current stage through a constantly updating countdown clock. When the countdown clock reaches zero, the game either advances or ends, and the result is returned through Ajax. What I’m having problems with is the (theoretical) thought of 100 players playing the game simultaneously.

How do I call the update script? If I call it by running PHP, which player’s browser calls it? If a player’s browser refreshes the content one second before the stage actually finishes, what happens?

Is PHP the right language for a game like this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:57:44+00:00Added an answer on June 8, 2026 at 1:57 am

    “Is PHP the right language for a game like this?”
    Yes, if you do it right. Here’s how you do it…

    Using a method called Comet, you can have multiple clients pulling data from the server, but only when that data is updated. It works something like this:

    1. Client A makes pull request to server.
    2. Server waits, keeping connection to Client A open.
    3. Client B makes pull request to server.
    4. Server waits, keeping connection to Client B open.
    5. Client A pushes new data to server.
    6. Server pushes new data to Client A and Client B through still open connections.
    7. Client A makes pull request…
    8. etc…

    In other words, it means that all clients receive up-to-date information immediately it is pushed to the server by any client. This means you don’t have to implement a “refresh every x seconds” system, which is good for 2 reasons:

    1) You don;t waste time and bandwidth make requests to the server when nothing has happened;
    2) All the clients get data pushed to them at the same time, that’s absolutely up-to-date and not x seconds old.

    In practice, Comet is implemented via AJAX. Google for some examples of Comet- it’s pretty simple, and extremely useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.