Author Topic: How can I get this to work?  (Read 4838 times)

Offline havingphun

  • Bot Builder
  • **
  • Posts: 54
    • View Profile
How can I get this to work?
« on: January 22, 2012, 03:38:50 PM »
This is my bot but how can I get it so there is a head and two body pieces and that the body pieces follow the head. I have tried this but the system to track the type of piece each is isnt working and I know the problem is right there I just can't see it. I want to create more advanced multi-bots if i can get this working.

Code: [Select]
def head 50
def body 51


cond
*.eye5 0 >
*.refeye *.myeye !=
*.head 0 !=
*.multi 1 =
start
*.refveldx .dx store
*.refvelup 30 add .up store
*.refxpos *.refypos angle .setaim store
stop

cond
*.eye5 50 >
*.refeye *.myeye !=
'*.refeye *.myeye !=
*.head 0 !=
*.multi 1 =
start
-1 .shoot store
*.refvelup .up store
*.refxpos *.refypos angle .setaim store
stop

cond
*.multi 1 =
*.head 0 !=
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop

cond
*.numties 0 =
*.numties 1 = or
*.robage 0 !=
*.head 0 =
*.tienum < 3
start
32 .repro store
.tienum inc
.head inc
stop

cond
*.robage 0 =
*.body 0 =
*.head 0 =
start
.body inc
.tie inc
stop

cond
*.nrg 30000 >
*.body 0 !=
*.head 0 != or
start
.body dec
.head inc
.tienum 0 =
.deltie inc
stop

cond
*.multi 1 =
*.head 1 = and
start
*.eye5 .tout1 store
50 .sharenrg store
3 .fixlen store
100 .stifftie store
628 .fixang store
*.aimright .tout2 store
*.head .tout3 store
*.tienum .tout4 store
stop

cond
*.head 0 =
*.body1 0 = or
start
*.tiepres .readtie store
*.tin1 .eye5 store
*.tin2 .aimright store
*.tin4 .tienum store
stop

cond
*.head 1 =
*.body 1 = or
*.numties 2 >
start
*.tiepres .deltie store
stop

end

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: How can I get this to work?
« Reply #1 on: January 23, 2012, 06:50:19 PM »
Have you debugged if the .head and .body locations are changing values?

I didn't see anything obviously wrong but it's hard enough to debug DNA code you've written, let along DNA code someone else wrote.

You might also look at the DNA in the program and make sure it matches with the DNA text file to make sure there aren't any typos.

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
Re: How can I get this to work?
« Reply #2 on: January 25, 2012, 04:18:56 AM »
hmm first *.tienum < 3 --> *.tienum  3 <
Second Maybe i just overlooked it, but I have not seen anywhere where you specify the tailbot to match the heads speed.
*.tin2 .aimright store <-- direction but not speed, also aimright means turning acertain amount right based on the direction your bots currently facing its not independent of robot orientation like aim. (so bad if your tail looks elsewhere)
*.tin1 .eye5 store <-- maybe I am wrong but I think the refreshing of sensory variables is done pretty early in the turn and as this store command is almost at the end of the code is the changed eyevalue even read by something?

modified:
I think once the tie is hardened the angle might not only be fixed for the head but also the tail(again not 100% sure)
if thats so any attempt to turn would result in the tie working like a lever.
« Last Edit: January 25, 2012, 07:21:05 AM by Welwordion »

Offline havingphun

  • Bot Builder
  • **
  • Posts: 54
    • View Profile
Re: How can I get this to work?
« Reply #3 on: March 28, 2012, 09:31:38 AM »
Have you debugged if the .head and .body locations are changing values?

I didn't see anything obviously wrong but it's hard enough to debug DNA code you've written, let along DNA code someone else wrote.

You might also look at the DNA in the program and make sure it matches with the DNA text file to make sure there aren't any typos.

hmm first *.tienum < 3 --> *.tienum  3 <
Second Maybe i just overlooked it, but I have not seen anywhere where you specify the tailbot to match the heads speed.
*.tin2 .aimright store <-- direction but not speed, also aimright means turning acertain amount right based on the direction your bots currently facing its not independent of robot orientation like aim. (so bad if your tail looks elsewhere)
*.tin1 .eye5 store <-- maybe I am wrong but I think the refreshing of sensory variables is done pretty early in the turn and as this store command is almost at the end of the code is the changed eyevalue even read by something?

modified:
I think once the tie is hardened the angle might not only be fixed for the head but also the tail(again not 100% sure)
if thats so any attempt to turn would result in the tie working like a lever.


Ok ill look at these things. Also I didnt really explain this well but I want the bots to be in something like a triangle so the two bodies follow the head. A basic multibot so I could get started with them and understand them better.

Offline havingphun

  • Bot Builder
  • **
  • Posts: 54
    • View Profile
Re: How can I get this to work?
« Reply #4 on: April 01, 2012, 11:56:27 AM »
Code: [Select]

def head 50
def body 51
def cantie 52

cond
*.robage 0 =
start
head 0 =
body 0 =
cantie 0 =
stop

cond
*.robage 0 >
*.head 0 =
*.body 0 >
*.body 0 = or
*.numties 2 =
start
.cantie inc
.body inc
stop

cond
*.robage 0 >
start
*.head .tout5 store
*.body .tout6 store
*.cantie .out1
stop

cond
*.eye5 0 >
*.refeye *.myeye !=
*.head 0 >
*.multi 1 =
*.numties 2 =
start
*.refveldx .dx store
*.refvelup 30 add .up store
*.refxpos *.refypos angle .setaim store
stop

cond
*.eye5 50 >
*.refeye *.myeye !=
*.head 0 !=
*.multi 1 =
*.numties 2 =
start
-1 .shoot store
*.refvelup 30 add .up store
*.refxpos *.refypos angle .setaim store
stop

cond
*.multi 1 =
*.head 0 !=
*.eye5 0 =
*.refeye *.myeye = or
start
314 .aimdx store
stop

cond
*.numties 0 =
*.robage 20 >
*.head 0 =
*.tienum 3 <
start
33 .repro store
.tienum inc
.head inc
stop

cond
*.numties 1 =
*.robage 0 >
*.body 0 >
*.body 0 = or
*.tout5 0 >
start
32 .repro store
.body inc
stop

cond
*.refeye *.myeye =
*.myeye 0 =
*.numties 2 =
*.robage 0 >
*.in1 0 >
*.body 0 >
*.body 0 = or
*.head 0 =
start
.tie inc
.tienum inc
.body inc
stop
 
cond
*.robage 0 =
*.body 0 =
*.head 0 =
start
.body inc
.tie inc
stop

cond
*.nrg 30000 >
*.body 0 !=
*.head 0 != or
start
0 .body store
1 .head store
.tienum 0 =
.deltie inc
stop

cond
*.multi 1 =
*.head 1 = and
start
*.eye5 .tout1 store
50 .sharenrg store
3 .fixlen store
100 .stifftie store
628 .fixang store
*.aimdx .tout8 store
*.up .tout7 store
*.aim .tout2 store
*.head .tout3 store
*.tienum .tout4 store
stop

cond
*.robage 20 >
*.head 0 =
*.body 1 =
start
*.tiepres .readtie store
*.tout8 .aimdx store
*.tin7 .up store
*.tin1 .eye5 store
*.tin2 .setaim store
*.tin4 .tienum store
stop

cond
*.head 1 =
*.body 1 = or
*.numties 2 >
start
*.tiepres .deltie store
stop

end

I fixed the snake like thing with cantie. Now I just need to get the body bots to follow the head bot. Not sure how ive tried alot of things, but they have not worked. The body follows the heads speed and rotation. i might have an idea to fix it.