________________________________________________________________________________
I made this simple 2D simulation of life using Rust. I find it fascinating to see how complex patterns can emerge from simple rules, and how well natural selection works!
The code is not extremely pretty, but I'm happy with the results. I'm quite amazed that I was able to port the whole thing to the web with very little effort!
Macroquad is great, it does make that virtually effortless. Nice work!
I had to close the tab because I know I will stare at it for a while and I'm at work. Really interesting.
Is the "biot" name a reference to Rendezvous with Rama?
Question - it seems you explained what all the colors do, but what do the different shapes mean (squares and circles)?
Square indicates intelligence, which allows them to move non randomly towards the nearest edible biot (it’s on the page right after the bullet points).
This is awesome, thanks for sharing. I may tinker with it
This is extremely cool! I wonder how much work it would be to bundle it up into an XScreenSaver-compatible binary.
Edit: It looks like running it locally on X11 is trivial, so this should be easy to do. I'm trying to hack it together now :-)
That would be great. Another awesome screensaver is called substrate and included in the set 1) by Jamie Zawinski ( among the founders of Netscape and Mozilla ).
1)
https://www.jwz.org/xscreensaver/
Anyone else getting an edgy anti ddos message?
You can avoid that by not sending a Referer header with your request.
jwz's default redirect for HN is well known[1] (and, IMO, apt).
[1]:
https://news.ycombinator.com/item?id=25801699
That would be awesome :)
Looks like it won't work out of the box, unfortunately, since {macro,mini}quad doesn't support a custom X11 parent window :-(
But I've opened an issue upstream to track functionality in the renderer that would allow this[1].
[1]:
https://github.com/not-fl3/miniquad/issues/250
This is neat! The simulation didn't remain "stable" for me for very long though; biot count pushed over 3000 and I dropped to just a few fps. I'm on a phone and I'm also a bit color blind so I'm probably not the ideal use case.
If you wait for a few more minutes, it's highly likely that a predator will emerge. Maybe you were just unlucky though.
I made it to 8500 before an effective predator evolved. Glad I waited, it was neat.
Much more interesting than Conway's game of life! Thanks for sharing.
That looks really cool! What graphics library did you use or did you make your own?
Also how did you compile rust code for the web? And were there any challenges with it like weird browser issues?
Answer to both questions:
Could you add some keyboard shortcuts to make it skip a few dozen generations?
Awesome! Now you gotta port it to wgpu and run the simulation on the GPU!
I would love to learn how to do that!
I'm not certain it would improve things, though, as the most time-consuming step is computing interactions between biots.
Yeah, by computing on the gpu (or by using a spatial partitioning system like a quad-tree), you could probably speed that up massively.
Oops, you're already using a R* tree!
:-)
Is this a specific algorithm, defined like conways game of life? I have never read any Rust source code, so I would like to unterstand it generally...
This is closer to real life than Conway's algorithm. Biots are able to move freely, have a very simple genome that gives them unique characteristics, and natural selection does the rest. There is a succinct description of the rules at the bottom of the demo page.
This is super nice: I sat for nearly 10 min observing how the numbers go up and dow and how they consume each other.
Neat. Is there a way I can use this as a screensaver on linux?
Check woodruffw's comment above. He's trying to do just that :)
Because it is written in Rust, this is the most secure life simulation to exist.
Believe it or not, there is an annoying bug in the R* tree crate I use that causes it to occasionally panic. I added a very ugly workaround that seems to work quite well though :)