Show HN: Procedurally Generated Artificial Life
kirkas.com
kirkas.com
note: I have mostly tested it with Chrome and briefly with Firefox so there might be problems with other browsers although the code is plain javascript without anything too special.
The colored pixels/boxes are the "creatures" which are basically virtual CPUs that run code in a custom assembler-like programming language. I just did an improvement so now the code is a tree-like structure.
The code evolves with mutations, there are various different mutations that modify the structure.
The green dots are "food" that the creatures can and must eat to survive. The food is distributed in patterns that vary over time to make the landscape "interesting" and to facilitate improvement in the creatures.
Each food gives X amount of energy, when the energy runs out or the creature gets too old (currently at 2000 command executions) it dies.
Running in a browser opens a lot of possibilities - for example I'm planning to set up a server to connect the world on different computers. I think I'll set up a possibility to open portals between worlds or something similar - I don't have the details though in detail yet.
Instructions for the buttons:
Brush - this defines what mouse does. There are different modes
Inspect - shows the creature you click
Food - plots food
Create - creates new random creatures
Kill - kills creatures
Mutate - mutates creatures that brush touches
kill-and-create - first kills creatures under the brush, then generates random new creatures
Redraw every: After how many rounds is the screen redrawn. Faster redraw rate slows down the system. Good compromise is 100 but if you want to really see what's happening, you might want to use 5 or 10 rounds.
Now button redraws the screen immediately.
Mutation % - when the creature multiplies, at what % is the creature mutated
Mutation deletes command, creates command, switches command to new random command or mutates a parameter.
Food model selector:
Random areas - random areas that grow food at different intervals and formations.
Islands - 9 islands containing food spread across the screen. No food elsewhere
Full map - randomized fixed size areas of food.
Isolated grid - similar to islands, lots of non-connected boxes of food that grow on different rates.
Number after food model - how often is the food model changed. This randomizes food areas based on selected model.
Now button - randomizes the food areas when clicked
Buttons:
Pause - pauses the simulation
+ creates 100 creaturs
- kills approximately 10% of creatures in random
M mutates approximately 10% of creatures in random
Save - saves current world (locally to browser)
Load - loads the saved world (locally from browser)
Here is an example of a program from a live session: if r0 > r1
if r0 < r2
set_reg r6 = 86
copy_reg r2 = r1
subtract_reg ro -= r5
inc_reg r0 += r5
push_stack 2
if r0 > r8
if r0 > r7
set_signal 1 r1
wait
get_creautre_reg r0 => r0
attack
push_stack 4
copy_reg r3 = r0
if r0 > r4
get_energy r0
get_creautre_reg r5 => r0
attack
wait
multiply
get_signal 0 r0
turn_left
get_signal 0 r0
eat
I do have plans to publish the details of the (experimental) programming language and maybe let the users to create programs. I think that would be very interesting.