title: Node.js + websocket - Low-bandwidth game entity ids
body: <p>I have been working on a game for the past few days and I am currently working on <strong>optimizing the websocket frame data</strong>. I've changed data type from simple JSON to an <strong>arraybuffer</strong>, and that part is working fine. Entity data such as <strong>position and rotation is sent and received with no problem</strong>.</p>
  
  <p>The <strong>entity <code>ID</code></strong> is the problem. Currently the <strong>client is keeping track of every entity by its <code>ID</code></strong> to store last position for the smooth movement, and <strong>so it will continue to be.</strong></p>
  
  <p>Every entity on the server currently has an <code>UUID</code> (ex <code>f2e9f5e2-a810-416e-a1ce-a300a0b7a088</code>). That is <strong>16 bytes</strong>. Im not sending that!</p>
  
  <p>And now to my question. How to they do it in big games? Is there any way of getting around this, or a way to generate a unique 2 byte or some other low-bandwith <code>UID</code>?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I need more than 256 <code>ID</code>s, which means that 1 byte is obviously not going to work. 2 bytes gives me 65535 <code>ID</code>s which probably is enough. I also know that iterating through a loop until you find the next free ID is an option, but maybe that is too "costly".</p>