Re:Show HN: Boids Simulation
by repsilat on Wednesday April 01, 2015 @11:42AM
(#9304453)
One important thing to note while implementing it is that you have to be a little smart about how you move boids from one bin to another. You don't want to get quadratic behaviour because you're removing individual boids from the middle of lists again and again, you don't want to accidentally move a boid twice in an iteration and so on. The best way to do this is to make a list of "boids to add" and "boids to delete" for each bin, which you build as you call "move", and which you apply after you've done your movement calculations on all of your boids.
[ Parent
| on HN ]
Re:Show HN: Boids Simulation
by anoopelias on Thursday April 02, 2015 @02:52AM
(#9309016)
There are a few ways to be clever on going about it. One as you mentioned is to do a two phase scan one to move and one to correct the bins.
Also instead of a square shaped range you can get a hexagonal range by dividing corner boxes diagonally to two and then checking which half of square the boid is. :)