# HowTo

Robo Home | Changes | Preferences | AllPages

Difference (from prior major revision) (no other diffs)

 As I mentioned to AvihooI on ICQ, the distance doesn't factor in, because what really matters is the ratio of enemy speed to bullet speed; at any distance, those two sides of the right triangle, if you'll imagine it as one, form the same angle at the gun source. -- Voidious

How to figure out the maximum location (x and y) that an enemy robot can be by the time my bullet gets there (according to distance and firepower)? - AvihooI edit: Come to think of it, there should also be a minimum location (if the enemy robot goes the other way).

• A rough approximation that many people use (including me) is: +/-(Math.asin(8.0/bulletVelocity)). The logic is that the enemy can travel at a max speed of 8.0, and your bullet will travel at bulletVelocity. If you imagine that as a right triangle with them moving strictly perpendicular to you, then the angle you would be firing at would have sin=(8.0/bulletVelocity). I think they can actually get a bit further than that if they cut a bit closer to you instead, so I use a maximum factor of 1.1, just in case. -- Voidious

What about the distance? -- AvihooI

Well, there are basically two approaches to targeting. You can either predict where the target is going to be (simple targeters, pattern matchers) or you can fire at the angle that is most likely to hit (based on past observations). The calculation Voidous gave comes from the latter approach, used when scaling prior successful angles to the range of possible angles that the target can get to. The location of impact (or distance to it) isn't really a direct concern for that targeting approach, just the angle (relative to dead-on) of fire.
If you want to predict where your opponent will be, you are going to have to assume a movement behavior (linear, circular, match to previous pattern) and plot out each tick's location one at a time, until the bullet has enough time to arrive at the target's location. Then you aim for that intercept point and fire (on the following turn). Even though predictive targeting is easier to code, it takes more time to process, at least for me. -- Martin

As I mentioned to AvihooI on ICQ, the distance doesn't factor in, because what really matters is the ratio of enemy speed to bullet speed; at any distance, those two sides of the right triangle, if you'll imagine it as one, form the same angle at the gun source. -- Voidious

Robo Home | Changes | Preferences | AllPages