Build the best - destroy the rest!

Wednesday, 9 July 2008

Robocode 1.6.1 Beta 2

Lots of bugfixes and changes were made for the Robocode 1.6.1 Beta 2 compared to the first beta of the coming version 1.6.1. Some of the bugfixes were non-trivial, and hence we have made this new Beta 2 release.

Bugfixes



  • [2009283] Error in bullet damage calculation: The bullets scoring was incorrect compared to version 1.6.0.1. It was too high.

  • The Battle Results showed scores that was doubled (in the 1.6.1 Beta) compared to the real results.

  • Fixed issue with robot paintings, which mirrored the paintings.

  • Fixed issue with painting with the alpha channel (translucent color).

  • The mouse y coordinate of the mouse events was not scaled correctly.

  • When starting up a new battle, the battle would sometimes appear to be paused, even though the user did not pause the game.

  • [2009432] Leaking System.out: outputting to System.out from the constructor of a robot would go to the actual console instead of being properly redirected.



Changes



  • The new TPS slider was readjusted, so the are more slower speeds, and less higher speeds.

  • The menu item for the Ranking Panel is now hidden when replaying a battle, and the panel is now being hidden, if it is visible, while the battle is being replayed. The reason for hiding the Ranking Panel is that the replay feature does not support displaying the current rankings during the replay, i.e. the current scores are not recorded.



Download: here

Saturday, 28 June 2008

Robocode 1.6.1 Beta

We are proud to present new version of Robocode for community testing.

Robot visible changes


  • We introduced new feature -DRANDOMSEED, which must be set to a specific random seed value. When this option is set, the random number generator used in Robocode becomes deterministic. So your robots will appear in exactly the same positions, when you rerun battles. This is very useful when testing and debugging your robot, because you will be able to repeat problematic situations again and again.

  • The new random number generator for the -DRANDOMSEED also overrides method e.g. Math.random(), so it will make robots based on this also deterministic. We are also looking for smart trick to replace instances of Random class used by robots in the future, but we didn't figured it out yet. Note that this random generator is only deterministic when the -DRANDOMSEED has been set. Otherwise we use same Java generator as before, making game pseudo-random.

  • We introduced new experimental feature -DPARALLEL (set to true or false). It allows robots run in parallel intended to take advantage of more CPU's available in the system. (Default is that for each turn robots are resumed sequentially). It may speedup battles with multiple CPU consuming robots. Time measuring is not per robot, so it cannot be used in contest, but might be nice for training. Please let us know if you like it or not.

  • We introduced new feature 1878233: onBattleEnded event. It is useful for learning robots, because event will always be sent at the end of each battle no matter if you won, lost or the battle was aborted. When the onBattleEnded event occur you could save your settings to disk. Also the battle results are dispatched to you.

  • Robot has new method getGraphics(). It allows you to draw your custom drawings to the battle view any time, not only during onPaint() event. Drawing will appear on end of turn.

  • Interactive events like onMouse*(), onKey*() and also onPaint() are now dispatched thru standard robot's event queue, so they will be called on robot's thread. So your robot will pay a bit of CPU time when using these.

  • Messages from robots to console are now dispatched on end of each turn.

  • AdvancedRobot and IAdvancedRobotPeer has got the new method getStatusEvents(), so a robot is now able to handle status events in the middle of an event handler.

  • Feature 1954853 : Name of robot's package was extended from 16 to 32 characters. The Robocode Repository is able to handle this (verified with Dan Lynn).


User interface changes


  • Robocode user interface was improved a bit. Also some dialogs are modal now.

  • The TPS slider has been redesigned to be more exponential, so it covers battle in slow speed (1-30 TPS), higher speed (30 - 120 TPS), and fast speed (120 - 1000 TPS). Move to zero will now pause the game.

  • New battle dialog and results dialog can be closed by pressing the Esc key.

  • The title on the Robocode window is now showing the current turn in a battle, and is updated every half second. In addition, the layout of the information shown in the title has been improved a bit.

  • The system log output has now been split, so that logged errors are sent to System.err and logged messages are sent to System.out. This makes it possible to filter out messages from errors when reading out the logs from Robocode. The system log now also includes a full stack trace when errors are logged, making it easier to determine where an error has occurred.

  • Battle view was redesigned and now it is redrawn at max 50 FPS, which saves CPU cycles, and thus allows the TPS (turns per second) to be even higher/faster.


Bug fixes


  • The field 'others' on the JuniorRobot was not updated properly when other robots dies.

  • Fixed issue with duplicate team name. The 'short name' in RobotPeer was same as 'name' for duplicate robots. Now, duplicate team named are dedupped.

  • The New Battle Dialog was resized after the robot selection.

  • After the intro battle, the Restart button was disabled.

  • InterruptedException are now being handled properly by interrupting the current thread, so it will keep its interrupted state after the InterruptedException has been caught.


Implementation details

What happened inside? Well, we were able to decouple UI and battle engine core. Till this version, the core of Robocode was tightly coupled to various components. For example, the battle thread was directly calling the BattleView to repaint each frame. We had the same issues with sounds, battle results dialog, window title and more.

On the other side, i.e. in UI, there were dependencies on the Battle class, which is the real core. The UI thread from the RobocodeFrame was calling it directly in order to stop or pause the battle. Also, the BattleView was making calls directly to the Battle to paint the battle field. Even worse, it was touching the RobotPeers (handles all logic of the individual robot) heavily causing a synchronization nightmare.

What we did? We cleaned up the mess. ;-) In the first step we introduced set of battle events, which are fired from the battle. These events are fired on the start and end of each battle, round and turn. They carry along a package of information, which is interesting for the specific type of battle event. For example, TurnEndedEvent contains all information about single turn, including current info about robots and score, and BattleCompletedEvent contains the final score, etc. The battle events are fired from the battle to a battle event dispatcher, which then dispatches these events to all registered battle listeners. Notice that the battle does not have to know know or deal with implementations of battle listeners, making the design cleaner. We implemented IBattleListener interface on all coupled UI components. And moved actions from core Battle to battle listener handlers. We also refactored components, so they now use data delivered by battle events, rather than calling the battle back to get this data.

Some of the battle listeners are just storing the event and processing it on the ATW/Swing thread. In case of the BattleView it helps us to speedup the battle, because painting is done asynchronously to the battle turns.

Next we also refactored various UI controls, so that they use the new IBattleManager interface to control the battle or robots, rather that calling these directly.

The implementation of most commands is sent to command queue on the battle and then processed on the battle thread, rather than directly on the ATW/Swing thread. This helps us to keep UI responsive while battle is being stopped and afterwards cleaned up. It also helps to gain synchronization purity.


Robocode 1.6.1

Both of the interfaces IBattleManager and IBattleListener are considered internal. They are not visible to robots (undoubtedly), but shouldn't be used by users of the RobocodeEngine as well. We plan to to make it more accessible as soon as these interfaces are stabilized.


JUnit tests

We have brand new JUnit test infrastructure based on -DRANDOMSEED feature and battle events. The current number of test is actually small, but we will continue to add more and more tests as we get along.
If you are interested to help us with creating unit tests, please drop us an email on robocode-devel group.
We will be able to provide you with test cases, which needs to be implemented. But we welcome your own test cases as well.



Update 3.7.2008: We are looking to hear your opinions about this release, bug reports, ideas for next releases. Please don't be shy and talk to us. Thanks!

For curious: I put together plan for next version 1.6.2. Comments welcome.

Tuesday, 3 June 2008

Robocode 1.6.0.1 fixes problem with debugging in Eclipse

Bugfixes:

- Fixed debug problem with Eclipse. It was not possible anymore to debug robots from Eclipse as TimeoutExceptions occurred when trying to resume from a breakpoint. Now, Robocode must be started by adding the option -Ddebug=true to the VM arguments when debugging Robocode from Eclipse (or any other IDE). The documentation (Wiki) about how to debug robots using Eclipse using the -Ddebug=true option will be updated.
- Fixed missing internal robot proxy layer introduced in Robocode 1.6.0.

Download: here Robocode 1.6.0.

Thursday, 1 May 2008

Robocode 1.6.0 (final) has been released

The final Robocode 1.6.0 has been released.

Download: here

Friday, 18 April 2008

Robocode 1.6.0 Beta 2 has been released

A new Beta 2 version of Robocode 1.6.0 has been released.

The reason for releasing this new Beta is that an additonal robot interface that needs to be tested before the final release of Robocode 1.6.0

The Beta 2 contains the additional robocode.robotinterface.IPaintRobot for robots that needs to receive paint events, meaning that it is now optional if a robot should deal with onPaint() notifications.

In addition, the Beta 2 release also contains the new sample.PaintingRobot for demonstrating the onPaint() method.

Download: here

Sunday, 6 April 2008

Discussion group for Robocode engine developers

Hi,

because lot of great ideas are flying in emails among us Robocode developers, contributors, developers of extensions and veteran Robocoders, I created new discussion group robocode-developers@googlegroups.com to improve spreading of information. Please, if you feel that you belong to some of groups above or belong there potentially, join us.
This group is NOT for support of Robocode users, if you need help with writing your robot, please use Robocode@yahoogroups.com

Whole discussion should have circa following rules:
1) Ideas are welcome.
2) We are looking for contributions not for demands. All of us work in our free time, so if you have an idea, but you do not will to work hard on it, it is just wish. Your idea could be used by some of us or not. We may ask you to fill such idea as a feature request. We welcome feature requests.
3) Discussion should be constructive. We are trying to improve our great toy for everyone. So we should give each other as much freedom to implement our own ideas as possible.
4) For sure, we will have different opinions. In case that we will be unable to find common ground or conclusion, Flemming will decide which direction to go.
5) Flame war or holy wars about operating systems, platforms, languages, etc. are silly, please go private to discuss them.

Thanks,
Pavel Ĺ avara

Sunday, 30 March 2008

Robocode 1.6 explained

To those of you that wants to learn more about what is really new in Robocode 1.6, and what is in the pipeline for Robocode, you should read Pavel Savaras' article "Robocode 1.6 explained".

Pavel Savara has joined in with the development of Robocode with the goal of creating a .Net version of Robocode. Actually, in the future it should be possible to run battles between Java and .Net robots simultaneously!

Please welcome Pavel as new developer to Robocode. He has really done a tremendous job with the new robot interfaces in Robocode 1.6, and also fixing all obstacles in Robocode to allow a .Net implementation on top of Robocode!

Did you try the Robocode 1.6 Beta? If not, don't hesitate with testing all your existing robots on this new version all supply us with feedback about issues while Robocode 1.6 is still in Beta (download).