Sunday, September 20, 2009

DiamondBot

Robocode is a fun, educational game where people can develop a virtual robot and battle it against other robots to see how effective it is. My first attempt at designing a competitive robocode robot was called DiamondBot. It was designed based on observations that I made during my review of sample robots that are provided with the robocode installation as well as the brainstorming of counter-robots for some of the sample robots. I tried to incorporate strengths and defenses for weaknesses that I observed into the design. The goal was to reliably defeat as many of the following sample robots as possible. The sample robots to defeat were Walls, RamFire, Spinbot, Crazy, Fire, Corners, Tracker, and Sitting Duck. Descriptions of my robot's movement, firing, and targeting are shown below.

Movement:
DiamondBot moves around the robot battlefield in a diamond pattern. The robot's movements change based on whether it is hitting its target or not. If it's hitting its target, then it will stay still if it gets close to the enemy. If the robot is missing its target, then it will try to stay away. If a collision with another robot occurs, the robot attempts to back away and continue with its normal movement pattern.

Firing:
DiamondBot varies the power of its bullets based on distance and accuracy. As an enemy gets closer, the power of the bullets fired increases. If DiamondBot is missing a lot, the maximum power of a bullet is reduced to prevent it from becoming disabled as quickly.

Targeting:
DiamondBot targets enemies by scanning with its radar and firing at the scanned position. If DiamondBot is missing a lot, it attempts to shoot an enemy by leading it to cause the enemy to run into the bullet.

DiamondBot was able to consistently defeat Walls, Ramfire, Crazy, Fire, Corners, Tracker, and Sitting Duck. However, it did not do well against Spinbot. I tried to come up with a strategy that could be used against Spinbot but, when making changes to compensate for Spinbot, I found that my performance against other robots decreased. I finally decided to sacrifice performance against Spinbot in order to keep performance against the other robots.

Creating my first competitive robot gave me insight into how difficult it is to create a well-rounded robot that is effective against many different strategies. When I made changes to increase my robot's performance against a specific robot, it often degraded its performance against other robots. It is very difficult to balance a robot, so it is always effective. I should have come up with a more solid, well-thought out strategy by doing further research on different strategies before starting to build my robot. I found that you must be flexible in your design because things don't always work out how you planned.

A packaged version of DiamondBot can be found here.

No comments:

Post a Comment