title: Building a simple online game server for Unity
body: <p>I'm trying to build an online game server for my Tank game 2D (Unity). In my game there will be 2-4 players control their tanks and fight each other.</p>
  <ul>
  <li><p>I've tried to use Unity networking, it was not really suitable for my game because we have to choose 1 of the players in the room to become the &quot;server&quot;, which is not really flexible for my future development (e.g. when the &quot;server&quot; quit, I have to do a lot of work to remain connections between the other players).</p>
  </li>
  <li><p>Then I've tried to build my own server with Nodejs là socket.io for server-client communication. It's very simple: receives data from one and broadcasts them to the others. It seems to work fine until the physics part comes in: the server must trust the clients when they say there's something being hit or explode, then broadcasts it to the other clients. Not to mention the cheated clients, with the network latency, the physics simulation of the clients will vary. For example, a tank might be hit on this client but it should be covered behind the wall on the other one and stay alive, but the tank behind him catches the bullet and explodes, because of the latency. In these cases the server doesn't know which one to listen to.</p>
  </li>
  </ul>
  <h1>Update</h1>
  <ul>
  <li>As @Catwood mentioned below, Photon PUN is another option for me. I
  had followed one of their tutorials before. Photon doesn't need a player to be the &quot;server&quot; like Unity networking. But how do I implement my game logic on the server? (for authoritative server purpose)</li>
  <li>Apparently Smartfoxserver is another good (and pricey) option. I haven't taken a deeper look at their API document. I'm don't know if I could implement my gaming logic and rules on this (their tutorial skip this part for the sake of simplicity).</li>
  </ul>
  <p>In conclusion, I need a suggestion for my game server:</p>
  <ul>
  <li>Is an authoritative server</li>
  <li>Can handle game rules and decide what will happen (maybe should have its own physics engine)</li>
  <li>Works well with Unity2D</li>
  <li>Javascript, C#, Java are preferred!</li>
  </ul>
  <p>Am I going the right direction, because seems like some game server services (such as Photon, Unity networking) just don't care about how to implement game logic on the server. And does it make them not an authoritative server?</p>
  <p>I am very new to this field, anything will be appreciated!</p>