[Home]CoopRobot

Robo Home | Changes | Preferences | AllPages

What is it?

CoopRobot is a robot framework that extends TeamRobot and provides automated and standardized team functionality to your robot. This means that any robots extending CoopRobot can be teamed up with any other CoopRobots into any assortment of teams. The CoopRobot framework is so simple to use that you simply change 'extends AdvancedRobot' to 'extends CoopRobot' in your robot and it is ready for team play.

The framework automatically handles team coloring, radar messaging, droid scan faking, and provides methods for automatically messaging targeting and movement strategies. This means if you wanted to make a droid version of your robot, you could simply add 'implements Droid', and still use onScannedRobot; the CoopRobot framework automatically creates scans based on teammate data. Upon packaging your robot, the CoopRobot framework is packaged for you along with your robot so you don't have to worry about portability or compatibility.

CoopRobot is currently in version beta1. Come try it out with your robots!


Quick Start

So, you'd like to set up your melee or team robot to play cooperatively with other robots? You've come to the right place!

First, Download the CoopRobot system here: http://www.robocoderepository.com/BotDetail.jsp?id=631 Unzip it with folder info to your robots folder (i.e. c:\robocode\robots).

Next, open up your robot. At the very first line of code (after the package and imports), change 'extends AdvancedRobot / TeamRobot' to 'extends coop.CoopRobot'. For example:

 public class Cake extends AdvancedRobot {
should be changed to:
 public class Cake extends coop.CoopRobot {

Compile your robot. If the compile fails, you may have missed one of the above steps; go back and try again.

That's it, you're done! Now test out you robot in normal non-team battles, and test it out teamed up with other CoopRobots? to make sure it works. If you have problems, feel free to ask in /Chat.

You are welcome to distribute your robot with CoopRobot; however, CoopRobot is currently in beta1, so it may not function properly with your robot; don't blame me if your robot doesn't function correctly! :(. To package it with CoopRobot, simply package it as you would normally. The CoopRobot classes will automatically be included. Do not package a team containing robots other than your own.

Droid Mode

To create a droid form of your robot, create a new robot named whatever you want to name the droid. Delete all the code generated in the file, and add this single line of code:

 package PKG; public class BOTDROID extends BOT implements robocode.Droid {}
where PKG is your package, BOTDROID is the name of your droid, and BOT is the name of your robot. For example, to create CupCake?, the droid form of Cake in package vuen, you would put:
 package vuen; public class CupCake? extends Cake implements robocode.Droid {}

Compile, and you're done! You now have a droid for of your robot. Now test it out in teams with any other CoopRobots? with radars. Some robots are incompatible with this automatic droid creation; for example, Vapour and Relativity from the below list do not function properly in droid mode. If your robot functions incorrectly in droid mode, you may need some additional changes to make it work. More on this later.


Who can I play with?

Once your robot is set up, it can team up with any other robot implementing the CoopRobot system.

To get you started, here are some sample CoopRobots:

Here is a list of robots currently implementing the system.

Once you implement the system, add your robot to the list!


How can I improve my team play?

A few critical changes and a number of methods have been added to your CoopRobot. Firstly, these two methods have been added/modified:

 getOthers()
 getLiveTeammates()
getOthers() was changed to only return the amount of live enemies; it's counterpart, getLiveTeammates(), returns only the amount of live teammates (not including self (i think this may be buggy! :( already a bug)).

Another change is that you will never receive teammate scans; instead, you will be able to retrieve information on all your teammates through any of the following methods:

 isTeammateAlive?(name)
 getTeammateX?(name)
 getTeammateY?(name)
 getTeammateHeading?(name)
 getTeammateGunHeading?(name)
 getTeammateRadarHeading?(name)
 getTeammateVelocity?(name)
 getTeammateEnergy?(name)
 getTeammateGunHeat?(name)
 getTeammateTarget?(name) //i think target may be bugged (:( 2 bugs already!)
 getTeammateDestinationX?(name)
 getTeammateDestinationY?(name)

You pass as an argument the name of the teammate of whom you want the information. You can get a list of teammates using getTeammates(). If an invalid name is passed, the robot is dead, the robot does not exist, the robot is not a CoopRobot, or the robot is not transmitting the information, false, null, and Double.NaN will be returned.

You will notice three additional fields; target and destination coordinates. These allow you to view a teammates target and destination, if the teammate is broadcasting it. This information is not required, so some CoopRobots? (the sample bots for example) may not broadcast the name of their target or their destination; however this information can be broadcast and used to transmit strategic information. You can message your current target and destination as follows:

 setTarget(name)
 setDestinationX(name)
 setDestinationY?(name)

Destination refers to your immediate destination, where your robot intends to head in the next 30 or 40 ticks or so. You should not message a target name that does not exist; this may cause your teammates to crash.

The last added method in beta1 of CoopRobot is this one:

 setAllowTeamScans(bool)

If activated, this will cause your robot to accept incoming scans from other teammates as regular scans. Your robot will not tell the difference between real scans and teammate-messaged scans; they will go to onScannedRobot (or getXxxEvents?). Do not call this if your scan event depends on the position of your radar; this may be why bots such as Vapour do not function in droid mode. If however your code works with this, it can be a great advantage to your team, because you can gather much more data on enemies at once. Once activated it remains on for the battle (unless of course turned off).

More methods to add more strategic information management will likely be added in future versions.


Notes

This is a set of minor notes you may wish to be aware of; you may also wish to look here if you have problems.

.


/Chat

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 4, 2006 20:15 EST by Voidious (diff)
Search: