As part of our class Robocode tournament, we were each tasked with designing a robot for competition. I've combined what I discerned were the best qualities from our Robocode warm-up exercise due earlier in the week plus a few tweaks that I thought would help it in combat.
This phase of the project was implemented with a single goal: defeat the sample robots.
Design:
- Movement - based on scan events. Robot will move towards scanned enemies in a circular fashion to avoid getting hit. The following methods have also been overidden: onHitWall - Robot backs away from wall 120 pixels at 45 degrees. This ensures that the robot does not get stuck in a corner or on a wall where it can be easily preyed on. onHitByBullet - Robot will turn gun and radar towards enemy that fired and also move to avoid subsequent shots. onHitRobot - will fire at full power and attempt to ram the robot that it has collided with. This behavior is similar to the RamFire sample robot.
- Targeting - attempts to keep it's radar locked on an opponent by realigning it's radar to face any scanned robots. If no scanned robots have been spotted, the robot will scan to the left and right to find the nearest robot. Also retargets to an enemy robot if hit by bullets from that enemy robot.
- Firing - fires using firepower proportional to the distance from the target. Fires whenever an enemy robot is scanned.
- Simple robots that were easily conquered: Crazy, Fire, Interactive, MyFirstJuniorRobot, PaintingRobot, SittingDuck, SpinBot, VelociRobot
- Corners - initially I used a regular tracking implementation where I moved straight towards the target. This allowed Corners to lock on to me. By moving forward in a circular pattern and bouncing off the walls I was able to avoid most bullets and land shots of my own.
- RamFire - I implemented a similar onHitRobot method to RamFire, but I increased the firepower to max power to inflict maximum damage. This overpowered RamFire's lesser firepower.
- Tracker/Trackfire - Probably the next hardest to beat, but the circular movement combined with my targeting (that ironically is based off of Tracker) allowed me to stay mobile, avoid bullets, and destroy both of these robots consistently. Both robots use linear movement when moving toward a target.
- Walls - I lost to this sample robot due to the distance this robot keeps from its target.
After submission of my robot for the tournament, I ran it against the following robots in the sampleex class:
- Won: Alien, AlienComposition, Master and Slave, ProxyOfGrayEminence, Slave, MyFirstDroid,
Lessons Learned:
I really would've liked to explore some of the targeting algorithms that would've helped to increase accuracy when firing upon a moving robot. Also, the anti-gravity movement algorithm presented by IBM also looked very intriguing and I would've liked to see how well it performed. I also read an article about narrow radar locks and it's also something that seemed worth exploring to try to improve the targeting system.
I'm not sure how my robot will fare when pitted against robots with more complex movement implementations.
I also would've liked to have tested it in multiple/melee battles.
From a software development perspective, I would've liked to have modularized the code a little more. There are definitely some targeting statements that are repeated throughout the code.
Tournament Results:
Out of 25 robots, I made it into the semi-finals, losing to the eventual winner, bubonic. Bubonic was outfitted with Walls-type movement and predictive shooting. I lost all 4 rounds.
Overall, however, I was pleased with the outcome. My robot on preliminary melee battles with other students was found to have a glaring weakness towards Walls-class robots. So the outcome of the battle wasn't surprising at all.
Download:
No comments:
Post a Comment