Difference between revisions of "Swarming"
From WikiManual
Line 6: | Line 6: | ||
*The bots must be moving in the same direction | *The bots must be moving in the same direction | ||
*The bots must have the same speed | *The bots must have the same speed | ||
+ | |||
+ | |||
+ | == Methods == | ||
+ | |||
The best way to make bots swarm is to have them align with the heading of local conspecs, and move forward when searching for prey (rather than spinning) | The best way to make bots swarm is to have them align with the heading of local conspecs, and move forward when searching for prey (rather than spinning) | ||
Line 15: | Line 19: | ||
*.refaim *.setaim store | *.refaim *.setaim store | ||
stop | stop | ||
+ | |||
+ | |||
+ | == A swarming bot == | ||
+ | |||
+ | |||
+ | ' Get rid of birth tie | ||
+ | |||
+ | cond | ||
+ | start | ||
+ | .tie *.robage 1 add mult inc | ||
+ | .deltie inc | ||
+ | stop | ||
+ | |||
+ | ' Search | ||
+ | |||
+ | cond | ||
+ | *.eye5 0 = | ||
+ | start | ||
+ | 10 .up store | ||
+ | *.eye9 *.eye1 sub 2 mult .aimdx store | ||
+ | stop | ||
+ | |||
+ | ' Swarm | ||
+ | |||
+ | cond | ||
+ | *.eye5 0 > | ||
+ | *.refeye *.myeye = | ||
+ | start | ||
+ | *.refaim .setaim *.robage sgn mult store | ||
+ | *.refvelup .up store | ||
+ | stop | ||
+ | |||
+ | ' Hunt | ||
+ | |||
+ | cond | ||
+ | *.eye5 0 > | ||
+ | *.refeye *.myeye != | ||
+ | start | ||
+ | *.refvelup 50 add .up 40 *.eye5 sub sgn mult store | ||
+ | *.refxpos *.refypos angle .setaim *.robage sgn mult store | ||
+ | stop | ||
+ | |||
+ | cond | ||
+ | *.eye5 40 > | ||
+ | *.refeye *.myeye != | ||
+ | start | ||
+ | -6 .shoot store | ||
+ | 8 .shootval store | ||
+ | *.refveldx .dx store | ||
+ | stop | ||
+ | |||
+ | ' Reproduce | ||
+ | |||
+ | cond | ||
+ | *.body 500 > | ||
+ | start | ||
+ | 50 .repro store | ||
+ | stop | ||
+ | |||
+ | end |
Revision as of 17:04, 3 April 2006
Swarming is when many bots move in large groups
Some loose 'rules' of swarming:
- The bots must be aware of each other
- The bots must act on their awareness of the other bots, coordinating their movement accoringly
- The bots must be moving in the same direction
- The bots must have the same speed
Methods
The best way to make bots swarm is to have them align with the heading of local conspecs, and move forward when searching for prey (rather than spinning)
cond *.eye5 0 > *.refeye *.myeye = start *.refaim *.setaim store stop
A swarming bot
' Get rid of birth tie cond start .tie *.robage 1 add mult inc .deltie inc stop ' Search cond *.eye5 0 = start 10 .up store *.eye9 *.eye1 sub 2 mult .aimdx store stop ' Swarm cond *.eye5 0 > *.refeye *.myeye = start *.refaim .setaim *.robage sgn mult store *.refvelup .up store stop ' Hunt cond *.eye5 0 > *.refeye *.myeye != start *.refvelup 50 add .up 40 *.eye5 sub sgn mult store *.refxpos *.refypos angle .setaim *.robage sgn mult store stop cond *.eye5 40 > *.refeye *.myeye != start -6 .shoot store 8 .shootval store *.refveldx .dx store stop ' Reproduce cond *.body 500 > start 50 .repro store stop end