02.12.2014

Robocode: C++ Robots

posted by Karsten

In my Evolutionary Computation class I have a (great) course work where the students develop Evolutionary Killerrobots in robocode. This is a great game in Java with a port to .NET. The website is well-documented for Java/C#.

For people who wants to develop robots in managed C++ the help is a bit old. This is intended as a guide, I have made the screenshots in Visual Studio 2013.

 

Begin by creating a project in VS.

01

Then select a C++ CLR Class Library project and give it an appropriate name. Press ok.

02

 

Once it has loaded, right click on the project (not the solution)

03

 

 

Select properties

04

 

Select “Common Properties”. Press References, and then “Add New References”

05

 

Click Browse to the left, and then Browse to the right.

06

 

Locate your robocode.dll file. It is usually in c:\robocode\libs. Press Add.

07

 

It will now show up under References.

08

 

Under “Configuration Properties” press General. Select “Common Language Runtime Support”. From the drop down choose “Safe MSIL Common Language Runtime Support (/clr:safe). Press ok

09

 

Go to the robot .cpp file. In my example it is called TestRobot.cpp

10

 

Create a robot. I always extend AdvancedRobot, because it gives me more possibilities. Build the project.

11

 

 

 

To test out the robot. Open Robocode and under options click Preferences.

12

 

Open the “Development Options” and press Add

13

 

Locate the folder where the robot is build. I only add Debug here, because I am only testing the robot. If I build a release I would also need to add the release build folder.

14

 

You can now find the robot when you set up a new battle.

15

Share

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment