title: How to make a network architecture without the server being authoritative
body: <p>As a prototype i'm making a multiplayer paint game on a canvas using javascript and websockets. The conditions are that the server cannot generate the canvas in any way. All model logic happens on the client-side.</p>
  
  <p>Right now i have the following setup:</p>
  
  <p>1) When an input happens on the client side it is transferred to the server and saved. The server does a very simple validation check.</p>
  
  <p>2) Every 15 ms (on the server) all inputs are sent to the clients and cleared. The clients render the input locally.</p>
  
  <p>3) Every 200 ms each client send their version of canvas to the server where it is saved</p>
  
  <p>4) Every 200 ms the server votes for the "right" version and send it backs to the clients where they update their canvas. The right version is stored on the server with a timestamp.</p>
  
  <p>5) When a new client connects they get the most recent right version of the canvas from the server.</p>
  
  <p>While this approach provides multiplayer paint with a persistent state, it also carries some issues. What is the right version and how do they vote? What happens when a client experience a lag for like 10 seconds and then send their version? Also, if each client is making constant local changes, the canvas for each client will never be quite the same, making it impossible? to find the correct version of the canvas because they all differ when sent to the server.</p>
  
  <p><strong>The question can be boiled down to: It is possible to make a reliant client-server architecture where the client does all the logic and the server only checks if the input is valid? Even if it entails more network traffic. And if so, what would be a good approch?</strong></p>