Author Topic: Demo of new vision capabilities  (Read 3785 times)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Demo of new vision capabilities
« on: November 20, 2006, 08:08:42 PM »
Here's a couple simple genes which illustrate the new vision capabilities in 2.42.9c and beyond.  


'If there is nothing in the focus eye, splay eyes 1-8 around the bot evenly.  Each eye pans across the their own 1/8th of the 360 degree view.
'eye9 rotates through the full 360 degrees. The focus eye jumps from one eye to the next each cycle.  
cond
*.eyef 0 =
start
*.robage 157 mod 140 sub .eye1dir store
*.robage 157 mod 105 sub 157 add .eye2dir store
*.robage 157 mod 70 sub 314 add .eye3dir store
*.robage 157 mod 35 sub 471 add .eye4dir store
*.robage 157 mod 0 sub 628 add .eye5dir store
*.robage 157 mod 35 add 785 add .eye6dir store
*.robage 157 mod 70 add 942 add .eye7dir store
*.robage 157 mod 105 add 1099 add .eye8dir store
*.robage 1256 mod -1 mult .eye9dir store
*.robage 9 mod 4 sub .focuseye store
stop

'If something comes into view in the focus eye, then turn to face it and bring all the eyes to bear in the normal configuration
cond
*.eyef 0 >
start
*.focuseye 525 add * *.focuseye -35 mult add *.aim add .setaim store
0 .eye1dir store
0 .eye2dir store
0 .eye3dir store
0 .eye4dir store
0 .eye5dir store
0 .eye6dir store
0 .eye7dir store
0 .eye8dir store
0 .eye9dir store
0 .focuseye store
stop

'Dummy gene that has an eye statement so the program knows to turn on the eyes
cond
start
*.eye5 > 0
stop
« Last Edit: November 20, 2006, 08:26:13 PM by EricL »
Many beers....

Offline Zinc Avenger

  • Bot Builder
  • **
  • Posts: 56
    • View Profile
Demo of new vision capabilities
« Reply #1 on: November 21, 2006, 08:03:07 AM »
Interesting. I'm working through it trying to work out what it all means

Always nice to see new capabilities for our little script-driven friends.

So .eyeNdir sets the direction in which to point eyeN, .focuseye sets which eye has focus (gets refvars) and you can access the focus eye regardless of whichever eye it happens to be through .eyef?

Have another cookie.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Demo of new vision capabilities
« Reply #2 on: November 21, 2006, 10:39:04 AM »
You have it exactly right.  The only hard part is the offsets.  I had to make it so that so that 0 values default to what people are used to so as to avoid breaking existing bots.  Thus .focusye ranges from -4 to +4 with 0 being .eye5 instead of from 1 to 9.  Similar thing with the .eyeNdir's.   The genes above help illustrate this.
Many beers....