CA on ANN on GA

telepathic-critterdrug is a fork of the excellent ecology sim and artificial-life evolution lab Critterding which, if you haven't tried it on its own, is a little bit faster than this.

Download telepathic-critterdrug for Linux [feb 25: tried to fix this sticking problem when rewinding the psychic tape. jan 16: reduced size of hill in testworld1.cpp, fixed where bullet might not have been compiling anymore for some people]

Or, look, for Windows! [nov 29 2014: critter_sightrange might be more of a speed factor in this. i mean in windows. the latest windows version is finally caught up with the last public linux version, hill world/testworld and some other bugs fixed. When I get my hard disks back in a couple weeks, I'll be uploading some code for this and other projects of mine, from the last two years I spent off-line, at my place. ]


Here's a talk sort of about why I did this. Terence McKenna was one of my biggest inspirations to add drugs to this sim lest it help foment consciousness, art, religion and language, as he theorized. He talks about entities in virtual spaces, that make machines that make machines, in that direction I just want to say I'm considering an artifact manufacturing system for these animals so that they can make little machines that will have neural nets but no head or eye. The machines will not be able to make other machines. But it's a step in that direction :)

I think our reality is probably a simulation. There are a lot of clues. I also believe all neural nets are at least slightly conscious for some reason that involves the class of problem a neural net comprises. I think consciousness concresces around certain types of problems.

Find a sample species under the guide

Here's some other toys in case I die soon -- evolving text learner and mutator. really fun -- just fuzzes text without learning it, included in markov-attract-repel as a function -- a math toy. makes series out of the sums of digits in other series. try it on powers of 2 and their results. real fun -- ok so if you use like powers of 2 in base 10 in you get really alarming results like the 487 is a math chip on earth so here's one with justsum set to 1, much faster so if you're working on like series of numbers and some of them are very long this one only gets the sums of digits, no subtractions, if you use those then it says 512 faster but doesn't say 487 anyway i better go flamoot -- to break up documents numerologically, requires perl and, and isn't done

See the file INSTALL for instructions. (Don't mind the warning about memory leaks, it's outdated. You can still use the included gc lib if you want. Set CXXFLAGS before running ./configure if so.) The resulting binary will be called src/critterding... the home dir is still ~/.critterding. These should both change to "drug" later on

Just start the thing, add some food ('+') and tune the settings in F6/F7 until a species takes hold. How long it takes for a species to appear, terminating the random search at the start and beginning the optimization/evolution phase, depends on your settings... 600 food is lots, and hefty to simulate on most machines, so if it seems to take more than that, consider using a smaller world

Hit F5 or click 'tv' to open the psychic screen. (F8 dismisses the HUD) On here you can see critters which have psychic motors writing colours while substrate behaviours the population votes on stripe, page, blur or ghost the images. Hit T or Y a few times to see the different modes available. Between each pair of modes is a paused one, you can use this to see better where your critters are drawing. Hit U when you're done to give control of the grid back to the population. This will also happen on a time-out, in case you forget

Still around? Notice you can mouse-over most objects for a little data on them. Left-clicking a critter opens its brain view and some controls. (Don't worry about the draw order issues in the critter's eyesight thumbnail in this window. It's not even a real thumbnail, it's somewhat larger than the real retinas you see in the lower-left. If you look at those, you'll see that clipping is done properly there, which is what the animals really see... still, sheesh, you worry a lot) Right-clicking one or any other object picks it up. The mousepicker doesn't work like in Black & White yet and you may pull things through the floor at certain angles but, trust me, it is definitely good enough. You can use the mousewheel to zoom.

To recycle the randoms faster, increase the costs in F7 or decrease the critter lifespan in F6. While we're there, get that autosaveinterval down from 86400 seconds (once a day) to something reasonable like 7200 (two hours)... I don't know how the default got way out there. Listen to me: if you click and hold on the Minus widget, then right-click, then release the left mouse button, it will stay held down and you can dismiss the window until the value runs down to something reasonable. This may take a couple of tries. Then just click it again to stop

Unless you set the evolve_set_to_grey flag in worldb.h to 0, and rebuild, there are energy rewards available for brightening the bottom of the psychic canvas and darkening the top. If your species seems to be powering itself this way instead of using food, turn up the cost of firing motor neurons in F7, and add food. You can also try raising max and procreation energy since the rewards are constant and don't scale with those values. Finally I will add a profile flag for this, soon, though it's integral to getting them to care about the shared grid quickly...

The fine brain mutation settings in F7 (other than number and rate) are only set on random animals, then those original values are copied to their children, so if you change those while a species is already in there, hit 'k' a few times to replace them. Or you can just edit their savefiles. This is because those values are mutable but it is annoying until you get used to it. However, body mutation settings in F6 are immutable (not per-critter) so you can tune those with immediate effects.

Note that the mutation type distribution settings, which begin brain_ or body_percentmutateeffect should, in either case, total 100. If one's total is over 100 effects can get skipped altogether so have a calculator around when you rebalance these

I might release some scripts later on to help use screenshots/the image viewer, etc. If you put 64x48 pnm's as ~/.critterding/screenshots/scrn.pnm and set show_scrn.pnm_every to something higher than 0, you can display images on the shared grid. (The pnm's have to be 18k, not 9k like some people seem to get from convert. It might depend if your system is 32-bit or 64. I'm not sure. I'll support the other format soon I hope!) Don't worry about this for now

If graphic rendering doesn't seem to be the bottleneck, I'd turn up the critter_sightrange to 300 or more. That should be enough to see all the way across the default world, although most critters won't be looking at the horizon until they're a bit evolved. Try increasing it and see if your fps stay the same.

On the other hand if it's already slow, set killhalfat to something reasonable -- 30 being 'risky' and 20 being 'very low'. If strain populations aren't allowed to get to a stable size between kill-halfs, the evolutionary process will slip, and you'll get increasing generation counts without a rise in fitness. Running the largest population you can is key.

I try never to hit kill half, and instead tweak the simulation so that the population stabilizes under some decided limit. If you can configure the energy values so that the amount of in-world food responds sharply to population changes, then keeping the population within a range is easy, but it will depend on the animals you get

Hit 'S' to save your profile for later. It will be called 'default' and dropped in the present working directory. (In the Windows version it may go somewhere weird near "My Documents". What? Oh never mind, it is in the PWD after all. But watch out for this later) Load it later by running the critterding binary with the argument --profile default. Look in that file for settings not in F6/F7 but that are still important, like pill dose and pill lifetime, autodrug, autoload, and a bunch of others.

A particularly interesting one is anim_screen_every, which lets critters get a better look at the psychic screen before it moves. They can vote in ways that preserve the image even with this at 1 (the default), but it's not common, and one day I realized that it might take more than 1 frame for a colour to convert to a firing rate... anim_screen_every can really be set to anything. If you change it, just choose something low enough to be entertaining and high enough to be educational. Several of these strange new settings will appear in a third option window, soon.

If you want to save and quit, but resume later, remember to copy your critters from the most recent save directory in ~/.critterding/save/profilename, and their movie from the movie/ subdirectory there, to ~/.critterding/load and ~/.critterding/load/movie (the script, bundled by accident, does this for you, if it works [src/ profilename ... it will also attempt to remove the latest save dir, in case it's empty, so be sure to specify an argument])... setting autoload to 1 will bring in critters automatically, autoload_movie does the same for the p-screen. Otherwise use PgUp to load critters and "Load TV" on the HUD (F8) to import their movie. PgDwn and auto-save always save both at once. Note that in Windows these directories are actually somewhere weird near "My Documents" (what?)

Now give it a few hours. Good luck and happy hacking. flamoot

Here's a tool in Python to show some stats about your animals including graphing the sensors they use for sight and motors they use for telepathy, iirc

Instead of waiting for your own species to evolve you can try my "foodotropes" which demonstrate response to eyesight and basic socialization but don't use the psychic screen yet. Well they only have a hundred neurons. Extract these in ~/.critterding/load. The profile is there as well.

Just hit PgUp to bring them in. But not in the windows version, the steps of the hill are still too high there. Maybe they will work though, still.

So OK Windows users, or anyone really, can still try these older foodotropes instead which live in a flat world and use sight another way, over longer ranges, which is still cool

caveats in this release
F1 help window now shows the right keys

With autocam on, animals might not be pickable/tooltippable at certain zooms. Just spin the mousewheel in this case. I think this only happens in testworld (hill world).

In race mode, autocam will snap to an animal, but not follow it. This is expected but I still may fix it. It doesn't seem real important. Having autocam follow the winning critter in race might be a good idea still

mutate_mutateEffects was borked before. It's now repaired and available to you and your critters, so give it a try if the brain mutation type distribution you've set doesn't have some special meaning. Note that flipping it on in F7 won't set it to true for critters already in-world (just new ones after that)... you'll have to set it to 1 in your .cr files by hand if you have a species you want to try it with.

The bias to survival-related sensors/motors, over psychic ones, has been lowered to ten percent. If you sense this is too low (and don't mind critters with hundreds of connections to each tactile, age, and energy input) you can raise it by opening src/brainz/brainz.cpp and changing lines 443, 508, and 778 so that where it says get(1,10) > 1 it says get(1,10) > n (where n is 1 to 9, unless you prefer a bias of 0% or 100%!) ... remember to rebuild afterwards. You can also try even lower biases if you want to focus on telepaths/infovores. Just raise the value of 10. I should have a profile setting for this soon. The bias compensates for the fact that there are thousands of times more retinal and psychic inputs than there are of other, more important inputs that have to be hooked up at least one time. The same applies to motors. So this just chooses one of a pre-selected set of survival-related IO's, over the usual random one...

Configurables in src/scenes/entities/worldb.h start at evolve_set_to_grey = true. Set this to false if you want to prevent them gaining energy from any kind of telepathy, otherwise they can earn a little for brightening the bottom of the canvas, and darkening the top (for fire mode). This might be extended to reward them for implementing the rules of some CA, like Conway's Life, eventually. You can also change the max pop here. These values should be 'false' and 'very high', respectively, in a release, but I forgot to reset them from the values I was using when I released the last snapshot. A good invitation to start hacking it yourself I guess.

Particle settings are also in worldb.h including particles per bite (density, halved for cannibalism since it takes so long) and max particles

A fully fed critter may spawn a ton of particles trying to finish a piece of food

Thanks for reading the caveats :3

Current version may have a super rare segfault, when you hit 'z' to move the autocam to a previous animal. And maybe when you hit 'q'. It is in worldb.cpp's goto_critter() and I should have a fix pushed soon. (I actually think one of my kludgy workarounds to this has got it squashed)

There are two physics bugs I still have to squash. None are crucial, all are annoying

If a body mutation results in an overlong or otherwise pathological constraint (resulting in a very long, stretchy animal), I'd appreciate a copy of the critter in question. I'm trying to zero in on this at the moment, specifically which operation is responsible. It doesn't seriously impact evolution (the offspring is just unfit and will probably never breed) but at 100% body mutations, it shows up pretty often.

Some critters seem to transfer momentum at times for no reason. This may be visible in a population of randoms if you grab and release one repeatedly near some others. It is probably less noticeable with self_collisions off. Whether it's limited to mousepicker events such as this or not, I will discover in time >_<

The critter retina thumbnail in the brain view box is wrong but informative. Visual/psychic cortex renderings in same are incomplete but entertaining

Brainview needs a close button

Thanks for reading the bugs >:3

early run with morphogenic fields
getting big critters started on a new run
a little later in the run
.75M frames in 2 minutes [video]
fairly good 5 minute movie of condensed motors mode, with an electronic psychological halt [video]
a 5 minute run continuing the last, this time without pauses. goes all silver, gold and mother-of-pearl eventually [video]
early implementation of visual/psychic cortex views, on drugs
more cortex views still on drugs
a telepathic-critterdrug experiment
same experiment later on
fire animation substrate behaviour [video]
population-controlled substrate behaviour

differences from critterding
This section is old. If you take it on faith prepare to be surprised instead

We've made the following changes to the superb parent application...

To substrate: critters gain a 64x48 shared retina, animated through time as 1024 frames play forward than in reverse. They can make writes to this retina that will affect all the other critters and so use it for communication, art, or war. The screen scrolls over time to help teach them its dimensionality. F5 brings it up. This used to bring up the population graph, you'll have to use the HUD (F8) to do that now. The graph also now charts neurons and synapses but doesn't work quite as well. Hit T to pause/unpause the psychic screen/racial movie and view a still frame as changes are made to it, but this will probably mess up critters who are accustomed to it softly scintillating, or whatever, so do unpause after

To environment: we added a selection of psychoactive tablets. The new profile parameters are pill_energylevel (dose), pill_maxlifetime, pill_maxtrip (max allowed onboard dose of each drug), and pill_size. These serve as agonists and antagonists for the two main types of neuron, and a fifth drug acts as a potentiator.

To critters' brains: motors to blink were added, for both the main retina and the communal hallucination screen. Three motors to select in binary a write intensity were also added as well as hundreds of inputs and outputs for reading and writing the screen itself. "Touching pill" input was added. Some other stuff

64-bit fix
although critterdrug should build normally on 64-bit, if you get a link time error, try the following before running ./configure
export LDFLAGS='-L/usr/lib64'

freetype fix
If you get build errors associated with ftgl, try the following
./configure CPPFLAGS="-I/usr/include/freetype2"
or if all else fails
cd /usr/include
ln -s freetype2/freetype .

No this won't wreck your system. You are probably in Ubuntu
That's telepathy

From Slashdot and some prior drive on Jan 10th I've emitted about 3000 copies so I sure hope they're working right. You can still mail the address at the end with questions, I'm not really getting any now. Or try #critterding

jan 16 2012:
* hill world flattened somewhat (set testworld to 1 to use)
* bullet compile bug worked around

mar 10 2011:
* fixed critter psychic vision to be locked to striping window not frame edges though morphics are still aligned to frame boundaries which makes sense in this model sort of
* fixed other things
+ critters have a pen their offset motors can move around the screen
+ autocam debug output

dec 22 2010:
+ body_selfcollisions flag ported from critterding, just set it to 1 if it keeps a species you enjoy from working properly
* default settings re tuned
* p-screen fire effect no longer bleeds at frame boundaries
! three releases this week. wow

dec 21 2010:
+ follow cam added (hit 'A') for those of you with animals that might squirm out from under the microscope...
* mutate_mutateEffects fixed
* non-psychic sensor/motor biases to lowered to 10%
* body and brain mutation type percentages now total 100 by default

dec 17 2010:
+ particle system added for bites, particles are edible/pickable
* race/testworld fixed, now you can evolve for distance moved or with hills
* some speedups
* many small bugfixes incl to blinking and touching
* help window shows right keys
* biases added to the GA in september

may 24 2010:
+ ability to show images using 64x48 .PNM files. recommend using a ramdisk for ~/.critterding/screenshots directory. look for show_scrn.pnm_every in profile (hit 's' to write one). showing critters screenshots of their world will let them match the colours between the psychic and regular retinas.
+ too many to list (also broke savefile compatibility that time sorry)
* dendrite values were being destroyed
* critters informed when a head touches them

feb 25 2010:
+ huge drug effect fix (only worked with my CXXFLAGS .-. )
- at some point i borked the morphic fields (might have just been my flags suppressing the real behaviour)... if you see the whole damn thing turn white and their neuron potentials bottom out, wait a week for a patch

feb 20 2010:
+ psychic substrate behaviour is electable
+ fire, scroll, disperse and collect effects added to substrate
+ keys to drug the whole population: hjnm, and undrug, dfcvb. Fullscreen was moved to g, colourmode moved to x, and mouselook moved to / (careful!)
+ autodrug added to help get populations started, with autodecrementable doses
+ randoms have eat/breed wired 100% of the time
+ lock out voting temporarily and change psychic substrate behaviour manually with t and y keys, hit u to allow voting again
* another leak squashed
- still have to fix the graph
- possibly gained a memory corruption bug -- i hit it after ~12 hours but changed a few things afterwards too. could have just been my RAM burning up. mwa haha. if you get a crash email ty

jan 24 2010:
* fixed a buffer overrun at the end of brainz' public section. probably nothing to worry about... probably
+ enhanced critterview with buttons to add drugs, add food, blink the eye, blink the psychic field, and lock in drug levels, also dual visual cortex views for retina and group screen. w00p

jan 22 2010:
+ added a switch and profile option 'condensed_colourmotors' that uses six colour operation selection motors to divide the number of motors required to write the entire psychic screen by 6. this gives each critter write access to 6x more of the screen than its neuron count would normally allow (for telepathy not morphogenics) but they have to choose one colour operation for every cell per frame. critters need rewiring to be loaded from a sim condensed colour motors to one without or vice-versa, i use python for that

jan 14 2010:
+ added morphogenic fields using top of shared screen -- tiny automatic changes to colours based on brain activity, and tinier changes to brain activity based on colours.
* drug activity changed from additive to multiply -- morphogenic now additive, drugs will enhance its activity. This way creatures that have eliminated synapses into the grid can still be psychic on psychedelics. flamoot

- un-foul-up the pop graph
- key to clear a frame
- Option to clear the movie w/ confirm [since added import movie but still]
- Only allow writes to movie by selected critter, key toggle
- Multiple motors per neuron
- Profile settings for movie length, world frames per movie frame, movie size
- switch for morphogenic field
- drugs aren't recycled for falling off the world yet. if you want to get rid of some, just feed them to one
- a switch for energy level's effect on neuron potential
- bodiless mode for pure OCR/image comprehension evolution

old versions
- svn-old-1 pre-morphogenic fields
- svn-old-2 w/o condensed motors mode
- svn-old-3 before visual cortex views (this version and older ones have memory leaks (increase the size of tripping[] to 5 in brainz.h)
- svn-old-4 before voting and extra screen modes(also haz leaks)
- svn-old-5 before drug effect fix(may not have leaks)
- svn-old-6 some NAN's about
- svn-old-7 no biases, drug effects on graph, other stuff
- svn-old-8 before particles, race/testworld fix
- svn-old-9 before autocam was added and mutateEffects fixed
- svn-old-10 before body_selfcollisions flag (now off by default)
- svn-old-11 p-screen fire effect would bleed at frame borders
- svn-old-12 critter minds eye didnt follow striping effect, like morphics dont on purpose
- svn-old-13 testworld1.cpp used huge steps and bullet might have stopped compiling on some systems
- svn-old-14 sometimes the psychic tape jammed at the start when being wound in reverse. should be fixed now, but maybe not

extensions and commentary -- evolving the rest of the eye (or, "the problem with vision")
The psychic screen where the critters can colour is one of the big changes from Critter Ding but here's an important caveat: as far as they're concerned, there are seven primary colours in the world (between the main eye and psychic eye), not three! (Note! They may actually think there are hundreds of colour channels at first! I just figured this out. There are weird stopgaps, covered in the last paragraph as well as spottily herein, that might shorten the definition of 'evolutionary time' in this context but, read on! [Actually the main eye or retina receives four channels -- food fluoresces in Alpha or UV strongly, drugs slightly. Critter's body colours never include UV. Tripview only shows RGB, not UV, for a total of seven... arg...]) Would that I could represent the colour channels on the psychic screen (tripview or TV on the hud) as other than red, green, and blue, to the user, for this reason. This is definitely not clear, so read on: the colours have no real wavelengths in their world. Their brains might signal combinations of red, green and blue as certain potential changes at different points internally, but when they imagine a scene (a process we have no insight into at this point), it may be with seven different colour channels, not the main four, three of which appear on the tripview. They have no reason or way to know that what we see as red on the tripview is the same colour (to us) as the red pills or red heads in their physical world. As far as we're concerned the three colour channels on the tripview are some totally abstract, other thing to them.

This means you should never expect that a green psychic screen will remind them of food, for instance, even with evolved species! I'm considering a few "fixes" to this. Going to eight-bit colour for the whole application, then using a single sensor to signal every colour, possibly using potentials up to 64 with gradations of 1/4 to fit in all 256 colours, is one option, but the tripview would become much less brilliant if we moved away from 24-bit colour. Using a constant ROYGBIV palette where a colour on the tripview signals the same potential as one on the retina, though, would simulate wavelengths for them (or at least represent wavelengths!). Maybe just adding one to the potentials the green sensors signal with, and two to the potentials the blue sensors signal, would be a good alternative. This is actually the whole reason I made a blue psychic screen/tripview more calming to them, and a red one more exciting to them, and green a combination of the two, morphically (not telepathically, morphically! There are two things that happen on the tripview -- morphic fields at the top, cybernetic telepathy on the rest)... blue drugs modulate inhibitory neurons, red ones, excitatory, and food is represented by two colours, green and UV... arg.

OK. I've given it more thought and here's the final word on the colour-channels issue (for now). Dawkins pointed out that the mammal eye is a really exquisite device. We thought we were giving these animals -- even the random ones -- an eye, when we gave them each a camera to view the world with... really, we were only giving them an image. Maybe we've packetized the rods and cones (strictly speaking, they only have cones) in a fashion inspired by the mammal eye, but we don't even provide a default visual cortex for the evolutionary process to graft the brain to. In other words, we didn't cheat nature (yet): it's up to the evolution game to provide all the wiring behind the physical retina. The neural handiwork that assembles an image in the mind, from the image that's focused on the retina, is a matter of evolutionary time first and good breeding later. Imagine that, besides having mostly normal vision, there was a spot in your eyesight where you wrongly perceived the colour green as the colour blue. It wouldn't even be your fault. That's pretty much what we're dealing with.

I'm not saying they have to evolve the physical, mammal eye that Dawkins pointed out was pretty hugely unlikely to happen on its own, or even arrive from a series of improvements to a rudimentary implementation, that rudimentary implementation being unlikely to confer a great survival advantage on its own. No... we've provided the lens, cornea, fovea (whatever that is), and retina. It's everything behind the retina that they'll have to evolve...

I've noticed that early on the critters tend to respond to eyesight almost like a sense of smell. They wave their head polling their surroundings for activation of isolated sensors to see if the objects responsible are large to them (nearby) or small and fleeting (far away). At this stage, they are not even assembling an image (of which I was crudely aware, already). But interestingly they might see each and every visual pixel as a totally different colour depending not just on colour channel but on position... at first!

What does evolutionary time imply in this case? Honestly I'm no longer sure. Sorry this section has run on so long. I just wanted to draw attention to the problem. It's up to the animals, through evolution, to assemble the neural wiring that will make the orderly, mammal-inspired camera and retina we provide act like even a compound eye. Giving them a default cortex like in my neural cellular sim wouldn't be a solution. Basically you'd be facing the exact same problem. Unless you settled for starting with very-much-less-than-random animals... which in Critter*, we don't... is an adam-distance (generation count) of 1,000 enough to assemble an image like vertebrates do? Maybe ever. Is 10,000? It's a lottery. 100,000? Then, I think, you might be pushing past insect sight... realistically you will not get to an adam distance of 100,000, however, so I'd set mutation rates high (keep the number of mutations high enough to establish a gradient, or they'll slip -- the number of mutations should also be a percentage of their size, not an absolute number, so that they don't bloat just to make mutation more inoccuous and get more healthy offspring in the face of it... I'll get this in, but for now, just tend the thing once every few days, nudging number of mutations upwards if you see this happening) and... yes... hope! All of this is still a lot of fun. I promise

Still on the subject of matching up the colour channels that recur between their eyesight and their telepathic canvas... there are things you can try, in the meantime: like taking screenshots of the app running, converting them to 64x48 pnm's (imagemagick's 'convert' being a great way, though I'll repeat the warning from the guide: "The pnm's have to be 18k, not 9k like some people seem to get from convert. It might depend if your system is 32-bit or 64. I'm not sure. I'll support the other format soon I hope!") and putting them in the 'screenshots' directory as scrn.pnm with "show_scrn.pnm_every" set to something in your profile, is one idea. If you had a dedicated box for the app and could leave it foregrounded over evolutionary time for this purpose (or a way of taking snaps from the app even when it's in the background... one should really be built in, since this is so interesting) then they (the critters) could evolve to recognize the colours on the tripview are showing the same images they see on their retina, using three of the four colours it uses, and match them. Showing the tripview as a texture on an in-world object would have the same effect and would let you minimize the app... also an interesting idea I might go ahead and put in still, likely by default in that event. A really tantalizing notion, that one. This should appear under 'caveats' but I think it's important enough to cover in the guide (this being added June 2011 and hopefully to be removed if I ever come up with a good way to give the colours unique wavelengths. Oh look it has its own section at the end now hah). Actually adding up the intensities of each colour channel to generate a position on a ROYGBIV palette which is not 8-bit, and convert it to a potential for each colour, fixed between psychic and retinal sensors, would add number-crunching but would achieve this without a drop in the number of available colours, while still reducing the number of sensors needed to cover retina and tripview to a third... only time will tell what I do about this, ultimately, but it's good to at least understand for now 2010