π¦ 0.30.0 - Added Graphics Debugging
π #116: Graphical Debugging Implemented Using SVG
Graphical debugging, known from the original game, has been implemented using SVG with the [JSVG] library. This allows you to paint graphics objects on the battlefield while the game is running, making it easier to visualize elements such as estimated target positions. This feature is available for both the Java API and .Net API.
Java API
- Use the new
getGraphics()
method to return ajava.awt.Graphics2D
object for painting objects. - Thanks to Tobias Zimmermann for bringing this feature to the Bot Java API, for suggesting the use of SVG and [JSVG], and also adding
transform-box
to JSVG to mirror texts. β€οΈ - Thanks also to Jannis Weis for providing [JSVG] and helping fix an issue with using the correct libraries for JSVG. Make sure to buy him a coffee. π
.Net API
- Get a
SvnNet.SvgGraphics
context for painting by using theGraphics
getter. - The .Net API uses the SvgNet library. The
SvgGraphics
is context used similarly to System.Drawing.Graphics.
β οΈ Graphical Debugging must be enabled before anything is rendered to the battlefield.
Enabling Graphical Debugging
Graphical debugging can be enabled from the Properties pane of the bot console by toggling the Toggle Graphical Debugging
button. Graphical debugging is not enabled per default, and must be applied to individual bots.
Sample Bots
A new sample bot, PaintingBot, has been introduced to showcase the use of debug painting in both Java and C#.
Schema changes
-
A new
debugGraphics
(string) field has been added to thebot-intent
schema. This field allows you to provide SVG content as a string, which will be rendered if debugging graphics is enabled. Note that not all SVG functionality is supported by JSVG used for rendering SVG onm the battlefield. -
A new
isDebuggingEnabled
(boolean) field has been added to thebot-state
schema. This field specifies whether the debugging graphics feature is enabled for the bot. ThedebugGraphics
field will only be used ifisDebuggingEnabled
is set totrue
.
π Bug Fixes
- Server:
- Log messages printed out
{}
instead of content.
- Log messages printed out
- UI:
- Fixed issue with the switch button in the Server Options for switching between using a local and remote server.
π Documentation
You find the Robocode Tank Royale documentation here. You should start out by reading Getting Started first.
π¨ Try it out
Please head over to My First Bot tutorial to learn how to set up your first bot for Robocode Tank Royale.
π Installing Robocode
You need Java 11 as a minimum or newer, e.g. the newest version of Java available.
You can read the installation guide to get more details about installing both Java and Robocode.
βΆ Running Robocode
The main application is the GUI Application which is a Java application. You can read about how to use the GUI Application here.
The Robocode GUI application is run from the command line (shell or command prompt) in order to start and view
battles:
java -jar robocode-tankroyale-gui-0.30.0.jar
π€ Sample bots
If you are new to Robocode, you need to download some bots and extract those to directories on your system.
These bot directories can be added from the menu of the GUI: Config β Bot Root Directories
These sample bots are currently available:
Platform | Archive | Requirements |
---|---|---|
C# | sample-bots-csharp-0.30.0.zip | Microsoft .Net SDK 6.0 or newer |
Java | sample-bots-java-0.30.0.zip | Any Java SDK 11 or newer |
All bots are put in zip archives, which should be installed in independent directories.
Each zip archive contains a ReadMe.md file with more information for the specific platform.
π¦ Bot API
In order to start developing bots for Robocode, the following APIs are available.
π¦ Java:
Available as:
- Jar file: robocode-tankroyale-bot-api-0.30.0.jar
- Artifact at Nexus Repository
- Artifact at Maven Central Repository (available after some time)
π¦ .Net:
Available as:
- Artifact at Nuget repository