[Home]History of BotBuilding/Tips2

Robo Home | Changes | Preferences | AllPages


Revision 10 . . January 8, 2008 0:38 EST by Martin Alan Pedersen [explanation of firing a bullet]
Revision 9 . . (edit) October 31, 2006 17:25 EST by Voidious [updating a couple tips]
  

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

Added: 34a35,48
Q: How does firing at an opponent work?

A: Letís start with a basic example: Turn 29, you instruct your gun to turn x degrees / radians. Turn 30, you instruct your gun to fire. Turn 31, your gun fires.

Now letís give some context to all of that. The instruction to fire is processed before the instructions to move or turn your gun. This means that you cannot aim and fire in the same turn, so you must aim one turn and fire the next. Your tank will also move once before firing (the same turn you are aiming). Your opponent will also be moving while you are aiming, possibly changing speed and heading. Your data will always be one turn old between deciding where to shoot and shooting.

Second illustration: In turn 29, you receive a ScannedRobotEvent, and use the data to determine the enemy robotís position. Afterward, using your movement strategy, you determine where your own robot should go and what position it will be in turn 30 as a result of movement instructions. Analyzing your opponents position and behavior, you decide what bullet power to use and angle to fire at from your future (Turn 30) position. To conclude turn 29, you tell the AdvancedRobot super class to set the throttle (Ahead) and adjust the tankís chassis, gun, and radar headings, concluding with the execute() blocking call.

In turn 30, you receive another ScannedRobotEvent, decide where to move, and how to aim (since you may as well keep aiming to keep your gun close to where it will need to be when you can fire again). To conclude turn 30, in addition to the previous instructions, you call setFire with the bullet power chosen in Turn 29.

On the server side of Turn 31 (before you are returned control of your robot), the new bullet is fired from your cool gun and travels one bulletVelocity (translated from bulletPower) length, and all other bullets are also moved. Then all bot position and chassis heading changes are processed. Then guns are rotated, and finally radars, resulting in ScannedRobotEvents for Turn 31.

-- Martin Alan Pedersen


Robo Home | Changes | Preferences | AllPages
Search: