Darwinbots Forum
Bots and Simulations => DNA - General => The Gene depository => Topic started by: rsucoop on February 15, 2008, 03:45:56 PM
-
Trying to calculate shots using miniscule amounts of time makes aiming genes difficult to perfect, but take a look at this one I've developed for Slim Evo. It uses the idea of time, distance divided by speed (constant 40) and the angle method with a velocity vector adder. Hope you enjoy it, I have:
*.refxpos *.refypos angle .setaim store
*.refxpos *.refypos angle *.refaim *.refvel mult 40 *.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr div mult 60 *.focuseye mult mult .aimdx store
*.refxpos *.refypos angle `(*.refaim *.aim sub abs mult) .aimshot store
`Note: the inserted piece I did not use, but may be helpful for a corrective shot procedure.
The aimdx is extremely accurate. The distance formula under 40 (speed of a shot) gives you time, multiplied by the angle by the focuseye angle half-point multiplied by theta (angle to the bot) and the bots vector; it leaves some room for mutations to improve upon it, but it works very well for me.
-
*.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr
You could just use *.refxpos *.xpos sub *.refypos *.ypos sub pyth
-
*.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr
You could just use *.refxpos *.xpos sub *.refypos *.ypos sub pyth
If only I had known how to use the pyth command to begin with..
-
You spelt aimshot wrong! It is spelt aimshoot, not aimshot.
-
*.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr
You could just use *.refxpos *.xpos sub *.refypos *.ypos sub pyth
=
*.refxpos *.refypos dist
I am working on the same thing. Didn't know shot speed was 40 and was about to figure it out empyrically. Will post my (firing) solution when finished
Thanks
-
If I were you, I wouldn't use .aimshoot. It's got the nasty tendency to do unpredictable things, although I did manage to find out that a.) it either uses a scale different to the other aiming features b.) it's measured going the wrong way or c.) it has a different starting point. Point is, it's very messy to work with.
-
If I were you, I wouldn't use .aimshoot. It's got the nasty tendency to do unpredictable things, although I did manage to find out that a.) it either uses a scale different to the other aiming features b.) it's measured going the wrong way or c.) it has a different starting point. Point is, it's very messy to work with.
I think it goes the wrong way. These two lines of code make eye5 and the shot direction point the same way:
*.aimHeading *.aim sub .eye5dir store
*.aim *.aimHeading sub .aimshoot store
-
This is from my shot at true dog figher bot. I got as far as a funcional bot that allways faces up. It actually used .refaim for part of it's conspec.
*.refxpos *.refypos angle 314 sub - .aimshoot store
Trafalgar (he designed the monster-bot Guardian) did empirical studies (http://www.darwinbots.com/Forum/index.php?s=&showtopic=2523&view=findpost&p=1376532) and ended at shot speed 39. I recommend reading his posts if you intend to make a true aiming bot. Also I recommend reading abyaly's bot's, especially Aura (http://www.darwinbots.com/Forum/index.php?showtopic=2058&hl=).