General > Off Topic

BitLife

(1/3) > >>

Shasta:
Hey guys, thought some of you might be interested in this. Myself and a classmate wrote an artificial life sim in a few of days. It uses slightly modified version of Sunweaver (DNA library from DB3), and is based around a hex grid as a world. We were in a bit of a hurry, so stuff isn't very polished, it works though, for the most part. Mutation rates and costs are incredibly finicky, I would recommend keeping them low.

List of sysvars:

--- Code: ---move ' direction to move, goes from 1-6 in order listed for the eyes below
eat ' direction to eat, goes from 1-6 in order listed for the eyes
eatval ' ammount of energy to try and eat
repro '  works like you expect, store % of energy to give to child

 ' eyes have a value > 0 if something is there, number correlates of type (only one type implemented)
eyeul ' up left
eyeur ' up right
eyel ' left
eyer ' right
eyedl ' down left
eyedr ' down right
focuseye ' current eye to focus for the ref and in/out commands goes in order listed above 0-5

myenergy '  current energy
mypain ' ammount of energy lost in a cycle, cant remeber if it works
mypleasure ' amount of energy gained in a cycle cant remember if it works.
myage ' current age

refenergy ' energy the bot under the focuseye has
refage ' age of the bot under the focuseyey

in1 ' in#/out# work just like in DB2, uses focuseye
in2
out1
out2

mkchlr ' # of chloroplasts to create, 10 energy per I think
mychlr ' # of choloplasts you have, 20 at max, which is a dumb limit, but oh well

--- End code ---

Source code:
https://bitbucket.org/Shasta/bitlife

Requires .net 4 to run and Visual Studio 2010 (any version, express should work) to build.

Executable attached in zip

Edit: The program should actually work now.

Numsgil:
Ah, cool that you're borrowing DB3 code :)  Yay for modularity.  I'll pretend you did that because it's great code an not because you were in a hurry.  It is sexy to see some (simple) bots written in the new language.

...

The attachment link wasn't working in my Firefox, but it's fine in Chrome.  Not sure what that's about.

...

I think there's a x86/x64 type issue.  When I try to start a sim I get a "this program has performed an illegal operation" windows box.  Debugging it, I see this exception:

"Could not load file or assembly 'Sunweaver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."  I think that means you built Sunweaver in x86 (All DB3 projects are set to x86 because of XNA compatibility issues right now), but your main program was built with "Any CPU".

Numsgil:
On the subject of exceptions, you might want to wrap the entire program in a try/catch block and spit out a dialog box with exception information if one gets thrown.  Makes debugging in the wild slightly easier.

Shasta:

--- Quote from: Numsgil on December 16, 2011, 04:47:00 PM ---Ah, cool that you're borrowing DB3 code :)  Yay for modularity.  I'll pretend you did that because it's great code an not because you were in a hurry.  It is sexy to see some (simple) bots written in the new language.

--- End quote ---
Well, I did get approval from the professor to use the library quite early on in the quarter. The fact that we ended up doing our quarter long project in a couple of the days was entirely unrelated :P Everything actually went really smoothly though, we definitely wouldn't have been able to crank it out as fast as we did with out Sunweaver. Ran into a couple of snags, but they were manageable; fun one: != can not be parsed currently, but hey, = not does the same thing.


--- Quote ---The attachment link wasn't working in my Firefox, but it's fine in Chrome.  Not sure what that's about.

--- End quote ---
Works fine here, will poke around for what may be the cause though.


--- Quote ---I think there's a x86/x64 type issue.  When I try to start a sim I get a "this program has performed an illegal operation" windows box.  Debugging it, I see this exception:

...

--- End quote ---
Well that's rather embarrassing, I had just specifically fixed that problem, and then I upload the wrong files :wacko: Check the top post for an updated zip.


--- Quote from: Numsgil on December 16, 2011, 05:13:38 PM ---On the subject of exceptions, you might want to wrap the entire program in a try/catch block and spit out a dialog box with exception information if one gets thrown.  Makes debugging in the wild slightly easier.

--- End quote ---
Even better, in WPF you can set a property on your Application: DispatcherUnhandledException that raises an event when an exception is unhanded. I threw a window I wrote for that purpose a while back in to the new version.

Numsgil:
If you can make a list of snags with Sunweaver while it's fresh in your mind that would be great.  I'm not going to get it in to DB3 for a while.

...

We use WPF for some stuff at work.  What's it's main difference vs. winforms?  I might look in to it at some point if I have time.  I'm actually doing a bit of UI work for DB3 right now.

Navigation

[0] Message Index

[#] Next page

Go to full version