Difference between revisions of "Talk:Linear Targeting"

From Robowiki
Jump to navigation Jump to search
(Linear targeting disovery!)
(13 is assumed bulletspeed)
Line 22: Line 22:
 
Also, I have found that if it remains 13,  but the firepower is adjusted to 2.0, it is also 100% accurate.
 
Also, I have found that if it remains 13,  but the firepower is adjusted to 2.0, it is also 100% accurate.
 
--[[User:Awesomeness|Awesomeness]] 22:43, 16 March 2009 (UTC)
 
--[[User:Awesomeness|Awesomeness]] 22:43, 16 March 2009 (UTC)
 +
 +
This isn't something new. In the formula the 13 represents the speed of the bullet. The original formula ''assumed'' a firepower in the general area of 2.33. For a firepower of 3.0 the accurate value is 11, and for firepower 2.0 the accurate value is 14. It probably should be mentioned alongside the code though but it's generally been assumed that people knew what the 13 was. See [[Robocode/Game Physics]] for more information. --[[User:Rednaxela|Rednaxela]] 23:39, 16 March 2009 (UTC)

Revision as of 01:39, 17 March 2009

Credits - Example of Noniterative Linear Targeting
Old wiki page: LinearTargeting/NanoLinearTargeting
Original author(s): Kev



I find the noniterative targeting 100% accurate aside from walls if you replace the 13 with a 10. I was fooling around with the code to try and make it more accurate, and I made a discovery! New code:

double absoluteBearing = getHeadingRadians() + e.getBearingRadians();
setTurnGunRightRadians(Utils.normalRelativeAngle(absoluteBearing - 
    getGunHeadingRadians() + (e.getVelocity() * Math.sin(e.getHeadingRadians() - 
    absoluteBearing) / 10.0)));
setFire(3.0);

Does anyone else get the same results? I hope so. If it does, I'll be... remembered! For a very small thing... But... But I'll be like, on a very small scale, like ABC, like all of the "Robocode scientists", I will have made a discovery! I'll be so happy with myself! =') --Awesomeness 22:39, 16 March 2009 (UTC)

Also, I have found that if it remains 13, but the firepower is adjusted to 2.0, it is also 100% accurate. --Awesomeness 22:43, 16 March 2009 (UTC)

This isn't something new. In the formula the 13 represents the speed of the bullet. The original formula assumed a firepower in the general area of 2.33. For a firepower of 3.0 the accurate value is 11, and for firepower 2.0 the accurate value is 14. It probably should be mentioned alongside the code though but it's generally been assumed that people knew what the 13 was. See Robocode/Game Physics for more information. --Rednaxela 23:39, 16 March 2009 (UTC)