Darwinbots Forum

General => Toy Planet => Topic started by: Ammeh on May 23, 2013, 02:02:05 PM

Title: Toy Planet: candidate for DB3?
Post by: Ammeh on May 23, 2013, 02:02:05 PM
For my final year project for university I was given the title "Toy Planet" with the brief that I was to create some sort of a-life simulator. My tutor suggested I just build a straight up genetic algorithm with a population of animals and veg, and measure the tendency for particular schemata (alleles, basically) to evolve.

I thought that idea was boring, so I built a simulator capable of simulating agents with "dna".  The dna was a string of characters of any length which acted on a simple 10-item stack, performing basic conditional jumps (jump if greater than, jump if not zero, short jump etc.), setting a state (veg, eat, mate) and moving up/down/left/right. I allowed the mutation rate of individual agents to be mutated itself, and sought to prove that evolved mutation rate is a function of dna-repair costs and sustained biodiversity. In the paper itself, I actually messed that up, but after I'd submitted it I figured out why, and actually managed to get exactly that result :D

Anyways, in a lot of ways it's similar to Darwinbots, which is why I bring it up. Not only will you guys probably be interested in playing with it, but also I specifically designed it in a modular fashion so that huge changes to the processing of DNA, physics etc would be very easy.

What this means is that there currently exists a framework which can very easily be modified to incorporate the best features of Darwinbots, with much cleaner code, and native cross-platform support (it's in Java). Also, the networking stuff is already set up because the university let me run it on their distributed computing rig :3

I can't release it yet because I have to wait for marking to finish, but there's some info and a live sim that you can view at http://www.ameliapollard.co.uk/EvoSim/ (http://www.ameliapollard.co.uk/EvoSim/).

Any thoughts on this as a potential candidate for DB3?

Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on May 23, 2013, 02:35:01 PM
look beast, definitely interested in playing around with the actual program.



Quote
Any thoughts on this as a potential candidate for DB3?

Well, not really. Numsgil has been spending a lot of time designing very complex system with 4 point polygons and fluid dynamics. Most of it is over my head. However, a lot of the concepts you describe Numsgil wants DB3 to have. Anyway, Numsgil should be able to clarify further.
Title: Re: Toy Planet: candidate for DB3?
Post by: Peter on May 23, 2013, 04:41:15 PM
Probably not, but maybe some parts can be integrated. Current DB3 project is made in Microsoft Java(C#) so I don't think porting stuff would be too hard.

..but I got to play around with Toy Planer to actually say something informed about it.  ;)
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on May 23, 2013, 05:49:17 PM
'Microsoft Java' , funny
Title: Re: Toy Planet: candidate for DB3?
Post by: Numsgil on May 23, 2013, 10:58:33 PM
Shasta also made an alife program a while back for school.  See this thread (http://forum.darwinbots.com/index.php/topic,3641.0.html).

I'd let you take the DB3 moniker except I do actually plan on finishing eventually  :blueblob:  Plus I think you should pursue your own "brand" anyway.  That way you aren't forced in to any sort of conceptual pigeon holes and can make the simulation work like you want.  For instance it sounds like your universe exists as a uniform grid with bots living inside grid cells?  But I always considered the actual physics engine behind Darwinbots one of the unique elements that makes it so distinct and cool.

We can set up a sub forum for it here on these forums once you can release it, though.  I don't mind at all giving hosting resources to other ALife sims.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on May 24, 2013, 10:22:50 AM
That's pretty cool of you, thanks :)

Yeah, after Botsareus posted, I had a dig around in the DB3 source code. I hadn't realised how much of it was already in place. I would like to re-register my interest in helping you develop that BTW.

To be honest, if I were to go down the route of separate project I'd undoubtedly want to steal some ideas from DB. The physics are pretty awful in mine, primarily because my tutor flat out forbade me to implement Newtonian mechanics, and told me to use naive physics instead. It's definitely on the to-do list to rewrite the whole physics/collision detection engine to be more realistic. I was even toying with the idea of making it 3D.
Title: Re: Toy Planet: candidate for DB3?
Post by: Numsgil on May 24, 2013, 12:10:15 PM
Yeah, after Botsareus posted, I had a dig around in the DB3 source code. I hadn't realised how much of it was already in place. I would like to re-register my interest in helping you develop that BTW.

I always like help :)

Quote
To be honest, if I were to go down the route of separate project I'd undoubtedly want to steal some ideas from DB. The physics are pretty awful in mine, primarily because my tutor flat out forbade me to implement Newtonian mechanics, and told me to use naive physics instead. It's definitely on the to-do list to rewrite the whole physics/collision detection engine to be more realistic. I was even toying with the idea of making it 3D.

You could probably grab a physics engine and stick it in without much effort.  I'm sort of insane (insane? who said that!) and like to build stuff from scratch, but there's something to be said for actually having something that runs.

3D would definitely be cool.  Hard part is how you visualize it, I think.  I toyed around with the idea of making DB3 3D, but it changes the flavor of everything dramatically, and I thought it would make it less approachable.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on May 24, 2013, 03:29:01 PM
Quote
I would like to re-register my interest in helping you develop that BTW.

Sammeh, if you plan to contribute to DB, I think we need a working version of IM. I don't really care if it is p2p or not; I just want this thing to work because it is a really cool feature and my knowledge of the internet is pretty much 'hyper text prepossessing' only. (although, I did write some LAN code a while ago for school.)

I am sure that Numsgil will not mind because then he can stick this kind of code directly into DB3 as long as we code it in VisualStudio2010.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on May 24, 2013, 05:14:13 PM
Quote
I would like to re-register my interest in helping you develop that BTW.

Sammeh, if you plan to contribute to DB, I think we need a working version of IM. I don't really care if it is p2p or not; I just want this thing to work because it is a really cool feature and my knowledge of the internet is pretty much 'hyper text prepossessing' only. (although, I did write some LAN code a while ago for school.)

I am sure that Numsgil will not mind because then he can stick this kind of code directly into DB3 as long as we code it in VisualStudio2010.

If I can figure out DB2's code (my coding skill has improved over the last 3 years :P ), I could potentially hack the network portion of Toy Planet into it, though I'm not sure. I'll take a look over the weekend, see if I can put something together.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on May 24, 2013, 07:07:01 PM
oh, You do not need to touch the vb6 code really. The vb6 is already putting out the .dbo (robot) files into the 'outbound folder' and excepting any files coming in trough the 'inbound folder.' All you really need to do is write a plugin that excepts the following command line sequence:

Code: [Select]
iq = Chr(34) & Teleporters(i).intInPath & Chr(34)
    oq = Chr(34) & Teleporters(i).intOutPath & Chr(34)
     s = "DarwinbotsIM.exe" _
     & " -in " & iq _
     & " -out " & oq _
     & " -name " & IntOpts.IName _
     & " -pid " & Str(GetCurrentProcessId())
     IntOpts.pid = shell(s, vbNormalFocus)

(s is the sequence itself where DarwinbotsIM.exe is the program name)

I have already coded up 'local IM mode' (LocalDBIM) to test this feature, look for it on SVN. However, I did improve the 'saverobotbody'/'loadrobotbody' algo. (there where some multibot issues I had to work trough) so if we do need to test it we need to use version 2.45.03Beta.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on June 29, 2013, 08:52:25 AM
So I just got my marks back from my degree. I got a first! :D

Anyways, this now means I can release my final year project, so I proudly present: EvoSim (http://www.ameliapollard.co.uk/?portfolio=evosim)  :happy:
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on June 29, 2013, 02:46:49 PM
Skill: x86 Assembly, nice.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on June 29, 2013, 02:52:18 PM
hmm...

Can not seem to find a .exe download. Do you have one? If so, where?
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on June 30, 2013, 05:19:18 AM
It's in Java. If you just download the source there's a file called "runme.bat" that will start everything running.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on July 02, 2013, 10:08:55 AM
Also, it's probably worth noting that by default the population module is disabled. If you just open up config.ini (in wordpad, because linux style newlines), then change
Code: [Select]
[Modules.populateModule]
enabled=false

to

Code: [Select]
[Modules.populateModule]
enabled=true
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 04, 2013, 01:25:49 PM
That is some of the many reasons I don't like working in Java  :Uhhhhh:
Title: Re: Toy Planet: candidate for DB3?
Post by: Pascal666 on July 04, 2013, 04:33:14 PM
Sorry to hijack your thread.  :D

I have been waiting forever for darwinbots3 , is there an alpha release anywere?
I have written my own simulation again in C#, but haven't published anything.
It is quite early so I wont yet.

I'd really like to see the progress on db3.

Made some animations:
http://s23.postimg.org/5yt5tza7t/screenshot.gif
http://s13.postimg.org/ewgs4frtz/screenshot2.gif
http://www.pictureshack.us/images/4613_firstmultibot.gif
Title: Re: Toy Planet: candidate for DB3?
Post by: Numsgil on July 05, 2013, 04:21:59 AM
Actually my plan is to release a tech demo this weekend of some of the fluid stuff I've been working on to commemorate the 5th year anniversary of my coding efforts.  It's not super deep, but it's interesting enough.

The screenshots are cool.  How did you make them?  Is that the C# program you're working on?
Title: Re: Toy Planet: candidate for DB3?
Post by: Pascal666 on July 05, 2013, 10:39:08 AM
Was looking into fluid dynamics also but I thought that it would become a performance issue, I wonder how much difference it makes when using CUDA.

I used animated gif editor for the first 2 and gif screen recorder for the last, both are pretty crappy.
Yea, it is very similar to darwinbots2 but the mutation system is probably very different and the DNA functions are more simplified.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 05, 2013, 12:50:27 PM
Quote
Actually my plan is to release a tech demo this weekend of some of the fluid stuff I've been working on to commemorate the 5th year anniversary of my coding efforts.

I must say Numsgil is a brave man to undertake such a huge project himself, especially while working a 9 to 5.

Looking forward to seeing the tech demo.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 06, 2013, 10:42:44 AM
I guess some people (666) just hate DB2 or vb6 or even possibly me  :(



Ammeh this is very ugly on windows, I fixed config.ini but the program is still not running.
It is worth mentioning that all the files are using Unix style line spacing, not just the config.ini file.
When I run runme.bat nothing happens.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on July 06, 2013, 01:24:43 PM
Doesn't run? I can't say I've ever had an issue with it running on anything  :blink:

Open up a command window and post any error messages?
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 06, 2013, 02:14:56 PM
Code: [Select]

D:\Documents and Settings\Paul\Desktop\Ammeh>time /t
02:14 PM

D:\Documents and Settings\Paul\Desktop\Ammeh>java -classpath ./bin -Xms3072m -Xmx3072m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xl
oggc:C:/temp/gc.log EvolutionSimulator 1 640 480 0.0001
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

D:\Documents and Settings\Paul\Desktop\Ammeh>time /t
02:14 PM

D:\Documents and Settings\Paul\Desktop\Ammeh>pause
Press any key to continue . . .

edit: I just updated my Java this morning...
Title: Re: Toy Planet: candidate for DB3?
Post by: Numsgil on July 06, 2013, 07:49:51 PM
Looks like it's having trouble getting enough RAM.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on July 07, 2013, 07:06:08 AM
Yeah, just change (or remove) -Xms and -Xmx to about 75% of your available RAM. Pre-assigning it just gives it a tiny performance boost, but you'll barely notice it tbh. It's like 1% extra cycles per second at ~100,000 pop.

EDIT: I'm actually gonna remove those extra parameters from the git repo, they aren't really hugely useful and they're bound to cause problems like this for other people too.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 07, 2013, 12:56:14 PM
Kool, got it to work. But, I can't really do anything with it.

I'll post some suggestions on your forum Ammeh.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 07, 2013, 01:05:46 PM
Ammeh, I can only start a new topic in Modules for some reason. Might wana look into that.

edit:

lol, I tried to post on Modules, it just ate my post and never processed it.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on July 07, 2013, 02:18:24 PM
Lol, yeah I was gonna ditch the forum cos Numsgil was talking about opening a board here. What issue are you having?

EDIT: Turns out "approve all posts" was enabled, I've approved it now.

Quote
Well I'll start with the good stuff:

The program is based around IM which is really cool.

Now the not so good stuff:

1.) I would like sample DNA codes I can load into the simulation.

2.) I would like to have a zoom feature and also be able to select a robot to view its current DNA (The mouse modes are really confusing , and for now I only got the 'random' mouse mode to work)

3.) In create agent what does 'genus' mean?

4.) A document will be nice to explain how the DNA is structured and how do mutations work (i.e. is it all copy error or what).

5.) I am guessing there are chloroplasts in the program because the robots must be getting energy from something?

Yeah, these are some serious usability issues. It was initially intended as a research tool, so I never really thought about it.
1) I'll make a list of commands/what they do + a couple of examples
2) If you set your mouse mode to "Sample", that allows you to view the state & DNA of any agent you mouse over. For zooming, I generally just use Windows' magnifying glass thing (in accessibility tools). It's surprisingly effective.
3) Genus was just a number used to indicate common ancestry. When the sim was populated initially, each created agent is given a random number which is passed down to it's offspring. Just makes for easy determining of what came from where. I'll remove that from the interface and just make it a random number, since it doesn't really work like that anymore. Now it's just used to calculate the colour the agents show up in, and varies ever so slightly with each mutation. For now, just type in a random number.
4) That is all in the research paper, but if you don't feel like poking through a 15,000 word document I can understand :P I'll clip it out and summarise it somewhere.
5) Again, that's specified in the research paper. Again, I'll clip it out and summarise. Short answer: yes.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 28, 2013, 06:46:36 PM
I have no idea what is going on with Ammeh; Her forum is down.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on July 29, 2013, 02:34:30 PM
Yeah, I deleted it. Too much spam, too little time to do anything constructive about it. I'll bump Nums for a board on here.

*bumps Numsgil*

What's up?
Title: Re: Toy Planet: candidate for DB3?
Post by: Numsgil on July 29, 2013, 05:06:02 PM
Okay, I'll set something up later tonight (bump me again if I forget.)
Title: Re: Toy Planet: candidate for DB3?
Post by: Numsgil on July 30, 2013, 03:23:23 PM
Okay, you have your own forum now!  Woo.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on July 31, 2013, 11:55:34 AM
That was nice of you Nums :)



Ammeh, there are a couple more suggestions I am shooting your way:

1.) It will be nice to select a robot by clicking on the graph instead of on the grid. If there are very few robots and they are running around fast enough it is very hard to spot and click them.

2.) Add one more step when converting the slider value to the actual mutation rates value. Square the value please. I have noticed that even at extremely low mutation rates (1.3%) most robots loaded from the internet die. If we square the value we can get better precision on low mutation rates. So the value of 1.3% becomes  0.0169%



I also sent you the revisions you where asking for (DBIM) let me know if you need any further assistance with any of that.

edit: I have Internet now btw. Just give me a time frame and we could test it. 8)
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on August 02, 2013, 06:17:49 PM
Thanks Numsgil! I'll link it from my page now.

1) I can't really do that, given that the bots of that colour may have a number of different mutations between them. It was only ever intended to be indicative of the general population. I could potentially look for a bot whose colour is the selected one, and just return the first one found, but each bot tends to be different.

2) That I can do, though it's worth noting that if you use the arrow keys to adjust the slider, it'll increase the value by 0.0001
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on August 03, 2013, 02:49:52 PM
Quote
arrow keys to adjust the slider, it'll increase the value by 0.0001

I am going to go try that right now actually.

edit: The power of this thing is amazing! Probably due to the fact of how well the IM is configured. Considering how simple the physics model is, this thing still generates awesome results. I can't even image what will result if we gave DB this kind of power.

Quote
That I can do...

Let me know when the update is complete so I can check it out.
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on August 10, 2013, 02:15:05 PM
Glad you like it :)

I'll take a look at that tomorrow, should be easy enough to do.
Title: Re: Toy Planet: candidate for DB3?
Post by: cliftut on September 25, 2013, 11:36:53 PM
This is cool, I've run it for several hours in the last few days. Evolving mutation rates is a nifty idea. Also, this thing is blazing fast! :)

Here are some suggestions. I hope you don't mind:
Also, a couple questions:
[/li]
[/list]

There is a program which resembles yours but is nowhere near as fast, called Nanopond.
http://adam.ierymenko.name/nanopond.shtml
It has two coloring algorithms which you can switch between using right-click. Maybe they could be adapted to your program, since Nanopond is open source (under GNU GPL). It's rather cool because each one groups the creatures differently, but still in an organized way.

Another very cool alife program with some similarity to yours is Evolve 4.0. It's not perfect, but is one of the more developed alife programs I've come across, and I hope you have time to give it a look if you haven't already.
http://www.stauffercom.com/evolve4/

Lastly, there are a couple of programs which are more distantly similar, although their download links are broken (I've sent him a message to fix them):
http://scottschaferalife.blogspot.com/2008/05/micropond-v1.html
http://scottschaferalife.blogspot.com/2008/06/micropond-v2.html
Until those are fixed, you can download MicroPond v1 from his personal website here:
http://www.scottschaferenterprises.com/alife.htm


Anyway, I hope this isn't too much feedback! :)
Title: Re: Toy Planet: candidate for DB3?
Post by: Ammeh on October 03, 2013, 05:36:22 PM
Feedback is always appreciated!

I've been pretty exhausted from work recently, so I'm struggling to find time and energy to actually work on personal projects, but all of your suggestions are great, and I'll certainly put them in when I have the time.

The genealogy tree functions have been mostly disabled by default, but it wouldn't be a huge amount of effort to make them configurable. The code's all there and working, just disabled by a flag. The program for visualising the tree is pretty rough around the edges, but that all works too. I'll see if I can get that upped for you.

If by "advanced characters" you mean unicode, it's a bit of unexpected behaviour that I thought was pretty cool. By default, Java's String objects are unicode, and the code I'm using to mutate the string works at byte level. What this essentially works out as is that while most mutations result in a standard ASCII character, if you get the right mutations next to each other, this can create a unicode character. The interesting bit comes from the fact that the DNA processing will get the value of the next valid character, be it unicode or ASCII. This means that while I had only initially intended operators to work on values of 0 to 256, a bot can sometimes save itself some work (ie, multiply 256 by 4 to check energy against) by getting the value of a unicode character, with values up to 65536 (iirc).
Title: Re: Toy Planet: candidate for DB3?
Post by: cliftut on October 04, 2013, 08:59:15 AM
Yeah, I meant unicode. Well, that's pretty cool. I was wondering if it was because the bits themselves were getting manipulated. It certainly makes the DNA look arcane. :) I don't fully understand, though. I get that unicode characters can have higher values than ASCII, but I didn't understand your example. What is different when an agent executes a unicode character as opposed to an ASCII character?

And, of course, no rush on implementing things. I make no demands of free software. ;)

One more feature idea: It would be nice if there was a config option to set up periodic screenshots (or maybe this is already there?). I'd like to be able to record time lapses of the simulations, but I realized that just using screen capture software wouldn't be accurate since the speed of the simulation varies based on population. So if it could dump a numbered .png to a subfolder every X (user defined) frames or ticks, that would be good enough. An added bonus is that the screen capture wouldn't be messed up if the computer decided to go to sleep. :)

On the more ambitious end, a separate program or built in dialogue for decoding the ASCII/Unicode DNA would be cool. Just to see the meaning; deciphering how it runs could still be left up to the user. The near-ultimate extension of this would be the ability to step through an agent's code during the simulation like Evolve 4.0 allows you to do.
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on October 04, 2013, 11:46:41 AM
... I have to make a note here that I actually like the way Ammehs graphs work; It is a really original approach. Maybe a way to save graph data periodically to the file system and then have a program to analyze it (like I have done for DB2) will be better.
Title: Re: Toy Planet: candidate for DB3?
Post by: cliftut on October 05, 2013, 05:24:07 AM
I like it in principal, but I'd like to be able to see the graph reliably. For instance, in my current sim, the highest point on the graph is two pixels tall ( meaning about 99% or the graph is empty space, and I must get close to the monitor to see it clearly). Logging is a good idea. It's always cool if you can take some raw data and look at it from different angles.
Title: Re: Toy Planet: candidate for DB3?
Post by: spike43884 on October 25, 2014, 05:22:05 AM
'Microsoft Java' , funny
Still not funnier than
Quote from: botsareus
You should attack a file
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on October 25, 2014, 04:48:02 PM
Yea, I think way funnier is msjava
Title: Re: Toy Planet: candidate for DB3?
Post by: Botsareus on October 25, 2014, 07:11:34 PM
Seriously, why would I ever misstype 'attach' with 'attack'