Jump to content

Check out our Community Blogs


Member Since 29 Oct 2012
Offline Last Active Apr 12 2018 09:55 AM

#674332 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 02 September 2014 - 08:01 AM

Nino I think I love you, goopies is such an awesome project. :P


Lol! Thank you Kad. This really gives me energy to keep going. :D



Thanks for your input, I revived my project last night and managed to get it sort of working again ... I wrote it in Actionscript 3 a while back so I did a dirty port to javascript / html5 canvas ... the speed sucks in a browser and JS isn't the best language for this kind of things ... so maybe I'll start working on my CPP skills.


I defenitely recommend using C/C++. Neuroevolution works best when it can use all of the processor's power. :)



Do the Guppy's thrusters always fire with the same intensity or is the force calculated from the NN output ? couldn't quite figure that from your answer. In my project the output is directly linked to the amount of thust so the canceling out part you described will be quite hard to accomplish since the outputs would have to be almost the same for every thuster and a big difference in thrust will get the little fellows in quite a dizzying spin  :biggrin:


You are right. Guppies' thrusters are directly linked the their Neural Network, and thus can output any number from 0 to 1. So perfect canceling is indeed very unlikely to happen. In fact, when Guppies are first initialized (and are thus completely stupid), they do little more than dizzying spins!



I found out the sight sensors in my project were a bit crude too, just letting a 'Critter' (as I called them) know the distance vector of the nearest other Critter and the nearest food. This works but I really dig your idea of giving them a virtual eye that mimics nature. How do you calculate the amount of light hitting one of the photo-cells ? I just figured I divide the RGB values by the length of the ray that hits the object ... but that seems a bit simplistic, although it works quite well.


I'd say that programming the Guppies' Eyes ad Skin sensors took about 75% of all the total work on the project! I tried several models...


Firstly I used Box2D RayCasting system to directly cast rays outwards from each Guppy eye/skin cell into the world. Whenever these rays hit another entity, the corresponding cell would fire an input into the Guppy brain. Its intensity would depend on the distance at which the ray contacted the entity. This worked well, but I discovered it was VASTLY inefficient (as for each Guppy being simulated, I'd had to cast a ** of a lot of rays. Box2D was really struggling and I could not have more that 40 Guppies running simultaneously without experiencing severe lag).


What I do now is have a single eye sensor (that has the shape of the Guppy's field of view) and a single skin sensor (with the shape of a large circle around each Guppy). When an entity enters any of these sensors it is added to a render Queue, which is owned by the Guppy that owns the sensor. On each loop, each Guppy iterates through its render queue and calculates the level of activation of each cell depending on the angle, the distance and the size of the entity on the Queue, efectively "Renderind" a 1D image of its world (in color for the eye, and monochrome for it's skin).


Figuring out how to do this was a huge pain! I even had to learn some Calculus and I'm not a good mathematician! The results, however, are crazy good. Guppies now receive a much smoother and realistic input and it's all done much faster than Ray Casting. I can now have up to 200 Guppies being run simultaneously. :)

  • 2

#671471 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 22 May 2014 - 02:38 PM

I have a suggestion to encourage hunting behaviour. At first, Guppies must have the correct input-output system to perform complex behaviour. For example, you can modify their eyes such that they can change their field of view at will. Maybe a part of Guppies will become predators, and when hunting they'll restrict their sight field to "zoom" and look better the unaware far prey. Also if a Guppy dies for non natural reasons (e.g. killed) it releases its residual energy in form of pellets (or a variable energetic corpse).
To implement 'residual energy' stuff, the first idea that came in my mind is to subdivide health system into storage and immediate energy: when immediate becomes low, some storage energy is used to reintegrate it. So, if a Guppy dies of hunger it will not release any pellet, because storage energy were completely consumed. Probably that's only a primitive draft of a better energy function (I believe that is possible doing better :P )


Giving the Guppies the ability to evolve their morphology like they evolve their Neural Nets is not something I plan to do on this first version (to do so I'd have to go back and rewrite a lot of stuff). Although I have pondered about it! Perhaps on a future version (or in a future project) I'll add agents that can adapt their body shapes as well as their brains (HyperNeat's CPPNs seem perfectly suited for this kind of thing). :)


In regards to energy and Pellets, I'm experimenting with different models now. Finding a good model is crucial to the simulation (perhaps more crucial than flexible morphology!), because it affects the fitness function directly.


I like your idea of "energy" storage. So far Guppy health and Guppy energy were the same thing, but if I allow Guppies to die of bad health (i.e. inguries, or being eaten), besides dying of huger, that would allow them to die with more energy stored in them (thus becoming "energetic" corpses). I'll keep it in mind! :)

  • 1

#671268 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 16 May 2014 - 03:07 PM

Yeah, better to save it for a later run, once you've got everything else nailed down. For one, you'd have to write a bunch of checks to perform on the target hardware to see if CUDA is even available, and branch off into the CUDA code if it detects the available hardware. Even more checks and branches if you want to support OpenCL. And then you have to provide a standard version when neither of those hardware configurations are available. A logistical nightmare if you want to make your code fully portable across all possible configurations.


Yes, yes and yes. For now, the code is not branched at all, and I'll keep it that way up until release. Nonetheless, I'll place the source on GitHub, so anyone would be free to add the extensions for the platform he or she wishes to run it on (should be quite easy to do). Who knows, perhaps one day we'll be able to test Guppies on a super-server-cluster (I know they did this with Avida). :D



I dont think this is generally correct. ;)
Parallel_for sounds like OpenMP just with templates.


It is similar to OpenMP, yes. It's role is to divide the program's workload into different tasks, which may or may not be performed on different threads. I ignore its internal workings, but hey, it really made a difference, at least in this simulation. :)

  • 1

#671115 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 14 May 2014 - 10:00 AM

I think I'm in love with you Nino, your project is short of nothing less than a beautiful piece of artwork.


Thanks for your kindness! :)
I hope that many people have fun with it when it's finally released. ^.^

  • 1

#671030 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 12 May 2014 - 12:45 PM

Is it going to be Goopies T-Shirts for the release event? :D



If you start a Teespring campaign, I'll definitely order!





I'd definitely go through the actual release first, but if all goes well, I'd be cool to design a Guppy T-Shirt! Jajaja. Almost as minimal as a Game Of Life shirt.


Although, after playing a bit with OpenGL, their design has become a little less.... opaque. :D








  • 1

#670887 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 07 May 2014 - 02:31 PM

I haven't posted in a while, but I just wanted to drop a note in here nino to let you know, I'm still following the progress of this project, and it's still of great interest to me! Great work so far, and I'm looking forward to getting to see the release!



Haha, I'm also lurking and reading everything here. I don't understand much of it. But it looks and sounds very amazing :)


Awesome to know you're still following the thread!

Hopefully we'll have a release very soon... :D

  • 1

#646753 Maze Program(Real Time) && Depth First Search Algorithm

Posted by nino on 09 December 2012 - 09:40 AM

This is cool! Reminds me of the old "3D pipes" screensaver in windows, lol. :)

It would be nice if one could see the whole maze from the beggining (while still highlighting the covered paths).
  • 1

#643047 Goopies - Evolving neural networks (w.i.p.)

Posted by nino on 29 October 2012 - 10:20 AM

Hey guys. This is my first post on the forum! And on it, I wish to share my newest invention:


After reading the post by Darren Cubitt about his Neural Bots experiment (http://www.atheistne...source=activity) I couldn't help to "extend" his original idea and give it my own little twist. So far, this has been the result.

Goopies are little bi-dimensional creatures that live on a closed circular world called "The Tank." Each of them has a set of sensors and is powered by a Neural Network (http://en.wikipedia..../Neural_network), a little piece of software that allows them to respond intelligently to their environment.

A genetic algorithm (http://en.wikipedia....netic_algorithm) is then used to select the best individuals of each generation. Their virtual "genes" are then mixed and crossed in order to produce a new generation. Over many iterations, the population's performance improves over time.

If you want, you can see them in action here:

I plan on releasing a beta version of the software for anyone to test and play with once I have implemented a simple GUI that allows users to adjust basic parameters of the simulation (Neural Network style, population size, colors, etc.). Perhaps I'll even implement some kind of Goopy-Tournament mode, so people can have fun making their Goopies compete against each other, who knows.


This is my first coding project (ever!). Coded in C++11 and compiled using GCC 4.7 (http://gcc.gnu.org/). Credits to SFML (http://www.sfml-dev.org/) for the graphic's engine and Box2D (http://box2d.org/) for the physics engine. And, of course, thanks to Darren for his original idea, which inspired me to make this.
  • 2

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download