Hacker News new | past | comments | ask | show | jobs | submit login

I have an implementation here [0] if people want to play with it. Supports dynamically changing the controls, has obstacles and predators. Setting weights for separation, alignment and cohesion to zero and then increasing only one of them nicely shows which role each of them plays. It's actually made as a workshop [1] for my company, where the shell is provided and one has to implement it step by step. In Norwegian, though.

Update: Dang linked other discussions, and I see I commented on one from 2015 [2]. Someone there asked for the course content, and that's available (in English!) in a PDF in [1]. This workshop/implementation is actually an example of what I wanted the students to make at the time. Which I then retrofitted to a fun workshop for my colleagues.

[0]: https://matsemann.github.io/boids-workshop/ [1]: https://github.com/Matsemann/boids-workshop [2]: https://news.ycombinator.com/item?id=9300142




I had fun playing with the parameters, thanks! Now, I want a wallpaper version of this with low maxSpeeds. Very relaxing.


Remember when Windows allowed you to set a .html file as a desktop background.

Wallpaper Engine [0] might be your next best bet.

0. https://store.steampowered.com/app/431960/Wallpaper_Engine/


Works great on my phone. I noticed that flocks tended to split when they wrap around the edge of the field, as if forces weren't being computed wrapped. Makes it hard to accomplish my goal of merging all the boids into a single flock :).


Yeah, the neighbourhood calculation doesn't wrap around. That's trivial to add, but then one has to account for the wrapping when calculating average neighbourposition so it's not completely off. Not too hard, but would have added complexity to the workshop.


These guys behave just like the implementation I wrote! I worked out how to do separation, cohesion, and alignment based on written descriptions as an exercise.


That's awesome, nicely done! Lot's of fun to play with.


That's fun, thanks!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: