[{"data":1,"prerenderedAt":238},["ShallowReactive",2],{"project-9298338":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":39,"post_text":41,"what":42,"said":52,"maker_in_thread":115,"shape":125,"grid":129,"attempts":199,"same_week":200,"maker_shows":32,"maker_hidden":230,"reader_version":231,"card":232},"9298338","Boids","Boids Simulation","title","Show HN: Boids Simulation","http:\u002F\u002Fanoopelias.github.io\u002Fboids","anoopelias.github.io","anoopelias",1427823623,2015,63,28,443,2565,18,"notable","learning_science","artificial life simulation","web_app",[24,25,26,27],"boids","flocking simulation","emergent behavior","javascript canvas","mixed",0.222,{"positive":31,"neutral":32,"mixed":33,"critical":33},3,2,1,7,{"performance":36,"execution":38},{"positive":37,"critical":33},0,{"positive":31,"critical":37},[31,37,37,37,37,40,31,37,37,37,37,37,37,37,37,40,31,37,37,37,37,37,37,37,37,40,33,37],5,null,{"problem":41,"audience":41,"pricing":41,"motivation":41,"time_to_build":41,"stack":43,"openness":51,"stage":51,"team_size":51},[44],{"value":45,"source":46,"evidence":47},"JavaScript","inferred",[48],{"id":49,"by":11,"text":50},"9309024","I will have a look. The value initializes as 60, so it will show as 60 until it gets updated for the first time. Would that be what you are talking about? The initial few seconds…","unknown",{"praise":53,"objections":62,"requests":75,"questions":86,"alternatives":93},[54],{"value":55,"source":56,"evidence":57},"Looks beautiful and fun to watch","commenter",[58],{"id":59,"by":60,"text":61},"9299588","anoop-elias","Yes, looks beautiful. Quite similar, I guess. I had run in to some performance issues, the initial few ticks are quiet slow even now, esp. on a phone. This one uses a kdtree…",[63,70],{"value":64,"source":56,"evidence":65},"Frame rate display is inaccurate and animation looks jerky",[66],{"id":67,"by":68,"text":69},"9300498","luddypants","I don't think the fps calculation is quite accurate, I was getting close to 60 fps and seeing lots of jerks.",{"value":71,"source":56,"evidence":72},"Slow initial ticks, especially on phones",[73,74],{"id":59,"by":60,"text":61},{"id":49,"by":11,"text":50},[76],{"value":77,"source":56,"evidence":78},"Suggestions for faster neighbour lookup using bins or quadtrees",[79,83],{"id":80,"by":81,"text":82},"9300350","repsilat","The best data structure to use depends a lot on what you're actually doing with your neighbours. If what you actually want to do is to have each boid be affected by each boid in…",{"id":84,"by":81,"text":85},"9303179","I mean if your world is 1024 by 768, and a boid is affected by all other boids within 64 pixels of it, you should just break the world up into 16 by 12 bins, each representing a…",[87],{"value":88,"source":56,"evidence":89},"Where to read about fixed-size bins",[90],{"id":91,"by":11,"text":92},"9301084","Where can I read more about fixed-size bins?",[94,101,108],{"value":95,"source":56,"evidence":96},"SwarmJS quadtree boids simulation",[97],{"id":98,"by":99,"text":100},"9299521","postnihilism","I was inspired by this to create my own a few months ago. It uses a quadtree to optimize nearest neighbor lookup to ideally reduce complexity from n^2 to nlogn on each tick.…",{"value":102,"source":56,"evidence":103},"Three.js GPU boids example",[104],{"id":105,"by":106,"text":107},"9299336","bhouston","Somewhat related: ThreeJS GPU boids simulation http:\u002F\u002Fthreejs.org\u002Fexamples\u002F#webgl_gpgpu_birds",{"value":109,"source":56,"evidence":110},"Khan Academy natural simulations course",[111],{"id":112,"by":113,"text":114},"9299905","akilism","Khan Academy has a good Natural Simulations in JS tract. https:\u002F\u002Fwww.khanacademy.org\u002Fcomputing\u002Fcomputer-programming\u002Fprogramming-natural-simulations It uses processing.js when I…",{"comments":116,"answered":37,"key":117},4,[118,119,122],{"id":91,"text":92},{"id":120,"text":121},"9303615","Yep got it. Thanks. Feels a good idea. Have to try it to know for sure.",{"id":123,"text":124},"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…",{"commenters":18,"max_depth":126,"maker_replies":116,"first_comment_mins":127,"lifespan_hours":128},8,92,42,[130,134,138,140,142,144,146,148,150,151,152,153,155,156,160,164,167,171,173,174,178,182,184,187,188,191,195,198],[131,37,31,132,133,37],"9300422","project\u002Fneutral\u002Fperformance","14113",[135,37,37,136,137,37],"9302767","commenter\u002Fneutral\u002Fnone","M8",[139,37,37,136,133,37],"9303725",[141,37,37,136,137,37],"9304768",[143,37,37,136,133,37],"9310095",[98,33,40,145,99,37],"project\u002Fpositive\u002Fexecution",[59,33,31,147,60,37],"project\u002Fmixed\u002Fperformance",[80,33,37,149,81,37],"commenter\u002Fneutral\u002Fperformance",[91,33,37,136,11,33],[84,33,37,149,81,37],[120,33,37,136,11,33],[154,33,37,149,81,37],"9304453",[123,33,37,149,11,33],[157,32,37,158,159,37],"9300142","other\u002Fpositive\u002Fidea","maaaats",[161,32,37,162,163,37],"9300533","other\u002Fneutral\u002Fnone","avyfain",[165,31,40,145,166,37],"9299124","cporios",[168,31,31,169,170,37],"9299595","maker\u002Fneutral\u002Fperformance","nacs",[172,31,37,162,60,37],"9299686",[112,116,37,162,113,37],[175,40,37,176,177,37],"9299259","other\u002Fneutral\u002Fidea","stared",[179,180,37,162,181,37],"9299141",6,"timdaub",[183,180,37,162,60,37],"9299219",[185,34,37,162,186,37],"9299567","fersaysrelax",[105,126,37,162,106,37],[189,126,37,176,190,37],"9301061","fudged71",[192,193,40,145,194,37],"9300988",9,"efkv",[67,196,33,197,68,37],10,"project\u002Fcritical\u002Fperformance",[49,196,37,169,11,33],[],[201,206,211,216,221,226],{"id":202,"name":203,"points":204,"category":205},"9271946","SSL Decoder",160,"security_privacy",{"id":207,"name":208,"points":209,"category":210},"9297316","Netlify",116,"infrastructure",{"id":212,"name":213,"points":214,"category":215},"9295596","Notello",100,"productivity",{"id":217,"name":218,"points":219,"category":220},"9290087","Chrome",72,"dev_tools",{"id":222,"name":223,"points":224,"category":225},"9291842","Bitterness",67,"consumer_social",{"id":227,"name":228,"points":229,"category":220},"9270096","PencilCase",52,false,"v2",{"id":233,"name":5,"line":6,"ai":230,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":234,"top":18,"kw":235,"maker":11,"domain":10,"tier":19,"attempts":37,"strip":236,"url":9,"mix":237,"praise":55,"objection":64,"sub":21},9298338,0.22,[24,25,26,27],"3000053000000005300000000510",[31,32,33,33],1794036529934]