Tuesday, September 15, 2009

So You Think You Can Robot?

Today we will be reviewing some sample robots included with the RoboCode game and looking at what makes them tick.

We will be evaluating: Walls, RamFire, SpinBot, Crazy, Fire, Sitting Duck, Corners, Tracker; on these three criteria:

1. Movement - How they heck are they moving? Crazy randomness or controlled chaos?
2. Targeting - Which way are they looking? How do they find their next prey?
3. Firing - Fire at will! How do they fire? Unload all your ammo and pray no one is left standing?

Walls

First up we have walls, a very simple robot. The first thing it does when it begins is to turn to the wall closest to the direction is it facing; meaning even if the wall is one pixel away from it, if it is facing in the other direction it will go to that side instead. I am unsure of the coders reasons for doing this, but it does save valuable time turning. After reach a wall it will travel around the battle field in a constant circle from corner to corner.

This walls robot does not have actual targeting. What it does is use the radar as attached to the gun, and fire as soon as the gun is aligned with another robot. The gun is always point out at the battle field, so it will fire once as it lines up with a target horizontally or vertically, and then again when the robot turns at the corner because of the shift in the position of the gun.

One thing I noticed is that this robot will stop and fire continuously at another robot that is blocking it's path, only if the gun is currently facing in that direction cause by the arc of a corner turn. Meaning this will only happen in a corner. Other than that, if your robot moves and doesn't stick to the sides, this robot is not very effective. Against a stationary opponent though, it is super effective.

RamFire

RamFire is a interesting a unique robot as it is on a suicide missions. How this robot works is it chooses a target and then SLOWLY rams into them. In RoboCode, collisions between two robots cause damage to both parties. It will keep moving up against its target, "Ramming", them for damage.

Targeting is done by a simple scan from the turn of the gun and body. Once it scans its first target and rams them continuously. My tests show that it does not track, but goes for the first scanned target, if its current target moves out of the way in time, it will begin scanning again for something to ram.

To avoid killing itself in the process, RamFire begins bombarding its target once it has made contact with them. In RoboCode, you score points and regain energy on successful gun hits.

Again this robot is quite effective against a stationary target or one that stays in the corner and can become trapped. Other than that move of my simple movement robots, as long as they do not stop can usually avoid getting caught by RamFire.

SpinBot

SpinBot is a very simple robot that I actually borrowed some code on when doing my own spinning movement. SpinBot moves in a circle and that is about it. Looking at the code, the robot is taking a very hard right while flooring the gas and never stops.

While rotating in this circle, any time the gun lines up with another robot, it will fire a shot at it. It is kind of simple is does ok against some robots as the circular movement avoids many shots, though due to the small radius of spin it sometimes runs into the bullet anyways as it makes a full circle, and then it is also a easy target for robots such as RamFire.

Crazy

Now here is an interesting robot. They name only gives us a small hint at what this actually does. The Crazy robot is designed to move around in a crazy fashion. What? I had to take a look inside the code to understand for myself what the heck was going on.

The Crazy robot's movement is designed in a very simple three step manner. It turns 90 degrees one way, then 180 the other way, then 180 again the other way, all while moving forward or backwards. On wall hits or being hit, it will reverse direction. This gives it a very random move path because there are many collision events and each time it will respond but moving around in a circular 180 degree fashion.

There is no real targeting like with many of the above robots, what Crazy does is fire on the scan of the gun with another robot. Very simple no tracking involved.

Overall Crazy is a very evasive robot and survives a while even against the more aggressive robots.

Fire

Fire is a very simple robot and is something that we have programmed before. Fire is no movement. It is stationary and rotates it's guns to scan for targets. Upon scanning a target it will stop turning its gun continuously fire until the target is destroyed. Fire turns its gun in a clockwise fashion so it has minor tracking ability if you are moving in a northern or north eastern path, but will lose its target and start firing on a new one if you move counter clockwise around it.

Overall very aggressive but does not work well against mobile and other aggressive robots who have mobility.

Sitting Duck

Like the above Fire robot, Sitting Duck is also a robot that we have made before. Having none of the three elements we are looking for, sitting duck basically is a stationary target practice, or a road block.

Corners

Corners is quite a good robot, but interestingly very simple. I had heard that it was one of the tougher robots. Upon testing, it is mind boggling how simple it is and yet it is very powerful.

All Corners does is picks one of the corners to go hide in. It moves to the sides and the into the corner on start. If by chance that it is destroyed in the current round, it will remember that is choose a different corner the next round hoping for the better.

Firing on Corners is very simple too. It is set to fire on scan from the gun, so it will fire if a robot moves directly in front of its line of vision. Once in the corner it will rotate the run back and forth between the angles that its back is not against. This allows it to fire at a more rapid pace and avoid needless scans. I though it was very effective that it did not scan areas it knew had no enemies.

Tracker

Tracker is the only robot to have a lock and track movement out of the other seven reviewed. It is similar to the tracking robot that we have programmed. It rotates its gun to scan for a target. One found it will lock on and move to within a set distance.

The targeting like most of the other robots, consist of turning the gun around until the object is scanned. To keep track of a target, it will store a targets name and check to see if a scanned object is the currently tracked target.

Firing for Tracker is a simple, when it is within a set distance fire at the target. Upon testing, I found it to be extremely ineffective. Since it only fires at a target at a certain distance, it is very easy to miss a constantly moving target. I also found that it has a hard time catching up to a target that is constantly on the run.

I was able to defeat Tracker using a movement only robot that goes runs to the corners. Tracker wasted energy by missing all its shots and then running out of energy before every getting the chance to get close enough.

Battle For Supremacy

As a final battle after testing and reviewing each of of the samples separately, I decided to have a little fun and throw them all into a giant battle. Surprisingly, the top place robot were SpinBot and Crazy. The circular movement robots. I had initially thought the robots utilizing the corners and sides where there is less threat from behind would win, but the circular movement of the robots allowed them to avoid fire from all sides.

No comments:

Post a Comment