terça-feira, 19 de maio de 2009

Introduction to PyDroids

Hi all,

My name is Marcel Pinheiro Caraciolo, and this is my first post here. Before explaining the purpose of this blog, let me introduce myself:

I'm a brazilian guy interested at artificial intelligence and mobile computing. I'm now Computer Science master candidate student at CIN- Federal University of Pernambuco- and work with data mining techniques and mobile distributed intelligent algorithms. I have two other blogs: Mobideia (about mobile computing topics) and A.I. in Motion (about artificial intelligence).

But, this is not the real thing that i wanna talk about here in this blog. As you noticed at the title, this blog is about my attempt to create a python clone of great and addictive Java educational activity game called Robocode.

So, What's Robocode ?

Robocode Logo

I came across a few years ago during my graduation course and was intantly amazed about it. On first glance, Robocode is an acarde game where robot tanks roam a virtual battlefield in search of combat and blasting away at any opponent tank that they encounter. Unlike traditional arcade games, the "player" is not in direct control of his weapons; i.e, you won't control their weapons during the battle, the tanks are autonomous, controlled only by the event-driven algorithms written (in Java) by their creators.

The Robocode game started by Math Nelson (originally provided by IBM). Currently contributions are being made by various people that are working on Robocode to keep it current and fix the bugs. The idea behind of the game is to help people learn to program in Java and enjoy the experience. It's very easy to start a simple robot, which can be written in just a few minutes, but perfecting a bot can take months or more.

Competitors write software that controls a miniature tank that fights other identically-built (but differently programmed) tanks in a playing field. Robots can move, shoot at each other, scan for each other, and hit the walls (or other robots) if they aren't careful. Though the idea of this "game" may seem simple, the actual strategy needed to win is not. Good robots can have thousands of lines in their code dedicated to strategy. Some of the more successful robots use techniques such as statistical analysis or attempts at neural networks in their designs. As you can see, it's posssible to use some intelligent techniques in order to improve the AI of the robot telling it how to behave and react on events ocurring in the battle arena.

How Getting started ?

The Robocode game can run on any operating system supported by the Java Platform, which includes all common operative systems like Windows, Mac OS X, Linux etc. The first step is to download and install the Robocode. Once you have installed Robocode, you should run a few battles to see how it works, then move on to building your First Robot.

The Robocode BattleField Arena in Action

This framework allow developers to quickly code and test out ideas in a very standard manner, which provides an arena for testing artificial intelligence concepts and your Java programming skills. Consider either when the developer feels that his robot achieved a good stage (i.e. able to win lots of battle against other robots), he or she can submit the robot code to compete in on-line competitions!

And that is the beauty of the Robocode platform. The ability to quickly code an idea into a autonomous robot, as at the same time test out your idea and make changes in a easy way. For someone who is just getting started in AI programming, Robocode is a great way to make a lot of progress in a short amount time. The statistics provided at the end of the battle combined with the ability to run the battles quickly allows a developer not only try out an idea, but also gather data and metrics that can be used to evaluate the performance of the robot.

So after this brief introduction about Robocode, it's time to show what i have in my mind with the PyDroids.

What's PyDroids ?

PyDroids is the port of the classic "Robocode" Java Game, ported to the Python Language. The developers and students can create their own 2D virtual androids ("droids") with Python Scripts and make then combat in a full 2D arena. This will be a open-source project hosted at the Google Code Repository .

The question that you maybe be asking is why create a clone for Robocode, specially based on Python platform?

  1. We need a powerful programming language that it's easy to learn, specially for the beginners or not familiar with programming and would like to play with PyDroids.
  • Python is an open-source object-oriented programming language that it's easy to learn and very powerful and offers a higher productivity at comparison with other languages like C, ++, Java, C#, etc.

  • Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

  • It runs at Windows, Mac OS, Linux.
  1. We need a easy and complete platform for our PyDroids framework to extend, debug and port necessary for releases of the PyDroids Simulator Arena.
  • The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms. It has support for third-parties APIs for drawing and game components and can be easily ported to other platforms thar support Python like smartphones, tablets, etc.

  1. A platform that has docummentation creation support, used by millions of people around the world, extremely easy to learn, powerful and easy to read and code.
  • Python has all of those flavours and much more! And of course, in my personal experience, i love python code programming and its style.

So, after all those considerations and because i'd like to see robocode ported to Python platform, i took the initiative to start this project from the scratch.

My plan is to release a candidate test version 0.1 as soon as possible. Besides the Project home-page, this blog will be a news feed about my experiences programming PyDroids and any announcements of new releases for it.

Any help, support or sugestion, please feel free to post comments or send me an e-mail . It can be found at my profile in the right side bar of this blog.

My next post will be about the PyDroids system engine and its architecture (Rules, dynamics, etc.).

See you next time!