Darwinbots Forum
Welcome To Darwinbots => Newbie => Topic started by: Pascal666 on February 26, 2010, 09:05:53 AM
-
Since darwinbots is pretty old I thought maybe its time for a complete renewal of the client... I have been developing a clone for a while, which I want to show here.
I also want to ask if it would be a nice idea to host it here, and it will be completely opensource of course...
The reasons why a replacement or offering a second client would be nice are: new neater code, faster simulations, and a neat client.
The current version only contains the dna functions equalivent to the functions animal_minimalis uses here.
And it runs about 3 times the speed of darwinbots.
This is the downloadlink: http://www.megaupload.com/?d=KSUYI98A (http://www.megaupload.com/?d=KSUYI98A)
(http://img99.imageshack.us/img99/394/screenshotfr.png)
-
I have no idea whats going on when I run it , but it looks awesome.
-
When you say a new "client", do you mean a complete rewrite or are you borrowing some of the existing code? I'm mostly curious how you're handling collisions, physics, and vision (if you are). Because they're non trivial problems to solve.
Yeah, we can set up a hosting if you like. I'm a bit busy atm but give me a few days and I can at least set you up with a repository tree if you like and a login to post versions to our FTP.
Also, you are aware of DB3, right? You're preaching to the choir about the need for a new version
-
When you say a new "client", do you mean a complete rewrite or are you borrowing some of the existing code? I'm mostly curious how you're handling collisions, physics, and vision (if you are). Because they're non trivial problems to solve.
Yeah, we can set up a hosting if you like. I'm a bit busy atm but give me a few days and I can at least set you up with a repository tree if you like and a login to post versions to our FTP.
Also, you are aware of DB3, right? You're preaching to the choir about the need for a new version
With a new client I do mean write a completely new client, with new benefitional settings for entity features like mass and ties, and limiting them more naturally.
I am aware of the development of DB3, I do not know the stage of it, but I think there will be great difference between the 3D and 2D experience, maybe also some performance differences... And since the development of darwinbots 2 is mainly ceased/finished it might be nice to get a higher performance/neater version of darwinbots, and depending on the results of this new client it might be published as "Darwinbots Classic".
My physics function is pretty simple and probably very similar to how darwinbots handles it:
Private Sub executePhysics(ByVal Entity As Integer)
Dim i As Long
Dim a, b, c, d As Double
With Entities(Entity)
' UPDATE POSITION
If .Velocity > 0 Then
.X = .X + (.Velocity * Cos(.Angle * PI / 180))
.Y = .Y + (.Velocity * Sin(.Angle * PI / 180))
.Velocity = .Velocity * 0.99 ' FRICTION
End If
' COLISSION DETECTION AND EYE FUNCTION
For i = Entity + 1 To GLO_TOTALENTITIES
a = .X - Entities(i).X
If a < 0 Then a = a * -1
a = a * a
b = .Y - Entities(i).Y
If b < 0 Then b = b * -1
b = b * b
c = Sqr(a + b) - (.Mass + Entities(i).Mass) ' DISTANCE
If c <= 0 Then ' COLISSION
d = Atan2(.Y - Entities(i).Y, .X - Entities(i).X) * 180 / PI
.Angle = d
Entities(i).Angle = (d + 180) Mod 360
' FRICTION
a = (.Velocity + Entities(i).Velocity) * 0.75 / 2 + c / 10 * -1
.Velocity = a
Entities(i).Velocity = a
End If
If Not .isPlantae Then ' SIGHT ENTITY 1
If c < (50 + Sqr(.Mass) * 10) Then
d = Atan2(.Y - Entities(i).Y, .X - Entities(i).X) * 180 / PI
d = (d + 180) Mod 360
If .Aim > 338 And d < 22 Then d = d + 360
If .Aim < 22 And d > 338 Then d = d - 360
If d < .Aim + 22 And d > .Aim - 22 Then
If c < .Sight Then
.Sight = c
.sightReference = i
End If
End If
End If
End If
If Not Entities(i).isPlantae Then ' SIGHT ENTITY 2
If c < (50 + Sqr(Entities(i).Mass) * 10) Then
d = Atan2(.Y - Entities(i).Y, .X - Entities(i).X) * 180 / PI
d = (d + 360) Mod 360
If Entities(i).Aim > 338 And d < 22 Then d = d + 360
If Entities(i).Aim < 22 And d > 338 Then d = d - 360
If d < Entities(i).Aim + 22 And d > Entities(i).Aim - 22 Then
If c < Entities(i).Sight Then
Entities(i).Sight = c
Entities(i).sightReference = Entity
End If
End If
End If
End If
Next
' CHECK IF THE ENTITY LEFT THE PLANE
If .X > OPT_PLANEWIDTH Then .X = .X - OPT_PLANEWIDTH
If .X < 0 Then .X = OPT_PLANEWIDTH + .X
If .Y > OPT_PLANEHEIGHT Then .Y = .Y - OPT_PLANEHEIGHT
If .Y < 0 Then .Y = OPT_PLANEHEIGHT + .Y
End With
End Sub
-
DB3 is strictly 2D, actually. I was playing with the idea of 3D but I dropped it.
Are you programming it in VB.NET?
-
Random suggestion, instead of using AE use Æ. It looks cooler. If you don't know how, just hold alt and press 146 sequentially. æ also works.
-
DB3 is strictly 2D, actually. I was playing with the idea of 3D but I dropped it.
Are you programming it in VB.NET?
I do know how to program in the .net series, but I prefer to stick to VB6, and if I would choose another language I would probably go for visual c++ due to performance differences.
I will continue the development of Ævolution, and maybe the development of 2 opensource applications may have some benefits for each other.
-
Speaking about open source, where can I can find the source for 2.44.04?
-
Use the SVN: clicky (https://svn2.hosted-projects.com/Numsgil/DarwinbotsVB/). This will be changing location once I move it to the new server (I'll post an announcement).
-
Since I havent updated for a month I just want to let you guys know that I am working on AEvolution...
The dna functions have expanded a lot, and I just started working on the bond functions(ties).
After I finished the binding and viral functions, I will post AEvolution here with with a few sample bots included.
-
Since progress is slow lately, because of the lack of time, I have decided to show what I currently have.
I am still working on solving bugs in bond physics.
And I am also still working on a improved evolution system which should make it easier to evolve different cell-states, useful in both single and multicellular bots, the key function to this is the dna function jump which allows to skip genes, the current problem with it is that it doesn't increment along with gene count mutations.
My goals are:
- Make it easy for animalia_nihilo(darwinbots 's nullbot) to evolve.
- To create a successful evolvable multicellular entity.
Download:
http://www.megaupload.com/?d=M2KB0OC6 (http://www.megaupload.com/?d=M2KB0OC6)
Information log:
Features:
- Basic physics
- Both plantae and animalia repopulation
- Energy/body handling; max energy is 30000, when one exceeds 30000, the energy is automatically fed to the entity 's mass which is limited by 100
Mass addition and removal is limited by the size of it 's mass
- Simple plantae and animalia cost handling; plantae receiving 1 energy per cycle, and animalalia paying 0.1 energy per cycle
Animalia costs increase based on the populationsize: COST = 0.1 * (POPULATION / 20)
Reproduction costs 10% of the entity 's energy
Mass removal costs 10% of the asked for energy
DNA costs 0.01 energy point per 10 units of DNA per cycle
Age cost increase by 0.1 per 10000 cycles
Waste costs 0.1 energy point per 100 units of waste per cycle
- Entity details
Entities can be selected and moved
Mass benefits sight range by the following formula: SIGHT = 50 + SQR(MASS) * 10(For example: an entity with a mass of 10 will have a sight range of 70, where an entity with a mass of 100 would have a sight range of 150...)
Mass slows down speed using the following formula: maxVelocity = 11 - Int(Sqr(MASS))
Eating other animalia gives double the amount of energy than eating plantae, but also gives waste...
Mass benefits waste dumping by the following formula: DUMPEDWASTE = Sqr(MASS) / 40 (Meaning it can dump 0.25 waste per cycle)
Mass is the basis for defense and attack in animalia: ENERGY = ENERGY * (SQR(MYMASS) / SQR(REFMASS))
- Plantae details
Do not have sight
Mass increases the energy uptake by the following formula: ENERY = ENERGY + 1 + (SQR(MASS) / 4)
Not able to reproduce after exceeding option_plantaemaximum
- Mutation system
Mutation per reproduction
When the population is low the amount of random mutation will be higher
- Stack based DNA system.
Genecaching so it can skip dna faster
- Dna functions
Functions with a x still have to be added...
Movement:
strength moveright
strength moveleft
strength moveforwards
strength movebackwards
maxvelocity
Aim:
amount aimright
amount aimleft
angle setaim
Reproduction:
reproduce
fertilize x
isfertilized x
Vision:
sight
Mass management:
amount addmass
amount removemass
Waste management:
amount dumpwaste
Personal functions:
myvelocity
myenergy
mymass
myangle
mywaste
pain
myaim
Reference functions:
isplantae
samespecies
refvelocity
refmass
refenergy
refangle
refwaste
refaim
Reference communication:
readmem1 to 10
value writemem1 to 10
readrefmem1 to 10
Reference sharing:
amount shareenergy
sharemass
sharewaste
Bond functions:
growbond
nextbond
setbond
totalbonds
bondenergy
bondmass
bondwaste
bondvelocity
bondangle
breakbond x
bondaim
Bond communication:
readmybmem1 to 10
value writebmem1 to 10
readbmem1 to 10
Bond sharing:
amount sharebenergy
sharebmass
sharebwaste
Viral functions:
amount jump
gene sharegene
gene delgene
thisgene
totalgenes
-
-
What kind of FPS are you getting at say, a population of 1000 bots?
What kind of FPS would you get in DB2 with the same pop?
-
What kind of FPS are you getting at say, a population of 1000 bots?
What kind of FPS would you get in DB2 with the same pop?
I am running 200 bots at about 240 cycles per second, while in darwinbots I am running only 50 bots to reach this speed.
-
What kind of FPS are you getting at say, a population of 1000 bots?
What kind of FPS would you get in DB2 with the same pop?
I am running 200 bots at about 240 cycles per second, while in darwinbots I am running only 50 bots to reach this speed.
Awesome then you have my vote to upload it
-
What kind of FPS are you getting at say, a population of 1000 bots?
What kind of FPS would you get in DB2 with the same pop?
I am running 200 bots at about 240 cycles per second, while in darwinbots I am running only 50 bots to reach this speed.
I know Eric did a lot of work to make it faster for large( r) numbers of bots. If you jack it up to 1000, what sort of speed do you get? Unless you've done some broadphase work it should go way, way down since you're doing some O(n^2) work (so you're doing 25 times as much work at 1000 bots as at 200 bots. Which means I'd guess you're getting 1 cyc/sec at 1000 bots, where DB2 might get 2 or 3).
Not that what you have isn't impressive, just saying that how many bots you can run at 240 cyc/sec might not be the best metric for comparison.
Also, I should be able to set up SVN this weekend. If you like, I can set you up with a SVN repo for your code. Or failing that, you should set up a google code project or a sourceforge project.
-
What kind of FPS are you getting at say, a population of 1000 bots?
What kind of FPS would you get in DB2 with the same pop?
I am running 200 bots at about 240 cycles per second, while in darwinbots I am running only 50 bots to reach this speed.
I know Eric did a lot of work to make it faster for large( r) numbers of bots. If you jack it up to 1000, what sort of speed do you get? Unless you've done some broadphase work it should go way, way down since you're doing some O(n^2) work (so you're doing 25 times as much work at 1000 bots as at 200 bots. Which means I'd guess you're getting 1 cyc/sec at 1000 bots, where DB2 might get 2 or 3).
Not that what you have isn't impressive, just saying that how many bots you can run at 240 cyc/sec might not be the best metric for comparison.
Also, I should be able to set up SVN this weekend. If you like, I can set you up with a SVN repo for your code. Or failing that, you should set up a google code project or a sourceforge project.
In AEvolution I get 10 cycles per second at 1000 eye carrying bots, and in darwinbots I get 2 cycles per second with simple algae bots. So the comparison is about the same.
But you could get even a bigger advantage if you run multiple environment/simulations, 2 simulations of 500 bots run at 20 cps/40 total.
These are the main performance checks, which probably could also be applied to darwinbots.
- Colission checks(the 200 stands for the maximum mass which is 100, 100 + 100 = 200...)
For i = Entity + 1 To GLO_TOTALENTITIES ' It doesnt check indexes below him, because they have already checked for colission.
If Entities(i).X - .X > 200 Or .X - Entities(i).X > 200 Or Entities(i).Y - .Y > 200 Or .Y - Entities(i).Y > 200 Then GoTo nextEntity
- Also resizing the index of GLO_TOTALENTITIES to the last highest index of dead entities in main loop.
- And reproduce/repopulation uses the lowest last dead index if there is one.
- DNA gene caching, store the locations of every gene which allows skipping genes faster once the condition is false.
Next week I will create a souceforge project.
-
i think your using vb6 drawing routines (based on the patern fill), these are slow, you might take a look at opengl slimDX or directX.
The fasted method might even be to not draw circles, but XOR bitmap of circles (having a few bitmap sizes in cash doesnt take much memory, or simply stretch)
Faster drawing methods will improve the speed even more.
But i dont think it works for me, not much happens when i load it.
Still i hope your code is more transparent i have given up trying to understand the original code, to much hidden variables for me to keep track off.
If your program is good structured and clear to read.
Then that would be promising.
If possible i would request more memory slots per cell, so we might later introduce real neural networks, and add some extra bot DNA math for that (sigmoid summAll etc, summWeighted).
A multibot editor (to create bots without defining complexly their shape trough DNA) would be nice too.
-
Yeah i'm having problems with too few memory locations but i've worked out I can store multiple values in one location through a system like binary for instance so 1,1,0 might equal 6 or 2,1,0 with 3 bieng the highest posible value I'd have 63 (0*3 + 1*9 + 2*27) bit too complicated for my liking... also having a small bot circle allows an extra 22 memory locations using every memloc and out sysvar though it's not that practical as it just converts one memory location into another type that in most situations is less useful about twenty-five thousandish should be adequate to create a multi-cellular DB with human intelligence... and maybhe 400 out and in sysvars... is a neural net the same thing as having a web of what varibles every other varible alters? because that's the kinda thing I'm trying to make... I want a bot that can understand that shootval is log2 and changing it affects how far or how powerful a shot is and then that links to a formula somewhere that knows how much it should decrease shootval by because it knows that's what it has to do in order to hit an enemy and thus get energy... it doesn't just do things without thinking... that's the main problem I have with darwinbots. anyways I tried it and made this though it doesn't apear to work
condition
readmybmem1 1 =
gene
3 moveforwards
endgene
condition
sight 999 <
sight 1 >=
samespecies 0 =
gene
refvelocity + 3 moveforwards
refangle setangle
endgene
condition
mymass - bondmass 1 >
gene
sharebmass
endgene
condition
mymass bondmass >
myenergy - bondenergy 250 >=
gene
250 sharebenergy
endgene
condition
sight 50 >
gene
1 eat
endgene
condition
totalbonds 0 =
samespecies 0 =
gene
1 writebmem1
growbond
endgene
condition
readmybmem1 0 =
totalbonds 1 =
myenergy 500 >
gene
growbond
endgene
condition
readmybmem1 0 =
totalbonds 2 =
myenergy 1500 >
gene
growbond
endgene
condition
myenergy 5000 >
gene
reproduce
endgene
-
looking at the DNA for your bots, it seems they're similar to DB's bots. Could you maybe replace the dna commands to be compatible with DB code?
-
in simple neural nets can be seen as a layer of dots (memory locations)
most often you see 3 layers of just a few dots
draw lines between dots and call them weights.
so a single dot on the second row does do (sum each dot in the row above (and for each dot .multiply its input with its weight line).
Depending on the results of single a neuron it adjusts the weights. (is it always wrong, then they become close to zero, is it oposite they become negative).
In the beginning the neural net is randomly seeded with random numbers, sigmoid calculations are done to balance the network.
And then with some hope and some clever thinking we might get it into DB (currently i've seen no sample of a bots using sigmoid functions, some claim to have but i doubt them)
here a not to complex read http://arxiv.org/ftp/cs/papers/0308/0308031.pdf (http://arxiv.org/ftp/cs/papers/0308/0308031.pdf)
There are several ways how it can work (and this would be something we have figure out (comparable to evolving zerobots)..
As you can imagine all weights and all dots can compare lots of memory, so to keep the program fast i think not all cells do require such large amounts of memory.
Back to neural nets.
Normally this math works wit real numbers (maybe floats) and rarely with short integers (maybe an int type is enough). ..
types >> (http://java.about.com/od/understandingdatatypes/a/primitivetypes.htm)
As you might notice this requires some memory so it would be better to have another cell type (so not all of the cells would require large amount of memories)
So a brain cell can contain more code, and process more advanced commands.
Also eye cells and movement cells, shooting cells, posion storage, shell cells.. could be smaller (and simply have input or output, and some energy demands and a connection(location?).
I know thats radical different from DB in which a single cell can do everything, and has potentially all kind of information even if it doesn't process them.
Note for all the things that could be done with 1 or 0 you can use binary math (XOR OR AND etc) and so limit memory usage of them.
Although one bit can store only on /of 2 bits can store (00 01 10 11) for states (4 = 2^2 and 3 bits can store 2^3 = 2*2*2 = 8 states.
By us
In DB there areas are like the *.970 area (given to child by birth). (to keep children learn), something like that should also apply i think (so you get spock like brain transfers at birth).
The easist way might perhaps be to have a cell type wit a double adres range, one that is not poluted with all kind of commands
Note the math required actualy for doing this and the training of the neural net, is something which is another topic and a chalange like numsgill chalange for a zerobot using conditional behaviour.
But once we got a small neural network working, it can be exanded..>effectivly becoming smarter.
At ofcoure higher energy costs, as our brains consume the most our bodies energy..
Dont think of to complex neural networks for a starter a single bot with 3 layers and 20 dots totall, a minimum would be i think about (maybe first layer 5 next 3 next 4 >> 12 dots)
It doesnt require like 50 dots, because also the braincells could be connected to other brain cells.
Another method could be single neuron cells, but then we would require something like a species editor, to connect each cell correctly to make a neural network.
That way they consume less memory but bot creation becomes a new topic of discusion i mean how to do it in DNA, or do it without DNA ?..string discription of species maybe... ??..
-
I'm a bit lost reading that Wasn't the purpose of DB to avoid using neural networks? What we need is a good "read" command so that we can use memory like an array. Theres a store, but no read.
-
I'm a bit lost reading that Wasn't the purpose of DB to avoid using neural networks? What we need is a good "read" command so that we can use memory like an array. Theres a store, but no read.
By read do you mean * like *.eye5 reads .eye5 or .eye5 * or *505 or even 505 * it's pretty easy to read a single value, and for multiple memory locations you have things like the stack and duplicate commands... would probably help a lot if you could read various positions in the stack if that's what you mean... or do you mean having multiple stacks... I'm slightly confused by what you mean.
As for the neural network I'm trying to create something which looks at every varible and tracks which ones change when another changes and draws "synapses" between them and some varibles are read only but can be adjusted by other varibles and the goal of the robot is to boost these varibles as high as possible through the manipulation of writing varibles and then occasionally a string of random DNA is thrown in (each operator is represented by a value) and has a varible assigned to it and then if that adjusts things synapses are made and it refines it to help towards making .pleas and .percentage_shots_hit as high as possible through experimentation... right now what I have is pretty simple, when it's done however I think it could be programmed into php or something and attached to a program to make it better with varibles such as performance and especially things like industrial robots... not sure it'll get quite that far however.
-
It was a long write; because its not possible in DB2, so i only liked to give what should be about needed for it more memory of different type.
As some people like run like 10.000 bots then the best option is to have cell differences.
So a simple cell should contain less memory, also thats new for DB in which every cell can do all, smarter would be to have cells for specific tasks, so a multibot execution is quicker.
But also since i'm thinking of multibots here, since their 'genomic' is simpler a new way should be thought of for reproduction.
A specialized repro cell might do the trick, in it some new DNA commands to have a bleuprint of a species.
Specialized cells is a different new concept, but could be nice, in terms of memory usage and in terms of evolution.
All the special command in DB2 we could think of as special cells (store nrg, eye, stpoison, shell, repro,shoot,... etc).
(1 head connects to a neck joint ,to a body cell, then a mirror split of 2 arms, to hands, to fingers, to keyboard, to my latop..heheheh..)
if there is enough memory for (some) bots we can later make it, and the right type like an array of var type int. ( a bit more then +32000 -32000)
To activate such code some more math commands are needed like some a sigmoid functions, some 'more precize calculations are needed.
Or evenmore complete neural math function (sum array with weights).
I think for the moment its better to finish the clone, and i realy hope it would become readable code (with not to many magic variables); the old DB is not easy to read.
If we got clear code then it becomes possible to extend it, and maybe by more people.
These things are not worked on in DB3 as far as i know, i'm not sure how far DB3 is currently
This is maybe DB4 stuff i talk about, but if we got a good skelleton of the basic program, then a next version would be more easy to create.
And what ive seen sofar from it, seams to be better readable. (maybe not that fast?).. but promising
Oh also another answer i forgot in my earlier email, neural nets dont program the rest of the DNA to build usefull DNA to create a LOG(x) function to shoot.
It would rather become that a neural net would emulate the log function itself and give itself a shoot command. (connect the output to a shooting cell..)
(but i dont realy think that LOG(x) is required to shoot, but givven time it might improve perhaps to something like that...)
The improvement would be caused by having offspring (genetic reproduction) while advanced functioning (combining of eyes and shooting) would be a result of a small neural net.
The results might be impressive, since in current DB we create 'static' creatures, who by random noice (DNA mutations) change behavior.
In contrast nueral nets are adaptive by nature, not static
** there is a problem of learning for these bots, by i think thats much the same as zero bots problems >> Just start with enough variation and use elimination until you get some usefull Neuralnet.
Still we could use genetics as in DB, or random DNA mutations, if we can later build in a neural net then it would become much more realistic.
Most animals have brains... or at least have a concept of neurons.
Only the real small creatures dont have it, but often are so advanced allready that i'm not sure which rules aply to them ( slime can emulate the network connections between cities.. (new scientist article))
-
I'm a bit lost reading that Wasn't the purpose of DB to avoid using neural networks? What we need is a good "read" command so that we can use memory like an array. Theres a store, but no read.
By read do you mean * like *.eye5 reads .eye5 or .eye5 * or *505 or even 505 * it's pretty easy to read a single value, and for multiple memory locations you have things like the stack and duplicate commands... would probably help a lot if you could read various positions in the stack if that's what you mean... or do you mean having multiple stacks... I'm slightly confused by what you mean.
No, I mean having a "read" command which would take the value of the memory location pointed to on the the top of the stack and put it on top of the stack. I didn't know there was a "*" command, I thought you had to put it before the number of the variable you wanted to read.
As for your neural net, what about things that are related, but don't happen in the same cycle. For example, if you shoot, you get -2 shots back in the future, not instantly.
-
No, I mean having a "read" command which would take the value of the memory location pointed to on the the top of the stack and put it on top of the stack. I didn't know there was a "*" command, I thought you had to put it before the number of the variable you wanted to read.
Like 706 ¬ looks for all instances of 706 and put the memory locations containing it on the stack? Or like 1 *.daytime - ++ add * which reads .up in the daytime and .dn at night?
As for your neural net, what about things that are related, but don't happen in the same cycle. For example, if you shoot, you get -2 shots back in the future, not instantly.
Simple the neural net computes like computer RAM and functions with information stored on the "hard drive" which knows things like which synapses connect which to things and then it also has space just for memory that can be written to, somewhere in the unconditional tutorial thing it talks about some other way to use memory which might be helpful. Didn't entirely understand though.
-
As for your neural net, what about things that are related, but don't happen in the same cycle. For example, if you shoot, you get -2 shots back in the future, not instantly.
Simple the neural net computes like computer RAM and functions with information stored on the "hard drive" which knows things like which synapses connect which to things and then it also has space just for memory that can be written to, somewhere in the unconditional tutorial thing it talks about some other way to use memory which might be helpful. Didn't entirely understand though.
It doesnt matter if for a neural net something doesnt happen within the same cycle.
Put simple, if you shoot you can count up a total shots (*.shot 1 add .shot store )
if you get food back, you can reset the shot counter.
As long as shots don't go to high a neural net doesnt trigger an action.
If shots value get to high and can choose to abandon shooting, or go faster forward.
Basicly this is way neural nets use a sigmoid function, because it switches after a "certain" treshold, in which the "certain"part adepts by a reward system.
reward would simply be gain food, or succesfully do something.
i was just thinking what if the firt memory byte (zero) was reserved for cell type and thus memory amount.
In such case less memory types would be fixed and reserved, its possible to minimize memory if you dont use eyes,
(8 types eye, shell, nrg body, str body, movement) or if we use 2 bytes we got 16 options 4 bytes 32...
Hmm maybe i better just wait for the code before doing these suggestions.
-
I don't think your understanding me, and I'm not understanding you. Lets set aside memory locations 50 to 70 for some purpose. Say I want to access one more then the location I accessed last cycle. I would do this:
LastOneUsed 1 add read
Simple, right? I ran into this problem while trying to figure out how to make the bots do complex stuff like "learn".
Also, for your neural nets, how do you find two events that are related. There could be millions of possible connections and relations, not to mention the farther in the future the reaction happens, the harder it is to identify what caused it.
-
def last_read 971
start
70 .last_read store
.delgene inc
stop
start
'condition
*.last_read ++ *
'whatever you want to use the number for
.last_read inc
*.last_read 91 = and
70 .last_read store
stop
Like that? That's the simplest way I can think of... really hope that's what you mean this time.
Also, for your neural nets, how do you find two events that are related. There could be millions of possible connections and relations, not to mention the farther in the future the reaction happens, the harder it is to identify what caused it.
number of varibles to the power of two, 250ish sysvars and lets say 100 custom varibles which makes 122,500 but not every varible depends on every other varible for instance shot travel distance depends only on body and shootval so to make up for this I divided that by 5.5 (could be any number) to get 22,000, thus using the 25,000 memory locations I proposed ealier, 22,000 are part of the neural net, 350 are varibles and leaves 2,650 for genreal memory and if that memory is spread over how ever many cells are in the brain it should be sufficient to allow for human intelignence, right?
-
def last_read 971
start
70 .last_read store
.delgene inc
stop
start
'condition
*.last_read ++ *
'whatever you want to use the number for
.last_read inc
*.last_read 91 = and
70 .last_read store
stop
Like that? That's the simplest way I can think of... really hope that's what you mean this time.
Maybe, I'm not sure what your trying to do with it though. Heres a better example: I have a shepard bot. It grades the fitness of a bot it sees in front of it and stores that value in a memory location. I have ten memory locations and the number of the location I last stored in and I want to rotate through them. Its easy to store them using "last_value 1 add store" but its hard to read them. For example, what if I want to find what the last bot's fitness was? Ideally I would do this: "last_value read". Now the value of the last bot's fitness is on top of the stack and I can use it to compare it to the bot I see now to judge what his fitness is.
And do you really think you can simulate human intellegince in darwinbots? That would be weird.
-
And do you really think you can simulate human intellegince in darwinbots? That would be weird.
If it scales, currently cats are simulated.. see link (http://www.sciencedaily.com/releases/2010/04/100414184218.htm)
But i'm rather into smaller networks, first try XOR in a neural net for example, thats a good starter.
-
And do you really think you can simulate human intellegince in darwinbots? That would be weird.
If it scales, currently cats are simulated.. see link (http://www.sciencedaily.com/releases/2010/04/100414184218.htm)
But i'm rather into smaller networks, first try XOR in a neural net for example, thats a good starter.
Aye, afterall what is a human human brain and nervous system: a giant neural net, of course there are some chemicals involved as well for things like hormones but I'm sure a neural net can easily match those kinds of capabilities, I'm more than ceratin that a computer has the potential to be more intelligent than any human who has been born narually and ever will be born for once a robot can learn it can become more inteligent than a human in theory, and better intelligence, is better at making even more improved inteligence and so on in a cycle until you have an indefinitetly inteligent machine, if you look on wikipedia there's a tonne of stuff on it... it's also been suggested as a solution to the fermi paradox, as for the reading code what i wrote does roughly that change ++ to 1 sub and it'll read the location stored last 2 sub will look at whatever was put in 2 cycles ago, it's pretty shaky though and could use some expansion but it's simple enough to do yourself I'm sure.
-
And do you really think you can simulate human intellegince in darwinbots? That would be weird.
If it scales, currently cats are simulated.. see link (http://www.sciencedaily.com/releases/2010/04/100414184218.htm)
But i'm rather into smaller networks, first try XOR in a neural net for example, thats a good starter.
Aye, afterall what is a human human brain and nervous system: a giant neural net, of course there are some chemicals involved as well for things like hormones but I'm sure a neural net can easily match those kinds of capabilities, I'm more than ceratin that a computer has the potential to be more intelligent than any human who has been born narually and ever will be born for once a robot can learn it can become more inteligent than a human in theory, and better intelligence, is better at making even more improved inteligence and so on in a cycle until you have an indefinitetly inteligent machine, if you look on wikipedia there's a tonne of stuff on it... it's also been suggested as a solution to the fermi paradox, as for the reading code what i wrote does roughly that change ++ to 1 sub and it'll read the location stored last 2 sub will look at whatever was put in 2 cycles ago, it's pretty shaky though and could use some expansion but it's simple enough to do yourself I'm sure.
hmm yes but the point doing the required math based on the current integers -32000 to +32000, is almost not possible; i've been scanning the net now for a while for different interpretations of the math on integers but they are real hard to find. (i found one which was a writing of a DRs. and you had to buy his copyrighted work..), which was designed for some basic electronics (no mentioning of c# or Vb) pretty low level, just imagine input [0..100] value, with a weight [0..100] 100x100 10.000 (thats one neuron connection) not an arry (and using 0..100 is allready a translation because this math usualy uses valeus from +1 to -1, and all real type numbers between. (0.00230405.. etc). >> so with [0..100] you have basically 2 digit precision which is i think to small for this to work.
I cannt wait to see this new code of DB, maybe port it to vb.net (the speed difference between vb.net, and c# is minimal).
And normally one does not recode a program to be just in another language.
Its more likely to do so for only some routines (by inline assembler or, or other languages referal routines.)..
-
The source code upload is temporarily uploaded here for anyone who wants it:
http://www.megaupload.com/?d=KAECTRY0 (http://www.megaupload.com/?d=KAECTRY0)
I have added expanding memory functions to my todo list.
And I will look into using directx as graphics engine.
My first priority now is fixing a freeze bug, and adding internet mode.
Edit:
For those already trying to simulate entities, and are bothered by the freeze bug I have uploaded a temporary patch... duplicategene, a mutation function is disabled since this is the cause of the bug.
http://www.megaupload.com/?d=0Y9NM7YW (http://www.megaupload.com/?d=0Y9NM7YW)
-
Yeah i'm having problems with too few memory locations but i've worked out I can store multiple values in one location through a system like binary for instance so 1,1,0 might equal 6 or 2,1,0 with 3 bieng the highest posible value I'd have 63 (0*3 + 1*9 + 2*27) bit too complicated for my liking... also having a small bot circle allows an extra 22 memory locations using every memloc and out sysvar though it's not that practical as it just converts one memory location into another type that in most situations is less useful about twenty-five thousandish should be adequate to create a multi-cellular DB with human intelligence... and maybhe 400 out and in sysvars... is a neural net the same thing as having a web of what varibles every other varible alters? because that's the kinda thing I'm trying to make... I want a bot that can understand that shootval is log2 and changing it affects how far or how powerful a shot is and then that links to a formula somewhere that knows how much it should decrease shootval by because it knows that's what it has to do in order to hit an enemy and thus get energy... it doesn't just do things without thinking... that's the main problem I have with darwinbots. anyways I tried it and made this though it doesn't apear to work
condition
readmybmem1 1 =
gene
3 moveforwards
endgene
condition
sight 999 <
sight 1 >=
samespecies 0 =
gene
refvelocity + 3 moveforwards
refangle setangle
endgene
condition
mymass - bondmass 1 >
gene
sharebmass
endgene
condition
mymass bondmass >
myenergy - bondenergy 250 >=
gene
250 sharebenergy
endgene
condition
sight 50 >
gene
1 eat
endgene
condition
totalbonds 0 =
samespecies 0 =
gene
1 writebmem1
growbond
endgene
condition
readmybmem1 0 =
totalbonds 1 =
myenergy 500 >
gene
growbond
endgene
condition
readmybmem1 0 =
totalbonds 2 =
myenergy 1500 >
gene
growbond
endgene
condition
myenergy 5000 >
gene
reproduce
endgene
The problem you're having with feeding is in this gene:
condition
sight 50 >
gene
1 eat
endgene
The sight range is the distance it is away from the bot, you're feeding when its farther than 50, it should be closer than 50 "sight 50 <".
-
The problem you're having with feeding is in this gene:
condition
sight 50 >
gene
1 eat
endgene
The sight range is the distance it is away from the bot, you're feeding when its farther than 50, it should be closer than 50 "sight 50 <".
Opps, I assumed it would be based on apparent size like in darwinbots, sounds like an improvement you made then... maybhe not entirely realistic, but lets just say they can sense using ultrasound
-
i'm trying to convert the code to vb.net
but its a bit complex if you dont know the exact inner working of the program.
I lack the general view.
i see seperated "subjects", there is a graphical part (wich might be translatable to some different kind output > directx9 or something else) and physics and DNA,
And there must be a data structure
hmm besides that there is some complex species loop,
which doesnt convert well to vb.net...
hmm vbnet doesnt accept arrays with negative values hmmmm
Basicly i think i could be written in vb.net, the things in which vb6 is more easy is perhaps file access, but thats about it.
There is a trick however to include vbscript runtime (so you get the easy script commands) and another option is to make to 'right' file dialog calls, which (i forgot them a bit) but they endup with complete finished dialogs like the file load/safe dialogs of word / excel / ...
hmmm thinking thinking
-
Opps, I assumed it would be based on apparent size like in darwinbots, sounds like an improvement you made then... maybhe not entirely realistic, but lets just say they can sense using ultrasound
The number is just handled differently, there is still is a limited range and sight angle.
i'm trying to convert the code to vb.net
but its a bit complex if you dont know the exact inner working of the program.
I lack the general view.
i see seperated "subjects", there is a graphical part (wich might be translatable to some different kind output > directx9 or something else) and physics and DNA,
And there must be a data structure
hmm besides that there is some complex species loop,
which doesnt convert well to vb.net...
hmm vbnet doesnt accept arrays with negative values hmmmm
Basicly i think i could be written in vb.net, the things in which vb6 is more easy is perhaps file access, but thats about it.
There is a trick however to include vbscript runtime (so you get the easy script commands) and another option is to make to 'right' file dialog calls, which (i forgot them a bit) but they endup with complete finished dialogs like the file load/safe dialogs of word / excel / ...
hmmm thinking thinking
Personally I am not a big fan of vb.net, the speed difference shouldn't be that great either.
When I started programming aevolution I actually made a client using directx in c++, however my lack of experience(none) with c++ made the progress too slow, so I decided to use vb6.
But I dont know what you mean with arrays with negative values, as far as I know there arent any.
-
Personally I am not a big fan of vb.net,
I am not eather, but guess what? vb6 is almost a dino' by now...
I have tried to build my own virsion of DB once called PusherBots. Did not get very far and deleted my source code out of annoyance. Big mistake. I believe one day we should look at all this open source stuff out there and implement the parts we like in to DB3...
-
I didnt have vb6 anymore installed somewhere, so i went to vb.net
I think i'm going to strip, al lot from it, to get a 'naked app'.
Or maybe first investigate a good direct3d wrapper for vb.net.
I also wonder if it should be possible to include other code inside vb.net
So having a c#.net draw tool, which could run the output (drawing circles and lines in color)
So to split the main routine and the graphics routine.
But i've never done something with any kind of graphical engines, and combined code.
oh btw maybe a tip
You do a lot of 180/pi and pi/180 try make it a constant
Const Rad2grad As Double = 180 / PI
Const Grad2rad As Double = PI / 180
so you have less calculation for each movement.
And maybe even you could speedup sin/cos, with a array of 90 degrees and a simple function for the rest based on mod.
Small ideas to speed it up.
-
Or maybe first investigate a good direct3d wrapper for vb.net.
See this (http://www.alanphipps.com/VisualBasicdotNET-XNA.html) for getting XNA working with VB.NET. There is an actual wrapper around DirectX for managed projects (an abandoned official version an an open source alternative), but XNA is the future! In that Microsoft is actively supporting it. It's pretty similar to DirectX, anyway.
I also wonder if it should be possible to include other code inside vb.net
So having a c#.net draw tool, which could run the output (drawing circles and lines in color)
So to split the main routine and the graphics routine.
But i've never done something with any kind of graphical engines, and combined code.
It's actually pretty easy to do something like this in the .NET world, since the different languages get compiled down to the same intermediate language. You just have separate projects in different languages, and "add reference" to the compiled bianry of one project in the other.
-
i found some examples here http://nio.astronomy.cz/vb/opengl.html (http://nio.astronomy.cz/vb/opengl.html) (which seams fast for a basic aplication),
they use openGL and a wrapper called Tao, which seams to be updated recently
And it doesnt require to install a huge SDK from microsoft, these working demos are pretty small coded.
OpenGL exists in windows since i think NT3.51 so its pretty stable, and you can upgrade it like directx.
speed diffrences are not huge, so its mainly about how easy it would be to draw lines and circles.
That was easier in vb6 and earlier versions of basic like
screen 12
circle(90,90) 10, 4
but thats was before the graphic cards became smart ..
Hmm if I only could have a picturebox and have it ehmmm like assigned a such openGL power (or directx).
Then I could do all the drawings I want and fast, and then a refresh of the object to show it.
but such a could.. still is a mistery to me.
Its kind of strange we want to draw verry simple, but that seams to require a lot of knowledge these days.
-
i found some examples here http://nio.astronomy.cz/vb/opengl.html (http://nio.astronomy.cz/vb/opengl.html) (which seams fast for a basic aplication),
they use openGL and a wrapper called Tao, which seams to be updated recently
And it doesnt require to install a huge SDK from microsoft, these working demos are pretty small coded.
Tao's also good, yes. It wraps OpenGL, though, so if you've only done DirectX in the past it's going to be a bit of a learning curve (if you've done neither it's not a big deal).
OpenGL exists in windows since i think NT3.51 so its pretty stable, and you can upgrade it like directx.
speed diffrences are not huge, so its mainly about how easy it would be to draw lines and circles.
They both get converted by your graphics driver to raw hardware calls. Though DirectX support tends to be better, especially from ATI. NVidia does a pretty good job with OpenGL, which is why it's preferred for Linux.
Hmm if I only could have a picturebox and have it ehmmm like assigned a such openGL power (or directx).
Then I could do all the drawings I want and fast, and then a refresh of the object to show it.
but such a could.. still is a mistery to me.
Its kind of strange we want to draw verry simple, but that seams to require a lot of knowledge these days.
There is still support for basic drawing, as in VB6, through GDI. This is relevant (http://www.codeproject.com/KB/GDI-plus/GDI_.aspx). GDI will usually(?) be hardware accelerated, so you still get speed without messing with OpenGL or DirectX. The downside is that it's not really meant for games and such that update the screen dozens of times a second (but then, the built in VB6 stuff isn't either).
-
i found some examples here http://nio.astronomy.cz/vb/opengl.html (http://nio.astronomy.cz/vb/opengl.html) (which seams fast for a basic aplication),
they use openGL and a wrapper called Tao, which seams to be updated recently
And it doesnt require to install a huge SDK from microsoft, these working demos are pretty small coded.
Tao's also good, yes. It wraps OpenGL, though, so if you've only done DirectX in the past it's going to be a bit of a learning curve (if you've done neither it's not a big deal).
OpenGL exists in windows since i think NT3.51 so its pretty stable, and you can upgrade it like directx.
speed diffrences are not huge, so its mainly about how easy it would be to draw lines and circles.
They both get converted by your graphics driver to raw hardware calls. Though DirectX support tends to be better, especially from ATI. NVidia does a pretty good job with OpenGL, which is why it's preferred for Linux.
Hmm if I only could have a picturebox and have it ehmmm like assigned a such openGL power (or directx).
Then I could do all the drawings I want and fast, and then a refresh of the object to show it.
but such a could.. still is a mistery to me.
Its kind of strange we want to draw verry simple, but that seams to require a lot of knowledge these days.
There is still support for basic drawing, as in VB6, through GDI. This is relevant (http://www.codeproject.com/KB/GDI-plus/GDI_.aspx). GDI will usually(?) be hardware accelerated, so you still get speed without messing with OpenGL or DirectX. The downside is that it's not really meant for games and such that update the screen dozens of times a second (but then, the built in VB6 stuff isn't either).
Well i've done neither, so i will slowly learn it i guess.
Ive seen now code to interop c++ also
Maybe a small program can be made using tao, another wrapper to draw with a few command only circle / line / pixel /refresh /clrscr
and have a refresh command so its executed at once.
(or like drawing on a hidden screen part and then the video memory block is switched) , i asume such functions would exist
-
Well i've done neither, so i will slowly learn it i guess.
Word of warning: if you've never done any OpenGL/XNA/DirectX before, and don't have a real good understanding of how graphics cards work... Well, it's going to be difficult. You're pretty close to the metal. Basically video cards don't know how to draw anything but triangles. So for drawing circles you have to either tessellate it (divide it up into triangles) or draw a square with a circle texture. And there are a lot of ways to do something, only some of which are fast.
Did you see the GDI link I posted at the bottom of my last post? It's built right in to .NET and I think it'll save you a lot of effort. It's based more on the "draw circle at x,y pixel position" paradigm you might be used to.
-
Well i've done neither, so i will slowly learn it i guess.
Word of warning: if you've never done any OpenGL/XNA/DirectX before, and don't have a real good understanding of how graphics cards work... Well, it's going to be difficult. You're pretty close to the metal. Basically video cards don't know how to draw anything but triangles. So for drawing circles you have to either tessellate it (divide it up into triangles) or draw a square with a circle texture. And there are a lot of ways to do something, only some of which are fast.
Did you see the GDI link I posted at the bottom of my last post? It's built right in to .NET and I think it'll save you a lot of effort. It's based more on the "draw circle at x,y pixel position" paradigm you might be used to.
I've seen the GDI sample, they remind me of the pen up and pen down commands of logo, which i never was a fan of..
I've been thinking too to use sprites for circles, that way no calculations..hmm
but they need to rotate as well, and scale not sure if that is something a graphic card does do fast.
Would it be better to scale, or to have multiple sprites of different sizes ?
-
I've seen the GDI sample, they remind me of the pen up and pen down commands of logo, which i never was a fan of..
I've been thinking too to use sprites for circles, that way no calculations..hmm
but they need to rotate as well, and scale not sure if that is something a graphic card does do fast.
Would it be better to scale, or to have multiple sprites of different sizes ?
Yes, they use transformation matrices (http://en.wikipedia.org/wiki/Transformation_matrix) to handle scale, rotation, and translation of triangles. Once the triangles are placed in screen space, they get their texture sampled and applied.
Textures/sprites have the advantage that they require fewer pixels. But they'll get pixelated if you zoom in too close. Using triangles will mean the edges won't be smooth, but will look more like a n-gon (eg: octagon) when you zoom in.
-
I've seen the GDI sample, they remind me of the pen up and pen down commands of logo, which i never was a fan of..
I've been thinking too to use sprites for circles, that way no calculations..hmm
but they need to rotate as well, and scale not sure if that is something a graphic card does do fast.
Would it be better to scale, or to have multiple sprites of different sizes ?
Yes, they use transformation matrices (http://en.wikipedia.org/wiki/Transformation_matrix) to handle scale, rotation, and translation of triangles. Once the triangles are placed in screen space, they get their texture sampled and applied.
Textures/sprites have the advantage that they require fewer pixels. But they'll get pixelated if you zoom in too close. Using triangles will mean the edges won't be smooth, but will look more like a n-gon (eg: octagon) when you zoom in.
HMM
GL_Line_Loop
thinking of something fast to create n sides (its slow to do all with cos and sin) ,
basicly a quarter of a circle, or even maybe 1/8 is enough to get all X,Y positions ... hmm thinking fast routines no (zero) divisions and re-using values, and arrays.
-
Numsqil what do you think of this :
idea for openGL
The more precize the circles are, the less circles you have to draw since the viewscreen is zoomed in..
So .. ideas get more complex, but also you dont have to draw anything outside the current viewscreen (speeding things up).
I'm not sure if the program needs to know what is inside the viewscreen (vb.net could be aware of that).
So a circle routine has to be aware of the zoom scale.
for some simple math testing for this i'd like to have a... simple language to draw.. duh.
hmmm i'm beginning to wonder if c++ might be more easy for this all together, as might tackle to many problems at once.
-
I've seen the GDI sample, they remind me of the pen up and pen down commands of logo, which i never was a fan of..
You mean turtle graphics? Whats wrong with them?
-
I've seen the GDI sample, they remind me of the pen up and pen down commands of logo, which i never was a fan of..
You mean turtle graphics? Whats wrong with them?
I had to learn logo at school while i had at home an MSX in those days (which was graphically way more advanced).
It might be something else too, i never like penwidth or patern fills, i like 32bit collors when they where available.
ANYWAY i found something COOL
Its called BASIC4GL (google for their wiki space and download it from there, the main site seams to be offline).
A basic compiler with openGL language support, the basic isnt as advanced as vb6 or vb.net, but it does do fast openGL...
So now i can experimenting drawing in OpenGL before i write somekind .net program to get familiar with openGL.
-
HMM
GL_Line_Loop
thinking of something fast to create n sides (its slow to do all with cos and sin) ,
basicly a quarter of a circle, or even maybe 1/8 is enough to get all X,Y positions ... hmm thinking fast routines no (zero) divisions and re-using values, and arrays.
Yeah, you'll want to use a line loop probably. You can bake the vertices into a display list. That's being pretty old-school but it's fairly easy to set up vs. the speed you'd get.
Numsqil what do you think of this :
idea for openGL
The more precize the circles are, the less circles you have to draw since the viewscreen is zoomed in..
So .. ideas get more complex, but also you dont have to draw anything outside the current viewscreen (speeding things up).
I'm not sure if the program needs to know what is inside the viewscreen (vb.net could be aware of that).
So a circle routine has to be aware of the zoom scale.
That's how I'd do it using the fixed function pipeline in OpenGL (as opposed to shaders) for highest quality graphics. But it's a bit of an effort to code up.
for some simple math testing for this i'd like to have a... simple language to draw.. duh.
hmmm i'm beginning to wonder if c++ might be more easy for this all together, as might tackle to many problems at once.
Did you get Tao working? I found it very easy to use. The only hard part was adding the Tao graphics control to a winform (hard as in tricky to navigate through all the menues and everything). You can probably steal one of the NeHe tutorials (http://nehe.gamedev.net/lesson.asp?index=01) as a starting point. I think the C# source code for them uses Tao.
-
HMM
GL_Line_Loop
thinking of something fast to create n sides (its slow to do all with cos and sin) ,
basicly a quarter of a circle, or even maybe 1/8 is enough to get all X,Y positions ... hmm thinking fast routines no (zero) divisions and re-using values, and arrays.
Yeah, you'll want to use a line loop probably. You can bake the vertices into a display list. That's being pretty old-school but it's fairly easy to set up vs. the speed you'd get.
Numsqil what do you think of this :
idea for openGL
The more precize the circles are, the less circles you have to draw since the viewscreen is zoomed in..
So .. ideas get more complex, but also you dont have to draw anything outside the current viewscreen (speeding things up).
I'm not sure if the program needs to know what is inside the viewscreen (vb.net could be aware of that).
So a circle routine has to be aware of the zoom scale.
That's how I'd do it using the fixed function pipeline in OpenGL (as opposed to shaders) for highest quality graphics. But it's a bit of an effort to code up.
for some simple math testing for this i'd like to have a... simple language to draw.. duh.
hmmm i'm beginning to wonder if c++ might be more easy for this all together, as might tackle to many problems at once.
Did you get Tao working? I found it very easy to use. The only hard part was adding the Tao graphics control to a winform (hard as in tricky to navigate through all the menues and everything). You can probably steal one of the NeHe tutorials (http://nehe.gamedev.net/lesson.asp?index=01) as a starting point. I think the C# source code for them uses Tao.
I first need to get a bit known with openGL so i first will play with that other basic variant, since it understands native opengl commands
Later i will use TAO,... yep i allready been reading about that part seamed complex to me too, how to get it into a form/picturebox ..first openGL it is.
OH BTW just woke up with another speed improvement idea (not sure if it is allready used)
We only need to calculate with sin / cos after a colission, we dont have to do it each time.
.. and apparently opengl does understand movement to (matrix movements, and matrix turns)....