Debugging waves with onPaint()

Jump to navigation Jump to search
Revision as of 17 May 2012 at 14:39.
The highlighted comment was created in this revision.

Debugging waves with onPaint()

I've had a problem vexing me for some time....

From what I know by reading this amazing wiki, bots fire bullets the tick after fire()/setFire() are called. (assuming one never calls them until the gun is cool) However, if I make a wave (a wave that I'm firing for targeting purposes, not a wave fired at me) with a launchTime = getTime()+1 and then draw it, my wave reliably gets drawn one tick behind the bullet on the robocode screen.. doesn't begin to break (my waves change color when they begin the breaking process) till a tick after the bullet visually hits the opposing bot.

Everything lines up perfectly on screen if I just have launchTime be this tick.. but that's supposed to be off. I don't think I'm off in my wave radius calculation:

radius = velocity*(getTime()-launchTime)

Does a Bullet move its first step on the same tick it is created?

    Tkiesel14:39, 17 May 2012

    Are you doing your calculating in run() or in onScannedRobot()? IIRC they happen on different sides of the getTime() update.

      Skilgannon15:39, 17 May 2012