[Home]BasicSurfer

Robo Home | Changes | Preferences | AllPages

The bot created in the WaveSurfing Tutorial.


Hey Skilgannon, I'm pretty sure it's right how it was. If you're going solely on the evidence of graphical debugging, be warned that it doesn't always line up with reality. Been a while since dealing with nitty gritty surf details, so I'll double check later, but pretty sure it's right as is. -- Voidious

IIRC, -1 is correct. Because you can only detect energy drop 1 round after it has happened. And -2 for the data cause thats the data the enemy used to aim, as it fires the turn after it is stated. Then again my memory is shotty, maybe Voidious can clear that up some. --Chase-san

Using debug graphics I couldn't get it to line up with bullets on the waves. My score went up about 10% against DevilFISH (to 92%, with segmentation) after changing it to -2. Here's the debug code I used:

   public void onPaint(java.awt.Graphics2D g) {
         g.setColor(Color.red);
         for(int i = 0; i < _enemyWaves.size(); i++){
            EnemyWave w = (EnemyWave)(_enemyWaves.get(i));
            int radius = (int)w.distanceTraveled;
            Point2D.Double center = w.fireLocation;
            if(radius - 40 < center.distance(_myLocation))
               g.drawOval((int)(center.x - radius ), (int)(center.y - radius), radius*2, radius*2);
         }
      }
It may have to do with the doSurfing() being in the onScannedRobot() instead of the run(), and the order of event execution, I'm not sure. -- Skilgannon

Just reviewed some things, I'm as sure as I could be that it's right with T-1. There's discussion about it on the RobocodeSG, EnemyWaves, and EnergyDrop pages. According to GamePhysics page, the battlefield draws between onScannedRobot and run - so in terms of robot performance, it doesn't matter in which you put your code, but it might for debugging graphics. Edit: Umm, duh, it still shouldn't matter as the timer doesn't advance anywhere in there. -- Voidious

Yeah, that would do it. The debug gets called before the 'advance waves', so prints with the old data. I'm still not sure why my score leapt up, though. Maybe I'll try to fix mine to call from the run() using getAllEvents?(), though I don't really mind PerformanceEnhancingBugs =) -- Skilgannon

Finally found the bug that was causing my score to do better with the T-2, it had to do with my distancing. I'm now getting 97.5% vs. DevilFISH, without firing, over 500 rounds. This is with T-1. I've changed my debug code:

   public void onPaint(java.awt.Graphics2D g) {
         g.setColor(Color.red);
         for(int i = 0; i < _enemyWaves.size(); i++){
            EnemyWave w = (EnemyWave)(_enemyWaves.get(i));

            int radius = (int)(w.distanceTraveled + w.bulletVelocity);
            //hack to make waves line up visually, due to execution sequence in robocode engine
            //use only if you advance waves in the event handlers (eg. in onScannedRobot())

            Point2D.Double center = w.fireLocation;
            if(radius - 40 < center.distance(_myLocation))
               g.drawOval((int)(center.x - radius ), (int)(center.y - radius), radius*2, radius*2);
         }
      }
Thanks for catching that, guys. Maybe it would be a good idea to add this code to BasicSurfer? -- Skilgannon


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited August 2, 2007 14:52 EST by Voidious (diff)
Search: