Boids
en.wikipedia.org
en.wikipedia.org
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
Wallpaper Engine [0] might be your next best bet.
0. https://store.steampowered.com/app/431960/Wallpaper_Engine/
Yesterday I got 0.5 million boids simulating in Unreal Engine at 45 fps on a GTX 1080 [0]. The bottle neck is rendering so many instanced cone meshes, the simulation without rendering can do 1 million boids at 120 fps. I'm borrowing a common data structure used in GPU fluid simulations, the dynamic hashed grid, to calculate the neighbourhood of each boid (cool tutorial here with full source code [1]). We need the neighbourhoods to calculate their urges. My code is a mess at the moment, but if there is interest I can post it to GitHub (Unity and Unreal).
Boids are an example of agent-based modelling and swarm systems. I used agent-based modelling in my PhD thesis to construct and simulate realtime, interactive 3D biomolecular models of mitochondria and neuromuscular synapses [2,3]. Now that I'm free (graduated), I'm building an iPad app to teach and communicate structural and molecular biology with immersive, and realtime simulations. Our vision is to make molecular and structural biology immersive and fun. It's not a textbook, it's a little more like Neil Stephenson's young lady's illustrated primer! :D
[0]: https://twitter.com/timd_ca/status/1243941167005192192?s=20
[1]: https://wickedengine.net/2018/05/21/scalabe-gpu-fluid-simula...
Did 10,000 to 20,000 agents at 60 fps. Puny compared to yours, but not bad for 14 years ago! https://www.youtube.com/watch?v=Jpy5rJSVLj8 https://www.youtube.com/watch?v=ZZoy-8xK0YI
My neighbourhood implementation is the naive n^2 loop, so it's probably trivial to make it better. Quadtrees, or even just simple caching / zoning would probably allow me to dish out many more boids.
It also doesn't help that in order to be easy as a workshop, it's written in a way that's easy to implement, but slow to execute.
Amazing work! LifeBrush is Emacs for Cytoplasm! I've read that those little thing-a-ma-bobs in your cells move around at something like 30 miles an hour, bumping into each other. Is that accurate? Does that simulation show them slowed down a lot? Would it just be a blur in real time? Is that software available, please?
My simulation is inaccurate in terms of Brownian motion. It is slowed down and smoothed for illustrative purposes. It should be more violent. Nice idea with blurring, I'll think about that. The code is on GitHub. It requires a VR headset, and it is frankly a little clunky and "research code" in terms of the UI. But check it out :D [1]. The next version will support larger simulations on the GPU and a more friendly UI. I have friends at the Scripps institute who work on similar stuff, check them out [2].
[0]: David Goodsell (2009) The Machinery of Life https://www.amazon.ca/Machinery-Life-David-S-Goodsell/dp/038...
I really love the part in your interactive simulation overview, at 2:58:
LifeBrush - An overview of our illustrative simulation canvas
https://www.youtube.com/watch?v=5LBHRyGxLGI
2:58> The ribosome uses tRNA to match mRNA codons to amino acids. We paint a cloud of tRNA near the ribosome. tRNA, molecular agents, need amino acids. So we paint a cloud of of amino acids nearby. Brownian motion brings tRNA and ribosomes together. But that takes a long time. However, our system is interactive and immersive. So we grab the ribosome and move it around. Now we see how the ribosome marches along the mRNA, with tRNA depositing amino acids onto a growing poly-peptide chain in blue. We reach the end of the mRNA, and the mRNA and poly-peptide chains are released.
So in order to avoid waiting for brownian motion to do its thing over time, you just grabbed the ribosome's lazy ass and dragged him over near the mRNA, then threaded it into his jaws, and waved him around through a cloud of amino acids and tRNA to feed him, so he sucks up the tRNA pasta and mRNA meatballs and amino acid sauce, just like Lady and the Tramp eating spaghetti to Bella Notte, and then he pumps out useful proteins, just like the Golden Goose.
Lady and the Tramp (1955) Scene: 'Bella Notte'
https://www.youtube.com/watch?v=XNQWbZ9sO3Q
The immersive interactivity is (in a good way) like the Libertarian wet dream wish-fulfillment of the invisible hand of unobservable market forces, or the Intelligent Design pseudo-scientific fantasy of God directly intervening in the affairs of molecules! Ribosomes could be the next Tamagotchi! ;) Ribosomegotchi?
You obviously know this stuff well, but I want to mention that your videos "LifeBrush: Discrete element texture synthesis overview" and "LifeBrush: Bunny-planet design session" using Greg Turk's Stanford bunny impress me as an homage to his work on mapping bunnies with 2d textures, and Andy Witkin's work on reaction-diffusion textures, and also looks inspired by the Photoshop smart clone tool.
LifeBrush: Discrete element texture synthesis overview
https://www.youtube.com/watch?v=624F5iaCKco
LifeBrush: Bunny-planet design session
https://www.youtube.com/watch?v=L482dpH9S8o
Greg Turk
https://en.wikipedia.org/wiki/Greg_Turk
Stanford Bunny
https://en.wikipedia.org/wiki/Stanford_bunny
Andy Witkin
https://en.wikipedia.org/wiki/Andrew_Witkin
Andy Witkin's gallery
https://www.cs.cmu.edu/~aw/gallery.html
Reaction Diffusion Textures. (animation) 1991. Nonlinear partial differential equations as a means of artistic expression. Shown at SIGGRAPH '91 electronic theater. mpeg (209K).
https://www.cs.cmu.edu/~aw/mpg/rd.mpg
Reaction Diffusion Textures. 1991, with Michael Kass. Nonlinear partial differential equations as a means of artistic expression. This image won the Prix Ars Electronica '92 grand prix for computer graphics. postscript. pdf. citation.
https://www.cs.cmu.edu/~aw/pdf/texture.pdf
Using Particles to Sample and Control Implicit Surfaces. 1994, with Paul Heckbert. Quasi-physical particles that float on an implicit surface. We use mutual repulsion and fissioning to quickly obtain a good sampling of the surface, and to maintain it as the surface deforms. postscript. pdf. citation. mpeg(23K). BIG mpeg (868K.)
https://www.youtube.com/watch?v=Oh2oF-eZTD8&list=PLrBjj4brdI...
Your Bunny Planet design session really illustrates how wonderfully your work applies to computer games:
https://www.youtube.com/watch?v=L482dpH9S8o
https://www.youtube.com/watch?v=624F5iaCKco
Chaim Gingold (one of the developers of Spore) made "Earth: A Primer", a cool interactive educational simulation science book, also like your work, inspired by Neil Stephenson's young lady's illustrated primer, but on a somewhat different physical scale:
>Earth: A Primer is a science book you play with.
I sent Chaim some links to your work, and he loved it and said he has collaborator who will be delighted to learn about it too. He also teaches computer game design, and did his PhD thesis on "Play Design". You should work together, and fill in all the levels between planets and cytoplasm! ;)
Sorry it's just this kind of thing pushed my buttons. I see someone showing their engine and claiming perf when their example is 99.999% GPU and 0.001% anything to do with their engine.
It's unrelated to boids, but I would not recommend using the Poly6 and Spiky kernels. That design originates from "Particle-based fluid simulation for interactive applications" (2003) by Müller et al., and they choose the spiky kernel on the assumption that a zero gradient at the origin is the reason why particles sometimes get stuck together. However, the clumping phenomenon was more closely studied by Dehnen and Aly in "Improving convergence in smoothed particle hydrodynamics simulations without pairing instability" (2012) [https://doi.org/10.1111/j.1365-2966.2012.21439.x]. They showed that you can predict pairing instability based on neighbour count, and that kernel functions that are everywhere positive within the Fourier domain do not exhibit that instability.
The Wendland family of kernel functions are thus recommended, as they fulfill that criteria. Though, for low neighbour counts a quartic B-spline is a good alternative.
Also, congrats on escaping--err... graduating!
Some links if you want to try it out:
- https://docs.blender.org/manual/en/latest/physics/particles/...
- https://www.blendernation.com/2019/07/06/how-to-use-boids-in...
- https://www.blendernation.com/2008/01/05/simulating-flocks-h...
- http://feeblemind.tuxfamily.org/blog/index.php?post/2007/12/...
https://www.youtube.com/watch?v=aL6mTMShVyk
>"He's up on the roof with his boids. He keeps boids. Doity, disgusting, filthy, lice ridden boids." -The Concierge, not a Madam
https://en.wikipedia.org/wiki/Boids
>Boids is an artificial life program, developed by Craig Reynolds in 1986, which simulates the flocking behaviour of birds. His paper on this topic was published in 1987 in the proceedings of the ACM SIGGRAPH conference. The name "boid" corresponds to a shortened version of "bird-oid object", which refers to a bird-like object. Incidentally, "boid" is also a New York Metropolitan dialect pronunciation for "bird".
https://web.archive.org/web/19990117095925/https://http1.bru...
>Craig Reynolds' Boids
>"The motion of a flock of birds is... simple in concept yet is so visually complex it seems randomly arrayed and yet is magnificently synchronous. Perhaps most puzzling is the strong impression of intentional centralised control. Yet all evidence indicates that flock motion must be merely the aggregate result of the actions of individual animals, each acting solely on the basis of its local perception of the world." - Craig Reynolds
[...]
>References: "Artificial Life : The Quest for a New Creation" - Steven Levy
https://books.google.nl/books/about/Artificial_Life.html?id=...
Steve Levy's page on his "Artificial Life" book (with glorious 1997 web site design):
https://web.archive.org/web/19981202151154/http://www.echony...
Tal Cohen's Bookshelf: Artificial Life: The Quest for a New Creation / Steven Levy
http://neuro.bstu.by/ai/To-dom/My_research/failed%201%20subi...
Bruce Sterling. Artificial life.
http://lib.ru/STERLINGB/f_sf_04.txt
Half Life Wiki: Boid
https://half-life.fandom.com/wiki/Boid
>A "Boid" is a virtual entity used in "Boids", an artificial life program simulating the behavior of birds or fish in their flocks or schools, respectively (with each other, as well as their environment), developed at Symbolics Inc. in 1986 by Craig Reynolds, an artificial life and computer graphics expert, and named "steering behavior".[1] The source code has been released a few years after 1986, allowing the creation of many variants since then, including Valve's creature (that even resembles the original Boids by Reynolds). It is also implemented in the free C++ library OpenSteer, designed to help construct steering behaviors for autonomous characters in games and animation.
>The term "Boid" is the abbreviation of "birdoid" ("like a bird"), as the program rules applied equally to simulated flocking birds and schooling fish. It was also inspired by a scene from Mel Brooks' 1968 film The Producers where the playwright's landlord complained about his keeping pigeons on the roof, referring to them as "boids", or "bird" in a stereotypical New York accent. The term also linked up with the ellipsoid-based 3D modeling tool by Tom Duff at the Graphics Lab of New York Institute of Technology named "soids".[2] Therefore, in regard of the source of the creature's name, its proper in-universe name remains unknown.
Alvy Ray Smith used Tom Duff's "soids" (short for "ellipsoids") for Chromagnon:
http://alvyray.com/Art/Chromagnon.htm
>I modeled the skeletal hands from cylinders and spheres, using Tom's "soids" program.
Roadmap-Based Methods for Flocking Motion with Obstacles
https://www.cs.umd.edu/~mount/Indep/Kevin/Webpage/index.htm
>It was also inspired by a graphics modelling and rendering system by Tom Duff when he was at the Computer Graphics Lab of the New York Institute of Technology. It used ellipsoids as its primitive shape and was called "soids".
Craig Reynolds Boids page
https://web.archive.org/web/19981202064632/http://www.hmt.co...
>Boids: Background and Update, by Craig Reynolds.
>[You need to be using an Java-enabled browser to see this demo.] (more information about this applet is available)
>In 1986 I made a computer model of coordinated animal motion such as bird flocks and fish schools. It was based on three dimensional computational geometry of the sort normally used in computer animation or computer aided design. I called the software boids.
[...]
Brunel University Artificial Intelligence Site / Artificial Life / Boids / Three "Boid" Term Sources
https://web.archive.org/web/20010505042228/http://www.brunel...
https://web.archive.org/web/20010224013859fw_/http://www.bru...
https://web.archive.org/web/20001004064622/https://http1.bru...
>I have learned (on extremely good authority!) that there were actually three sources of the term 'boid'! Here they are:
>"Boid" was an abbreviation of "birdoid", as his rules applied equally to simulated flocking birds, and schooling fish.
>It was also inspired by a graphics modelling and rendering system by Tom Duff when he was at the Computer Graphics Lab of the New York Institute of Technology. It used ellipsoids as its primitive shape and was called "soids".
>Finally, there was a Mel Brooks film called The Producers starring Zero Mostel and Gene Wilder which contained a scene where the playwright's landlord complained about his keeping pigeons on the roof ("You used to be able to sit on the stoop like a normal person, but not any more, 'cause of da BOIDS. Dirty, lousy, stinkin' BOIDS")
I implemented an NVIDIA algorithm for running n-body simulations on the GPU. The constraint is memory access, which can freeze up in a case like this. [2]. Converting from CUDA to Metal wasn’t too bad.
1: https://www.instagram.com/p/B4t4ewCplfR/?igshid=1uxnng6idsqb...
2: https://developer.nvidia.com/gpugems/gpugems3/part-v-physics...
edit: Here's a low-res animated GIF for anyone who doesn't want to click an instagram link: http://gregorywieber.com/assets/images/art/murmuration.gif
https://forums.tigsource.com/index.php?PHPSESSID=qvfvkcqtfr9...
Long before the flocking model, “boid” referred to snakes of the Boidae family, like boas and anacondas.
https://scrabble.merriam.com/finder/boid (for the USA and Canada)
https://www.collinsdictionary.com/scrabble/ (for English in the rest of the world)
For example, according to Wiktionary, boid (and its plural) should be permitted under etymology two, ie. member of the family Boidae of non-venomous snakes or etymology three, ie. Nonstandard spelling of bird representing the New York City pronunciation. We would not permit it under etymology one (computer program name). Now look - you learned something! https://en.wiktionary.org/wiki/boid#English
Therein the author covers boids extensively and in detail. If I am not mistaken it is in section 16.3 that the author treats boids fairly extensively.
https://m.youtube.com/watch?v=zN2bhKyCJwk
It looks really good even though the "fish" are just made from two pyramids.
https://github.com/SebLague/Boids/blob/master/Assets/Scripts...
If so, then awesome :)
2011: https://news.ycombinator.com/item?id=2504652
2014: https://news.ycombinator.com/item?id=7293350
One comment from 2018: https://news.ycombinator.com/item?id=17167077
(Links for the curious. Reposts are ok after a year: https://news.ycombinator.com/newsfaq.html)
github.com/glouw/openempires
Boids just provide distancing at the micro level. Astar or Greedy First Best at the macro level ultimately provides the boid with a final destination, and the boids organically work together on path to their respective final destinations.
Rise of Nations did it almost perfectly in the early 2000s with left box drag for selection and right box drag for retangular placement. Rome Total War upped the antics a bit with 10,000 unit scales over Rise of Nations 200 unit scales, but suffered some serious bugs. In my opinion no one except Julius Caesar can "program" so many units to properly do their bidding!
I made a little framework for building these types of models: https://github.com/jrhdoty/SwarmJS
Here's a boids implementation using it: http://jrhdoty.github.io/SwarmJS/
For a nice visualization and simulation of a spreading virus and why social distancing is a good idea: https://www.washingtonpost.com/graphics/2020/world/corona-si...
S-I-R (Susceptible, Infected, Recovered/Removed) models of epidemiology are a far better place to begin for reasonably realistic and tractable modelling and prediction of epidemics.
In OpenSteer terms, social distancing would include "unaligned collision avoidance" and "separation" steering behaviors, which can be combined with other behaviors including "seek", "flee", "pursuit", "evasion", "offset pursuit", "arrival", "obstacle avoidance", "wanderer", "path following", "wall following", "containment", "flow field following", "cohesion", "alignment", and "leader following". You can also implement your own custom plug-ins, if you need something special like "curly floor spinning".
https://www.youtube.com/watch?v=T2iZPRif2i4
http://www.red3d.com/cwr/steer/
http://www.red3d.com/cwr/papers/1999/gdc99steer.html
http://www.red3d.com/cwr/steer/gdc99/
https://forum.unity.com/threads/opensteer-for-unity3d.26906/
https://code.google.com/archive/p/opensteerdotnet/
https://github.com/ricardojmendez/UnitySteer
http://opensteer.sourceforge.net/
OpenSteer is a C++ library to help construct steering behaviors for autonomous characters in games and animation. In addition to the library, OpenSteer provides an OpenGL-based application called OpenSteerDemo which displays predefined demonstrations of steering behaviors. The user can quickly prototype, visualize, annotate and debug new steering behaviors by writing a plug-in for OpenSteerDemo.
OpenSteer provides a toolkit of steering behaviors, defined in terms of an abstract mobile agent called a "vehicle." Sample code is provided, including a simple vehicle implementation and examples of combining simple steering behaviors to produce more complex behavior. OpenSteer's classes have been designed to flexibly integrate with existing game engines by either layering or inheritance.
OpenSteerDemo's plug-in framework allows a game AI programmer to quickly prototype behaviors during game design, and to develop behaviors before the main game engine is finished. OpenSteerDemo allows the user to interactively adjust aspects of the simulation. The user can: start, stop and single step time, select the vehicle/ character/ agent of interest, adjust the camera's view and its tracking behavior.
OpenSteer is distributed as open source software in accordance with the MIT License. OpenSteer was developed with the generous support of Sony Computer Entertainment America. OpenSteer is supported on Linux, Mac OS X and Windows.
Last modified: October 25, 2004