Hacker News
a day ago by cwkoss

When I was learning to program, I tried to make a toy artificial life evolution simulation. Particle organisms on a 2D plane had 'dna' which was a list of heritable traits, like size, speed, number of offspring. Bigger organisms could eat smaller organisms, but they burn energy faster. 0 energy = death. When two organisms of opposite gender collided and had sufficient energy, they'd give some of their energy split among the offspring, with each offspring's 'dna' values set to one of the parent's +/- 5%.

As I was developing this, I hadn't figured out how I wanted to do food yet, so as an easy first step, I just had a constant amount of energy that was split amongst all organisms on the screen. Lots of little dots buzzing around, was kind of neat but nothing too special. I left it to run overnight.

When I came back I was very surprised: previously i was running at about 30FPS - now it was running at about 4 seconds per frame. The screen was filled with dense expanding circles of tiny slow organisms emanating from where organisms had mated and nothing else.

My simulation evolved to outsmart my simple food algorithm: when food is divided equally among all organisms, the best strategy is to use minimal energy and maximize offspring count. I had populated the world with a default offspring count of ~5 and they had evolved to the tens of thousands. The more offspring an organism had, the greater the amount of the energy pool would go to their offspring.

It was a very cool "Life, uh, finds a way" moment - that such a simple toy simulation of evolution was able to find an unanticipated optimal solution to the environment I created overnight was very humbling and gave me a lot of respect for the power of evolution.

a day ago by raldi

Decades ago I read about a simulation aiming to evolve creatures that could walk, or one day run. The fitness function that determined how many offspring you get was “maximum speed ever attained in your life”.

They let it run for a while and came back to find all the creatures had evolved into extremely tall, thin stalks that would tip over and never move again. The top would be moving very fast before it hit the ground.

a day ago by ALittleLight

I worked on a similar project. One of the heritable traits I had was a quantity of energy that would be passed on to a child. A mother and father organism contributed a random half of their stats to a new child and both parents deducted their caretaker energy and increased the child's energy by the same amount.

I had a lot of different graphs to show me stats as the simulation continued. One thing I noticed was that after a while of this simulation "average age" started to go way up.

At first, I was proud. I thought I had evolved creatures that could live indefinitely in my simulated environment. I kind of had - but it didn't work like I thought. At some point the creatures seemed to become immortal and all new creatures died off. I was monitoring "average age at death" which confirmed all the dying creatures were very young and "average generation count" which showed it stabilized midway through the simulation and then locked in place. They got to a place where new organisms died off and there were a bunch of immortal organisms running around.

I finally figured out what had gone wrong. The stats, including caretaker energy, could be randomly modified by a small random value up or down whenever a child was produced. Nothing prevented caretaker energy from going negative, and indeed, that's what would happen. The simulation would work for a while while only a small number of organisms had negative caretaker energy, but eventually these guys would take over and become the whole population. They could indefinitely sustain themselves by having children, but their children (spawned by two parents who passed on negative energy) would instantly die.

a day ago by Matumio

There is a 2018 paper called "The Surprising Creativity of Digital Evolution" which is a collection of similar anecdotes: https://arxiv.org/abs/1803.03453

a day ago by rsiqueira

Thanks, great paper! "Many researchers in the field of digital evolution have observed their evolving algorithms and organisms subverting their intentions, producing unexpected adaptations, or exhibiting outcomes uncannily convergent with ones in nature. Such stories routinely reveal creativity by evolution in these digital worlds."

a day ago by cwkoss

Karl Sims is a nice Aptronym for someone who studies evolution in physics simulations.

14 hours ago by carlob

Though Charles would have been better...

a day ago by cwkoss

My goal with this project was to be able to seed the world with a single proto-organism and have two distinct species - one predator and one prey - evolve to create a stable ecosystem.

I eventually localized food sources and added a bunch of additional rules, but was never able to realize this goal. I think for predator-prey relationships to evolve in my system it would have required sensory organs and methods to react to local environment.

Seems like ALiEn is able to simulate food chains with distinct species - and alas I don't have a CUDA GPU - but curious if they've been able to create an ecosystem where predators and prey can coexist in a balanced stable ecosystem. (In my experiments, it was very easy to get predator population explosion, all of the prey gets eaten, and then all of the predators die)

a day ago by eloff

In the real world what prevents this outcome? Humans aside. Because it's uncommon. Ecosystem diversity? Pathogens?

6 hours ago by cwkoss

I think this probably happens sometimes in the real world. However, there usually aren't ecosystems with only two species. Most predators eat multiple prey species, so a predator may hunt the "easy" species to extinction leaving only the harder-to-hunt species remain, which causes the predator population to fall as only a subset of the predators are able to succeed in these harder conditions.

Cicadas could be another example of a strategy to deal with prey-decimation - by only emerging every N years, food sources have time time to regenerate between cycles. Similarly, many large predators are nomadic - so as they reduce prey availability in one area, they choose to look elsewhere, giving the prey in that area time to recover.

I think geography and terrain also helps a lot in the real world: prey is usually smaller than predators and thus has more hiding spots. Maybe I should have implemented a 'turtling' mode, where organisms could spend part of their time immobile and invulnerable, but also not gaining energy, as a way to prevent predation. I think sensory organs would still probably be necessary to make that strategy work.

8 hours ago by nitrogen

Sometimes the prey can hide?

a day ago by smusamashah

If you managed to evolve huge organisms eating lots of small ones while both species survive than that was a predator and prey stability.

5 hours ago by cwkoss

Yeah, I was able to achieve short temporary equilibria, but in every case the predators would slowly die out (and re-evolve later, and die out again), or they'd be too successful and kill everything.

a day ago by abra0

>The Autoverse is an artificial life simulator based on a cellular automaton complex enough to represent the substratum of an artificial chemistry. It is deterministic, internally consistent and vaguely resembles real chemistry. Tiny environments, simulated in the Autoverse and filled with populations of a simple, designed lifeform, Autobacterium lamberti, are maintained by a community of enthusiasts obsessed with getting A. lamberti to evolve, something the Autoverse chemistry seems to make extremely difficult.

https://en.wikipedia.org/wiki/Permutation_City

a day ago by wincy

I read that a few years ago, probably because it was recommended here on HN. Absolutely wild book.

a day ago by spicybright

It seriously flipped my view of the world on it's head for a bit. Then I read it again right after lol

a day ago by leblancfg

Thank you for letting me find my next read! Loved Egan's Diaspora years ago, looking forward to this one.

a day ago by arrow7000

Diaspora is one of my all time favourite books

a day ago by throwaway6734

This book is absolutely fantastic. Egan is a magnificent writer.

a day ago by Hwatwasthat

He is, but sometimes I go cross-eyed reading his books. He likes to explore some crazy topics, which makes for great reading but sometimes confusing reading too.

a day ago by sooheon

Yeah, that's why my favorite way of reading him is via his short stories. Just enough to get the big idea across and not get lost in too much detail.

a day ago by nynx

What a coincidence, I just reread that section of permutation city yesterday.

I wonder if there is an efficient cellular automata that vaguely approximates the behavior of real chemistry, just like the autoverse.

It's a shame the garden eden configuration plot point is kind of bunk.

a day ago by alisonkisk

Stephen Wolfram says yes.

2 days ago by nerdponx

Since the title isn't informative: "ALiEn is a GPU-accelerated artificial life simulation program." https://alien-project.org/

2 days ago by Narishma

Nvidia GPUs only.

a day ago by TuringNYC

I've written a lot of software against GPUs, albiet some years back. The main challenge was that many of the best libraries had CUDA support (or CuDNN support on top) but not support for other GPU lines' frameworks.

Getting CUDA to work well is hard. Not hard on your laptop, not hard on a particular machine but hard to work everywhere when you dont know the target environment beforehand -- there are different OSs, different OS versions, different versions of CUDA, different cards with different capabilities. But we did get it to work fairly widely across client machines.

The same effort needs to be put into getting things to work for other manufacturers, except a layer deeper since now you're not even standardized on CUDA. Many companies just dont make the investment. Our startup didn't, because we wouldn't find people who could make it work cost effectively.

What I really wish is that the other manufacturers would themselves test popular frameworks against a matrix of cards under different operating systems and versions. We see some of that, for example, with the effort of getting TensorFlow to run on Apple's m1 and metal. I just dont see a random startup (e.g., mine w/ 12 employees) being able to achieve this.

For example, if I know from the manufacturer that I could get TensorFlow X to work on GPU Y on {Centos N, Ubuntu 18/20}, I would gladly expand support to those GPUs. But sometimes you dont know if it is even possible and you spin your wheels for days or weeks -- and if the marketshare for the card is limited, the business justification for the effort is hard to make. The manufacturers can address this issue.

17 hours ago by MillenialMan

How viable is it to replace CUDA with compute shaders?

a day ago by hhh

Why not use the Nvidia docker runtime and put your application in a container?

a day ago by croes

What about OpenCL?

a day ago by raphlinus

A simple artifical life / cellular automaton framework would be a great demo for portable compute shaders. I'm looking at this as a potential starting point in my compute-shader-101 project. If someone is interested in coding something up, please get in touch.

a day ago by nynx

I'd love to help with this. I've been experimenting with rustgpu + wgpu, so I'd personally go there first probably.

a day ago by UncleOxidant

And Windows 10 only :(

a day ago by hyperluz

What would be the best alternative? OpenCL? Vulkan?

16 hours ago by maeln

Nowaday I think it would be SYCL. It use the same kind of "same source" API that CUDA propose and is portable. Technically it can even use a CUDA backend.

a day ago by raphlinus

OpenCL is sadly stagnant. Vulkan is a good choice but not itself portable. There are frameworks such as wgpu that run compute shaders (among other things) portably across a range of GPU hardware.

18 hours ago by naavis

OpenGL Compute Shaders are one option too.

a day ago by jdonaldson

Wanted to give a shot out to Larry Yeager who wrote software for this all the way back in the mid nineties : https://en.wikipedia.org/wiki/Polyworld

He was a professor of mine in grad school, he also did visual effects for The Last Starfighter, and the early work on character recognition in the Apple Newton. Cool dude.

a day ago by carbonguy

Continuing the thread of other individuals who've done interesting work in this area, I've always been a huge fan of Jeffrey Ventrella's "Gene Pool": http://www.swimbots.com/genepool/

His fractal art is quite compelling as well: http://www.ventrella.com/

a day ago by jordibc

Yes, cool dude indeed! Glad you mention him, I was thinking of him when I saw this article. He visited the group where I was doing my PhD many years ago and also gave a fantastic talk on evolution, learning, and artificial life -- I was quite impressed. He has some cool stuff in his website too (http://shinyverse.org/larryy/).

a day ago by ehsankia

Also relevant is Karl Sims' Evolving Virtual Creatures:

https://www.youtube.com/watch?v=JBgG_VSP7f8

Not sure how they're connected, but I remember being obsessed with that paper and actually recreating it in 2D as a grad project.

a day ago by JoeDaDude

Not sure if this is just for fun or for research. Artificial Life is/was a field of ressearch for a while, papers were written, books were published, [1][2] etc. The field sought to study biology and the complexity of living things by experimenting with simulations of the real thing(s).

This reminds me of what IMHO is best use of artificial life in a game, Unnatural Selection. In the game you had to select and breed creatures to go against other enemy creatures. [3][4]

[1] https://en.wikipedia.org/wiki/Artificial_life

[2] https://www.amazon.com/Artificial-INSTITUTE-SCIENCES-COMPLEX...

[3] https://www.mobygames.com/game/unnatural-selection

[4] https://www.youtube.com/watch?v=zteY_f9DrQA

a day ago by borrowcheckfml

It's still an active research area and the alife conference [0] is quite popular

[0] https://alife.org

2 days ago by scottrogowski

This is amazing. My question is whether there are emergent structures in a long-running sandbox environment? The videos that were posted appeared to have quite complex structures but it was unclear whether they were designed or if they "evolved" from earlier more-basic structures. Would be curious to get the author's take.

a day ago by ericbarrett

I wrote a (much less fancy) cellular automata program I called "evol" [0]. It simulates organisms on a flat grid. They have opcodes which are randomly permutated from time to time. If they can collect enough energy, they split; if they lose too much, they die. Having more opcodes costs more energy. There is no hinting or designing; everything starts with a simple "MOVE_RANDOM".

If you leave the program running long enough, they do actually evolve different behavior. Specifically, they will learn to recognize that there are other lifeforms in a direction and then move the opposite direction, reducing competition over the fixed amount of energy in a cell. You can actually see the population density rise when this happens. Since the grid wraps, you will generally get them "flowing" in one direction, cooperatively.

The world is simple and boring and it doesn't have graphics. Also, since the naive "Dna"/opcodes I chose use branching and random number generation, it's very slow and can't be simulated on a GPU.

Fun project nevertheless. The last few months, I've been slowly rewriting it in Rust and adding more stuff like terrain height. Haven't published the Rust version yet as it's incomplete—got hung up on the poor state of its terminal libraries.

[0] https://github.com/ehbar/evol

19 hours ago by scottrogowski

Very cool. Interesting to hear that they actually managed to evolve. Would be curious to see what happens when they can eat each-other. Though I recognize that might be significantly more complicated

11 hours ago by ericbarrett

I’ve been thinking about that for the rewrite! Maybe some chance to incorporate snippets of opcodes from the consumed.

2 days ago by danielvf

Most of these look very designed, though "emerging" from simple rules on agents/particles.

Others look evolved inside the sandbox. (see doc here: https://alien-project.org/documentation/Evolutionexperiments...)

2 days ago by harpiaharpyja

One of the YouTube videos claims that they are self-replicating structures that were "evolved" in another simulation. So possibly the appearance of being designed comes from the fact that they were selected from the best of whatever was produced by that other simulation and placed together for a video.

19 hours ago by scottrogowski

Not a biologist but I understand that isolation is an important factor of diversity and by default, this simulation wouldn't have that. So it makes sense to evolve in different areas and put them back into the same area.

a day ago by criddell

Have you ever seen http://boxcar2d.com/? It requires Flash so it probably doesn't work anymore, but it used genetic algorithms to "design" a 2d car to travel over bumpy terrain.

It was ported here https://rednuht.org/genetic_cars_2/ but it's not quite the same thing.

2 days ago by undefined
[deleted]
2 days ago by danielvf

Reminds me of my favorite programming game that no one has heard of: http://grobots.sourceforge.net

(Old video of grobots in action at https://youtu.be/BLXKedZHls4?t=801)

Alien looks awesome!

a day ago by hypertele-Xii

Then there's Core War from 1984 [1]. 11 years ago I computationally evolved a warrior (a program competing for virtual resources) and submitted it to the nano hill [2], it's still ranked top 20 to this day. Every few months the hill emails me the stats of someone trying to beat us with a new warrior :)

[1] https://en.wikipedia.org/wiki/Core_War

[2] http://sal.discontinuity.info/hill.php?key=nano

a day ago by sackerhews

This is why I like reading the comments on HN. I'd never heard of Grobots, it's brilliant!

a day ago by buescher
a day ago by Udik

There is an old artificial life simulator (darwinbots http://wiki.darwinbots.com/w/Main_Page ) that is inspired by grobots-like programming games. Each organism is driven by its own code that can mutate randomly at each reproduction.

I've been trying to produce a web version of it. This is where I got so far (before more or less desisting):

http://darwinjs.herokuapp.com/

a day ago by Tempest1981

Nicely done! Very fluid.

a day ago by Udik

Thanks!

a day ago by hut0

There's a similar project that runs right in your browser:

https://exophysics.net/

It's more simple, and more about physics than biology, but the emergent phenomena are pretty interesting nevertheless. This universe comes the closest to a life simulation: https://exophysics.net/exhibit/mordial.html [based on the Primordial Particle System, https://www.youtube.com/watch?v=makaJpLvbow]

16 hours ago by ShamelessC

https://exophysics.net/exhibit/ogneron.html

Pretty cool! I see some rare behaviors like maybe there is a weak magnetic property and certain combinations of particles are more prone to it than others? Trying to rationalize this behavior I see after about a minute where some "molecules" seem to start trailing others.

Daily Digest

Get a daily email with the the top stories from Hacker News. No spam, unsubscribe at any time.