title: How do games like agar.io determine what data is sent to each player?
body: <p>How do games like agar.io and slither.io optimize their multiplayer/event broadcasting and determine what data is sent to each player? 
  We can send events/data coming from player to every other player, but amount of data server needs to send now grows exponentially.</p>
  
  <p>First thing that comes to my mind is space partitioning: split map by visibility zones. When player moves between zones, they are registered in a new zone (added to an array of players in that zone) and receive positions of other players in that zone. 
  When player makes an action (i.e. movement), event is broadcasted to players within his zone (+1 zone from each side).</p>
  
  <p>Other idea is visibility radius, but I can't determine optimal algorithm (for each player, determine players in their visibility radius - we are at O(N^2) complexity now).</p>
  
  <p>I also heard about quadtree but I do not know how to apply it here. </p>
  
  <p>Are there any existing algorithms to solve that?</p>