Difference between revisions of "Robocode/Eclipse/Create a Robot"

From Robowiki
Jump to navigation Jump to search
m
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{stub}}
+
This page describes how to create a robot in [http://www.eclipse.org/ Eclipse], and assume that you already know [[Robocode/Eclipse/Create a Project|how to create a project in Eclipse]].
 +
 
 +
== Creating a Robot in Eclipse ==
 +
Ok, so we have a project now, and it's time to create a robot (or many robots!) in it.
 +
 
 +
First, right-click on the '''MyRobots''' project, and select New -> Class:
 +
 
 +
[[Image:Eclipse-NewClass.png|Shows how to select a new class by right-clicking on the MyRobots project]]
 +
 
 +
 
 +
Next, fill in the package name (Robocode suggests your initials), a Robot Name (here I have '''FnlBot'''), and change the '''Superclass''' field to '''robocode.Robot''':
 +
 
 +
[[Image:Eclipse-NewJavaClass.png|Shows the dialog for creating a new Java class named FnlBot, which is inherited from the robocode.Robot class]]
 +
 
 +
 
 +
Click '''Finish''', and you'll see your robot class, like this:
 +
 
 +
[[Image:Eclipse-FnlBotEdit1.png|Shows editing the newly created FnlBot.java source file, which is empty and needs to be filled out with some code]]
  
This page describes how to create a robot in [http://www.eclipse.org/ Eclipse], and assume that you already now [[Robocode/Eclipse/Create a Project|how to create a project in Eclipse]].
 
  
== Creating a Robot in Eclipse ==
+
You can now edit your robot however you like.
 +
 
 +
[[Image:Eclipse-FnlBotEdit2.png|Shows editing the newly created FnlBot.java source file, which has now been filled out with a bit more meaningful code]]
 +
 
 +
 
 +
You can save your robot as often as you like by hitting '''CTRL-S''', or selecting '''File->Save'''. There's no need to explicit select '''Compile''' (as in the Robot Editor for [[Robocode]]) anymore, since Eclipse automatically takes care of this task for you, when you make changes to your files.
 +
 
 +
Have fun playing around with Eclipse. Since there's no better way to learn than by playing around, I'll leave you to it!
 +
 
 +
If you want help starting a robot you should check out the [[Robocode/My First Robot|My First Robot]] tutorial
 +
 
 +
The only thing left is to make sure that [[Robocode/Add a Robot Project|Robocode sees your robot]].
 +
 
 +
== References ==
 +
* [http://www.eclipse.org/ Eclipse.org - Eclipse home page]
 +
* [http://www.eclipse.org/downloads/ Eclipse Downloads]
 +
* [http://download.eclipse.org/eclipse/downloads/ Eclipse project downloads - latest releases]
 +
 
 +
== See also ==
 +
 
 +
=== Using Eclipse IDE ===
 +
* [[Robocode/Eclipse|Using Eclipse as IDE]]
 +
* [[Robocode/Eclipse/Create_a_Project|Creating a project for your robots]]
 +
* [[Robocode/Add_a_Robot_Project|Add robot project from an IDE into Robocode]]
 +
* [[Robocode/Running from Eclipse|Running your robot from Eclipse]]
 +
* [[Robocode/Eclipse/Debugging Robot|Debugging your robot with Eclipse]]
 +
 
 +
=== Robot API ===
 +
* [http://robocode.sourceforge.net/docs/robocode/ Robot API]
 +
 
 +
=== Tutorials ===
 +
* [[Robocode/System Requirements|System Requirements for Robocode]]
 +
* [[Robocode/Download|How to download and install Robocode]]
 +
* [[Robocode/Robot Anatomy|The anatomy of a robot]]
 +
* [[Robocode/Getting Started|Getting started with Robocode]]
 +
* [[Robocode/My First Robot|My First Robot Tutorial]]
 +
* [[Robocode/Game Physics|Robocode Game Physics]]
 +
* [[Robocode/Scoring|Scoring in Robocode]]
 +
* [[Robocode/Robot Console|Using the robot console]]
 +
* [[Robocode/Downloading_Robots|Downloading other robots]]
 +
* [[Robocode/Learning from Robots|Learning from other robots]]
 +
* [[Robocode/Package Robot|Package your robot]]
 +
* [[Robocode/FAQ|Frequently Asked Questions (FAQ)]]
 +
* [[Robocode/Articles|Articles about Robocode]]
 +
* [[Robocode/Console Usage|Starting Robocode from the command line]]
 +
* [[Robocode/Graphical_Debugging|Graphical debugging]]
 +
 
 +
=== News and Releases ===
 +
* [http://sourceforge.net/export/rss2_project.php?group_id=37202 RSS Feeds for the Robocode project]
 +
* [http://sourceforge.net/project/showfiles.php?group_id=37202&package_id=29609 Robocode file releases]
  
== See Also ==
+
=== Home pages ===
 +
* [http://robocode.sourceforge.net/ Classic homepage]
 +
* [http://sourceforge.net/projects/robocode Robocode project at SourceForge]
 +
* [http://robocoderepository.com/ Robocode Repository]
 +
* [[wikipedia:Robocode|Wikipediaentry for Robocode]]
  
 
[[Category:Robocode Documentation]]
 
[[Category:Robocode Documentation]]
 +
[[Category:Tutorials]]
 +
[[Category:Eclipse IDE]]

Latest revision as of 23:56, 26 December 2015

This page describes how to create a robot in Eclipse, and assume that you already know how to create a project in Eclipse.

Creating a Robot in Eclipse

Ok, so we have a project now, and it's time to create a robot (or many robots!) in it.

First, right-click on the MyRobots project, and select New -> Class:

Shows how to select a new class by right-clicking on the MyRobots project


Next, fill in the package name (Robocode suggests your initials), a Robot Name (here I have FnlBot), and change the Superclass field to robocode.Robot:

Shows the dialog for creating a new Java class named FnlBot, which is inherited from the robocode.Robot class


Click Finish, and you'll see your robot class, like this:

Shows editing the newly created FnlBot.java source file, which is empty and needs to be filled out with some code


You can now edit your robot however you like.

Shows editing the newly created FnlBot.java source file, which has now been filled out with a bit more meaningful code


You can save your robot as often as you like by hitting CTRL-S, or selecting File->Save. There's no need to explicit select Compile (as in the Robot Editor for Robocode) anymore, since Eclipse automatically takes care of this task for you, when you make changes to your files.

Have fun playing around with Eclipse. Since there's no better way to learn than by playing around, I'll leave you to it!

If you want help starting a robot you should check out the My First Robot tutorial

The only thing left is to make sure that Robocode sees your robot.

References

See also

Using Eclipse IDE

Robot API

Tutorials

News and Releases

Home pages