Darwinbots Forum

Bots and Simulations => DNA - General => The Gene depository => Topic started by: rsucoop on February 15, 2008, 03:45:56 PM

Title: True Aiming using only physics
Post 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.
Title: True Aiming using only physics
Post by: goffrie on March 02, 2008, 05:24:42 PM
Quote from: rsucoop
Code: [Select]
*.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr
You could just use
Code: [Select]
*.refxpos *.xpos sub *.refypos *.ypos sub pyth
Title: True Aiming using only physics
Post by: rsucoop on March 03, 2008, 12:19:19 AM
Quote from: goffrie
Quote from: rsucoop
Code: [Select]
*.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr
You could just use
Code: [Select]
*.refxpos *.xpos sub *.refypos *.ypos sub pyth
If only I had known how to use the pyth command to begin with..  
Title: True Aiming using only physics
Post by: d-EVO on November 16, 2008, 04:43:11 PM
You spelt aimshot wrong! It is spelt aimshoot, not aimshot.
Title: True Aiming using only physics
Post by: ikke on November 17, 2008, 05:49:14 AM
Quote from: goffrie
Quote from: rsucoop
Code: [Select]
*.refxpos *.xpos sub 2 pow *.refypos *.ypos sub 2 pow add sqr
You could just use
Code: [Select]
*.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
Title: True Aiming using only physics
Post by: bacillus on November 17, 2008, 06:50:04 PM
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.
Title: True Aiming using only physics
Post by: rayz on April 02, 2009, 12:54:27 PM
Quote from: bacillus
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


Title: True Aiming using only physics
Post by: Peksa on April 02, 2009, 04:14:08 PM
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=).