Darwinbots Forum
Bots and Simulations => Bot Tavern => Topic started by: Welwordion on April 13, 2006, 08:56:17 PM
-
Swarm bots work by monitoring their brethrens and such exchanging information about their velocity,
such its an easy thought that other informations like the position of enemy units might be shared the same way.
The problem with conventional bots however is, that they can not access the "network" (by monitoring another bot of their kind) and "survey" their surroundings to get new information at the same time.
My solution to this problem is:
Construct a multibot consisting of an "headbot" and an "eyebot", the headbot looks for food and enemy, while the eyebot monitors your brethrens to get information, then this information is transmitted trough the tie to the headbot and both head- and eyebot put it into the out channel so other bots can access the information.
Additionally bots could produce satellites that form transmission lines enabling communication over larger distances.
Here comes in some know how: The network multibot might not move conventionally but rather similar to rocket worm(although I never could get my hands on a rocket worm text file), meaning the eye transfers all of his energy to the head killing itself, the head reproduces, ties and becomes the new eye while his children becomes the new head:
E-H
...H
...H-H
...E-H Note: the new eye turns to the coordinates of the last "access" to the network
......H
......H-H
......E-H
Ocasionally, when the distance to the next network acccess becomes larger instead of killuing itself of the eye would untie and work as a satellite
E-H
E H
E H-H
E E-H
E....H
This is the first reason why the reproduction movement could be beneficial, the second is that zero movement speed simplifies calculations for aiming and observing.
-
Sounds interesting, I'd like to see something like this in action.
-
' Cometes Duo
'
' Moves using reproduction
' Best on large sims
def newmom 51
def head 52
cond
*.robage 1 >
*.numties 0 =
*.nrg 100 >
start
50 .repro store
1 .newmom store
1 .head store
stop
cond
*.newmom 1 =
start
.tie inc
.newmom dec
stop
cond
*.numties 1 =
*.multi 0 =
start
628 .fixang store
5 .fixlen store
1 .tienum store
1 .readtie store
stop
cond
*.head 1 =
*.multi 1 =
start
90 .sharenrg store
*.eye7 *.eye3 sub 7 div .dx store
stop
cond
*.head 1 =
*.multi 1 =
*.eye5 30 >
start
-6 .shoot store
32 .shootval store
stop
cond
*.head 1 =
*.nrg 10000 >
*.multi 1 =
start
50 .sharenrg store
32000 .tielen1 store
stop
cond
*.head 0 =
*.multi 1 =
start
.repro inc
32000 .tielen2 store
stop
cond
*.head 1 =
*.bodgain 0 >
start
*.bodgain 10 mult .fdbody store
stop
end
This bot uses *.in .out to communicate the locations of food to conspecs
' SocialSwarm
cond
start
.tie *.robage 1 add mult inc
.deltie inc
stop
cond
*.eye5 0 >
*.refeye *.myeye =
*.in1 0 !=
*.in2 0 !=
start
*.in1 .out1 store
*.in2 .out2 store
stop
cond
*.body 500 <
*.out1 0 !=
*.out2 0 !=
start
*.out1 *.out2 angle .setaim store
stop
cond
*.eye5 50 <
start
10 .up store
stop
cond
*.eye1 *.eye5 >
*.eye9 *.eye5 > or
start
*.eye9 *.eye1 sub 2 mult .aimdx store
stop
cond
*.eye5 35 >
*.refeye *.myeye !=
start
-6 .shoot store
8 .shootval store
stop
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refxpos .out1 store
*.refypos .out2 store
*.refveldx .dx *.eye5 sgn mult store
stop
cond
*.eye5 50 >
*.refeye *.myeye =
start
*.refaim .setaim store
stop
cond
*.body 1000 >
start
50 .repro store
stop
cond
*.nrg 5000 >
start
100 .strbody store
stop
cond
*.nrg 100 <
start
*.body .fdbody *.body sgn mult store
stop
end
********************************************************************
' SocialSwarm
'
' Communicates with conspecs
' using in and out
cond
start
.tie *.robage 1 add mult inc
.deltie inc
stop
cond
*.eye5 0 >
*.refeye *.myeye =
*.in1 0 !=
*.in2 0 !=
start
*.in1 .out1 store
*.in2 .out2 store
stop
cond
*.body 500 <
*.out1 0 !=
*.out2 0 !=
start
*.out1 *.out2 angle .setaim store
stop
cond
*.eye5 50 <
start
10 .up store
stop
cond
*.eye1 *.eye5 >
*.eye9 *.eye5 > or
start
*.eye9 *.eye1 sub 2 mult .aimdx store
stop
cond
*.eye5 35 >
*.refeye *.myeye !=
start
-6 .shoot store
8 .shootval store
stop
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refxpos .out1 store
*.refypos .out2 store
*.refveldx .dx *.eye5 sgn mult store
stop
cond
*.eye5 50 >
*.refeye *.myeye =
start
*.refaim .setaim store
stop
cond
*.body 1000 >
start
50 .repro store
stop
cond
*.nrg 5000 >
start
100 .strbody store
stop
cond
*.nrg 100 <
start
*.body .fdbody *.body sgn mult store
stop
end
-
Ah thx quite interesting, although the comet seems to move differently from what I imagined.
Well here is the code I wrote till now, next up will be the Coordination=exchange of information between eye and head.
def function 50
'(0= head 1=eye)
def satposx 61
def satposy 62
def swarming 55
'(0=prioritize food in sight 1=prioritize network orders)
'Bewegung und Struktur(movement and structure)
'Suchroutinen(searchroutines)
'the head will observe the movement of food and enemies, while the eye will use
' the same routine to follow their own kind.
'
Feind und Beuteerkennung(enemy and food recognition)
cond
*.swarming 0 =
*.refeye *.myeye !=
*.refxpos *.out1 sub abs 50 >=
start
*.refxpos *.out1 store
stop
cond
*.swarming 0 =
*.refeye *.myeye !=
*.refypos *.out2 sub abs 50 >=
start
*.refypos *.out2 store
stop
'Netzwerkzugriff (network access)
cond
*.refeye *.myeye =
*.in1 .out1 !=
*.function 1 =
start
*.in1 .out1 store
stop
cond
*.refeye *.myeye =
*.in2 .out2 !=
*.function 1 =
'deactivate when swarming is 0?
start
*.in2 .out2 store
stop
cond
*.refeye *.myeye =
*.refxpos *.satposx sub abs 50 >=
'deactivate when swarming is 0?
start
*.refxpos *.satposx store
stop
cond
*.refeye *.myeye =
*.refypos *.satposy sub abs 50 >=
start
*.refypos *.satposy store
stop
'Koordination (coordination)
cond
start
stop
'kind of hard to decide which information is accessed under which conditions
-
How come everybody is using my "newmom" user defined variable?
Knew I should have got a patent on it
-
Ugh, I just realize I have to somehow prevent the bot from storing the coordinates from his partner or child into satposx and satposy.
(this repro movement makes it somewhat hard to keep information running. Hmm, does the racial memory work properly? Then I maybe could use that and slow down movement a little bit?)
-
Ok its still incomplete but here is the code I made so far (for reference whats need to be down look at the end of the code).
Note: Its not tested yet so it might be quite buggy
'x coordinates are stored into out3, y coordinates are stored in mkshell and tielen
'the x and y distances to the network access are assumed to be 2 digits numbers and are
'stored into body with a loss of accuracy.
'when swarming is 0(no) head and eye will store the heads information into out1 and out2
'vice versa when swarming is >0(yes) head and eye will store the eyes information into out1 and out2
'the head will move towards the coordinates in out1 and out2
def function 50
'(0= head 0> eye)
def swarming 55
'(0=prioritize food in sight 0> prioritize network orders)
'initialize (includes MB grow routine which is used for moving)
'enable reading of x coordinatess from eye
cond
*.tmemloc .out3 !=
start
.out3 .tmemloc store
stop
'complete the bot, become the eye and face toward network access
cond
*.numties 0 =
*.function 0 =
start
90 .repro store
.function inc
*.xpos *.body 100 mod *.body 10 mod sub add *.ypos *.body 10 mod add angle .setaim store
stop
'form the tie and turn away
cond
*100 0 =
*.refeye *.myeye =
start
17 .tie store
618.aimdx store
100 inc
stop
'data storage
'x coordinate of enemy into out3
cond
*.refeye *.myeye !=
*.refxpos *.out3 sub abs 50 >
start
*.refxpos .out3 store
stop
'first 3 digits of y coordinate of enemy into last 3 digits of shell
cond
*.refeye *.myeye !=
*.refypos *.refypos 100 mod sub 100 div *.shell 1000 mod !=
start
*.refypos *.refypos 100 mod sub 100 div *.shell 1000 mod sub .mkshell
stop
'last 2 digits of y coordinate of enemy into last 2 digits of tielen
cond
*.refeye *.myeye !=
*.refypos 100 mod *.tielen 100 mod sub abs 50 >
start
*.refypos 100 mod .fixlen store
stop
'x coordinate of network target into out3
cond
*.refeye *.myeye =
*.in1 *.out3 sub abs 50 >
start
*.in1 .out3 store
stop
'first 3 digits of y coordinate of network target into last 3 digits of shell
cond
*.refeye *.myeye =
*.in2 *.in2 100 mod sub 100 div *.shell 1000 mod !=
start
*.in2 *.in2 100 mod sub 100 div *.shell 1000 mod sub .mkshell
stop
'last 2 digits of y coordinate of network target into last 2 digits of tielen
cond
*.refeye *.myeye =
*.in2 100 mod *.tielen 100 mod sub abs 50 >
start
*.in2 100 mod .fixlen 100 add store
stop
'x distance to network access is stored into second last digit of body and ypos into last digit
cond
*.refeye *.myeye =
*.function 0 >
*.body 100 mod *.refxpos *.xpos sub *.refxpos *.xpos sub 10 mod sub *.refypos *.ypos sub *.refypos *.ypos sub 10 mod sub 10 div add !=
start
*.body 100 mod *.refxpos *.xpos sub *.refxpos *.xpos sub 10 mod sub *.refypos *.ypos sub *.refypos *.ypos sub 10 mod sub 10 div add sub dup dup dup
sgn 1 add 2 div .fdbody store
sgn 1 sub 2 div .strbody store
stop
'head gets info about network access and transforms distances according to his own position.
cond
*.function 0 =
*.body 100 mod *.trefbody 100 mod *.trefxpos *.xpos sub *.trefxpos *.xpos sub 10 mod sub add *.trefypos *.ypos sub *.trefypos *.ypos sub 10 mod sub 10 div add !=
start
*.body 100 mod *.trefbody 100 mod *.trefxpos *.xpos sub *.trefxpos *.xpos sub 10 mod sub add *.trefypos *.ypos sub *.trefypos *.ypos sub 10 mod sub 10 div add sub dup dup dup
sgn 1 add 2 div .fdbody store
sgn 1 sub 2 div .strbody store
stop
'target choosing
'head uses his x coordinate
cond
*.function 0 =
* swarming 0 =
start
*.out3 .out1 store
stop
'head uses eyes x coordinate
cond
*.function 0 >
* swarming 0 >
start
*.tmemval .out1 store
stop
cond
'head uses his y coordinate
*.function 0 =
* swarming 0 =
start
*.shell 1000 mod 100 mult *.tielen 100 mod add .out1 store
stop
cond
'head uses eyes y coordinate
*.function 0 =
* swarming 0 =
start
*.trefshell 1000 mod 100 mult *.tielen 100 mod add .out1 store
stop
'movement
'aim at target
cond
start
*.out1 *.out2 .setaim store
stop
'aim at attacker
cond
.hit 0 !=
start
*.shang .setaim store
stop
'through the killing of the eye the MB grow routine is used for moving
cond
*.numties 0 !=
*.eye5 40 <
*.function 0 =
*.out1 *.out2 add 0 !=
start
100 .sharenrg store
stop
'satellites and reproduction
'swarming or not swarming?
'waste and weight`
'feeding and defending
end
Note : I attached the simplified version I made to run this bot unfortunately its only moving to the left could not figure out why :/.
-
As currently ties are a little buggy I will postpone the two bot Mb apprach and concentarte on concepts that leave satellites, wires behind to communicate information.