title: Coordinate algorithm
body: <p>I am creating a 2D game and came across a specific problem. Imagine having a huuuge board with thousands of object on it. Now I want to update the state of objects every frame. But it's stupid to update all of these objects. OK, a trivial approach is to iterate over elements and check - if the distance is satisfying, THEN update. But that's slow. If I have let's say 1.000.000 objects and after the loop only about 100 of them will be updated, that suggests this is a naive algorithm. I need some algorithm that would enable me to simply get those 100 elements, or even 500.</p>
  
  <p>Some sort of a hashmap? And the hascode for coordinates would be like:</p>
  
  <pre><code>(x / 100) * 100
  </code></pre>
  
  <p>That gives something like "packages". But I doubt it will provide a significant increase in performance. Do you have any ideas? Some ingenious algorithms?</p>