title: Multiplayer billiards game physics simulation
body: <p>I’m building an online multiplayer billiards game and I’m struggling to think of the best approach to multiplayer physics simulation. I have thought of a three possible scenarios, each having its own advantages and disadvantages and I would like to hear some opinion of those that either have implemented something similar already or have experience in multiplayer online games.</p>
  
  <p><strong>1st Scenario:</strong> Physics simulation on the clients: The player in turn to take a shot sends the angle of the shot and power to the server, and the sever updates all clients with these values so they can simulate the shot independently.</p>
  
  <p><em>Advantages:</em></p>
  
  <ol>
  <li>Low server overheat</li>
  </ol>
  
  <p><em>Disadvantages:</em></p>
  
  <ol>
  <li>Problems with synchronization. Clients must simulate the exact simulation regardless of their frame rate. (Possible to solve with some clever algorithm like one described <a href="http://gafferongames.com/game-physics/fix-your-timestep/" rel="nofollow">here</a>)</li>
  <li>Cheating. Players can cheat by tweaking the physics engine. (Possible to determine when making a comparison at the end of the shot with other players ball positions. If only two players are at the table (i.e. not spectaculars) then who the cheater is?)</li>
  </ol>
  
  <p><strong>2nd Scenario:</strong> </p>
  
  <p>Physics simulation on one (i.e. “master”) client (e.g. who ever takes the shot) and then broadcast each physics step to everyone else.</p>
  
  <p><em>Advantages:</em></p>
  
  <ol>
  <li>No problems with synchronization.</li>
  </ol>
  
  <p><em>Disadvantages:</em></p>
  
  <p>1.Server overheat. Each time step the “master” client will be sending the coordinates of all balls to the server, and the server will have to broadcast them to everyone else in the room.
  2. Cheating by the “master” player is still possible.</p>
  
  <p><strong>3rd Scenario:</strong> The physics will be simulated on the server. </p>
  
  <p><em>Advantage:</em></p>
  
  <ol>
  <li>No possibility to cheat as the simulation is run independent of clients.</li>
  <li>No synchronization issues, one simulation means everyone will see the same result (event if not at the same time because of network lag)</li>
  </ol>
  
  <p><em>Disadvantages:</em></p>
  
  <ol>
  <li>Huge server overload. Not only the server will have to calculate physics 30/60 times every second for every table (there might be 100 tables at the same time) but also will have to broadcast all the coordinates to everyone in the rooms.</li>
  </ol>
  
  <p><strong>EDIT</strong>
  Some of similar games to the one I’m making, in case someone is familiar with how they have overcame these issues:</p>
  
  <pre><code>http://apps.facebook.com/flash-pool/
  http://www.thesnookerclub.com/download.php
  http://gamezer.com/billiards/
  </code></pre>