Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Java Programming

Robocode Rumble: Tips From the Champs 129

Jason writes "The Robocode Rumble is over and the winners have been declared. Who are they and what are the secrets of their success? Dana Barrow talks shop with some of the mad scientists behind the winning Javabots and with Mat Nelson, who reveals what he has planned for Robocode 2.0. You can get the free download here."
This discussion has been archived. No new comments can be posted.

Robocode Rumble: Tips From the Champs

Comments Filter:
  • Robocode's Rival (Score:4, Informative)

    by FortKnox ( 169099 ) on Thursday September 12, 2002 @03:34PM (#4246741) Homepage Journal
    Robocode is great. Its a neat exercise to get people intersted in OOP and Java.

    Being a Java programmer, I've also looked at C# and seen what MS did to improve the language (lets face it, C# took the good things of Java, and fixed the bad things in Java).

    The C# version of robocode?
    Terrarium [gotdotnet.com], and damn is it fun (I just wish you could change the stats of your offspring to 'adapt' instead of/in addition to just passing off AI)!
    • Re:Robocode's Rival (Score:3, Interesting)

      by dmorin ( 25609 )
      Say what we want about java's failure to do true "write once, run anywhere", but MS has its own version of that. I tried to run Terrarium on my NT box and couldn't do it because I can't get the most recent DirectX. So there. That never happens with Java. Don't ask why my office machine is NT. I don't want to talk about it.
      • Now, I never said that I prefer .net.
        I'm a J2EE consultant by trade.
        I just find terrarium more fun than robocode.

        If I had the time, I'd write a nice project to rival it in Java.
    • I saw your post in another forum touting Net Terrarium, so I downloaded it. It turns out that Net Terrarium, an official Microsoft example product for .Net does not run, ironically, on my MSN DSL system. The problem, apparently is because I don't have a static IP. That is a pretty common, major problem -- that pretty much wipes everybody out from using it.

      The Java alternative, JXTA (at jxta.org) handles this with the notion of http peers. Java has a surprising number of thriving open source projects (JBoss, Ant, JXTA, Tomcat, Jetty, etc.).

      And then you have just plain fun events like this Robocode.
  • Does anyone know about any other competitions, or similar AI programming games? I did a couple classes in college where you designed real-time and turned based AIs for games, and it was a lot of fun. RTSes interest me the most... I don't suppose there's an open starcraft clone or something with a good AI interface?
    • Open Starcraft clone? Well, the closest that I can think of is Free Craft [freecraft.org]. Right now it is being based on Warcraft, and I don't know about the AI currently, but I'm sure they would be glad to have some more help.
    • Does anyone know about any other competitions, or similar AI programming games?

      Terrarium [gotdotnet.com] is an AI programming game where developers write herbivorous and carnivorous bugs (and plants) in any .NET language, then let them try to survive in a P2P "terrarium" of other bugs and plants. Microsoft holds periodic contests (US contests and International contests) for Terrarium bugs, and there seems to be a fairly active community around the whole thing. And the best part is that you're learning .NET, while at the same time having fun.

    • Boson [eu.org] has very pretty looking screenshots but has no AI yet, so you could try to write some for them. If you do, try to make it modular so people can easily write their own AI and get them to compete.

      Freecraft are advertising for some much needed artists to help them, but look good otherwise.

      --
      If you laid all the MicroSoft users in the world end to end around the equator, 2/3 of them would drown.
  • by Tablizer ( 95088 ) on Thursday September 12, 2002 @03:43PM (#4246809) Journal
    The Robocode Rumble is over and the winners have been declared. Who are they and what are the secrets of their success?

    When the slashdotting slows, I expect something like:

    Champ: "Well, I write a lot of viruses. The skillsets are very similar actually. You set it loose and it needs self-contained smarts to destroy anything and everything without getting caught or stopped."

  • Robot Battle (Score:2, Informative)

    by Anonymous Coward
    I'm sorry, but some things seem to be VERY similar to Robot Battle, a pretty old game with the same concept: www.robotbattle.com

    Not trying to troll.. just wanted to point out.
    • I used to code robots for RoboWar (for the Mac) in the early 90's. It was great fun. It's so old you need the wayback machine to see a page:
      RoboWar [archive.org]
      • blah blah blah, blah blah blah blah.

        CORE WARS [mcraeclan.com], devised in the 60's, played in the mid 80's, this was what you did!

        Now the sadness: I had both corewars and robo war for my mac plus. Guess which one I wrote bots for? That's right! NEITHER.

        Is there anything worse than a lazy geek?!
        • Well, no need to write corewars robots. While graphically less exiting than robocode, core wars redcode pseudo-assembler is a lot easier to improve via genetic algorithms [fhs-hagenberg.ac.at] than robocode.

          So instead of seti@home, just run that as a screensaver and you should have a decent core wars bot in a couple of months. Many good bots to pit him against for evolution too.
          :-)

          The ongoing King Of The Hill [koth.org] tournament showed signs of a fractal pattern though, imho. Certain strategies would be good and certain would be bad against others. So after a while there was kind of a repeating circle of strategies, like a paper, scissors, stone game.
          Now it would be interesting to know how robocode differs in that aspect?

  • I tried this... (Score:2, Interesting)

    by Bobulusman ( 467474 )
    I don't have a lot of java experience, but I tried this to try to get that experience. Unfortunately, no matter what cool stuff I put in my bot, the tutorial bots beat it on a regular basis. :(

    I think one of the problems was that the way I wrote it, it could fire more shots than average. Unfortunately, you lose a bit of energy with every shot, so all my missed shots led to my bot typically just shooting until a single shot by an opponent killed it. D'oh
    • I didn't know much about Java and all, and I found the API descriptions in this contest rather lousy. But I tried to write a really simple bot (Ashley [ibm.com]) within a few hours and submitted it two months ago. Didn't touch it after. (so everyone below my rank had about 2 months of time to optimize against my bot's play.)

      Well, this really dumb code scored rank 84 in Intermediate [ibm.com]. How many people took part in this contest again?

      As I understand it, the best 100 in every class took part in the final fights, so I think many people had a quite good chance to get a nice rank if even my "junk bot" managed 84. :-)

  • /.ed IBM (Score:1, Offtopic)

    by smartin ( 942 )
    So much for big iron, snicker.
  • by theoramus ( 592848 ) on Thursday September 12, 2002 @04:02PM (#4246935)
    There's a similar AI robotic combat program Tech tv did a story [techtv.com] on called MelBotWars [melbotwars.com].
    It's basically a plugin for maya which uses the MEL(Maya Embedded Language) programming language for coding your bot's AI, and uses the rigidBody dynamics in Maya for the physics.
    Also, take note that you only need the Maya personal learning edition to use it, which is free.
  • by ceswiedler ( 165311 ) <chris@swiedler.org> on Thursday September 12, 2002 @04:23PM (#4247069)
    Why not do it genetically? I'm not an expert on the subject, but the way I've always thought is that it's clearly possible to "breed" programs to do a particular task, as long as the task is very "ratable", i.e., you have a separate algorithm which will evaluate how well the program did. In this case, the "arena" program which pits the bots against each other serves very well. Generate random Java bytecode, run it as a bot, look at the points scored. Breed well-performing bots with each other by combining bytecode together in various fashions. Repeat several billion times...

    Obviously, the first N iterations wouldn't be syntactically correct bytecode (though I would suggest that you hard-code the 0xCAFEBABE prefix) and would probably throw exceptions almost immediately (resulting in disqualification). Eventually, however, you'd get a program which would at least not produce errors, even if it did nothing productive like moving and shooting.

    What's the best way to combine two bytecode programs to produce offspring which are similar-yet-different, and have the best chance of doing well? You would obviously want a chance of mutation (possibly reducing over time).
    • I don't think Java would be a good platform for evolutional programming in bytecode. The test cycles are just too long with Java.

      Think you breed 16 or 50 childs every iteration and have to test them for success/failure, each of them. IMHO this is just too slow with Java. I doubt you'd have got a bot doing more than stand around without throwing exceptions within the contest time...

      • I don't think the issue is with 'Java' as much as it is with 'Robocode'. Robocode does its battles graphically. To really get a good genetic AI going, you want it all done in memory so you can whip through a ton ov evolutionary steps ASAP.

        A good friend of mine did a genetic algorithm problem as a senior design project in school. It was REALLY cool (but was not done graphically).

        Perhaps if you modified Robocode itself to have a 'memory' mode, then after a buncha evolutionary steps, bring the latest one in for a graphical battle?
        • A good friend of mine did a genetic algorithm problem as a senior design project in school. It was REALLY cool (but was not done graphically).

          Are you allowed to give more details? Stuff like that is always fascinating.

          • Geez, it was years ago, but he's an open-source type of guy (actually he introduced me to /. and has a lower UID than me). I'll email him and see if he'll release the whole project out so you can read it.

            I know it was a game where two bots fought one another... it was a linux game (something to do with hacking memory? I never played it, so I can't remember the name). Anyway, IIRC, he pitted two different bots together and fought them. Each bot had 5 chances to win before becoming removed... once removed, it was genetically altered 1 line, then reintroduced.

            He graphed all their behavior (in gnu-plot) and there was VERY noticable steps when one made a genetic breakthrough. He let it run on his machine for months, and I think the end result even beat him using the most obscure technique you could think of (which, IMHO, is the coolest part of genetic AI. It comes up with ways to win that normal people wouldn't even think of).

            Anyway, my name is Josh Marotti, so email me at <firstname>@<lastname>.com, and I'll get back to you on it.
          • there are plenty of places to find info on this on the internet. one such place is The Hitch-Hiker's Guide to Evolutionary Computation [uu.net]

            if you want to learn about some of the many variations of GA, try doing a search on ieeexplore.ieee.org (assuming you are a member) or try www.researchindex.org (free) note that these are both research sites, and so learning something like this from research papers can have a steep curve. i'm sure many academic books cover the subject, too. another topic that would be interesting to use is neural networks (some might say that is obvious, and i would agree) the realm is similar to GA, but VERY different in the guts of the solution.

            --paul

        • This is possible. Robocode does *not* need to run with graphics and in fact has a whole API to control battles. I've done some of it with BeanShell. And there is RoboLeague software which does the same thing. Combined with the ability to write to the filesystem, and you can store result values. I believe the JollyNinja bot determined sundry parameters this way, though most of the algorithms were designed and implemented by the biological agent known as Simon Parker.

          Regards,
          Slak
        • I remember watching some amazing MPEG video of work that Thinking Machines Corp did in the early nineties (before they under). The video depicted artificially evolved creatures swimming/flying/walking/flopping/etc in a somewhat granular 3D space. It was jawdropping, even now.

          Anyone still doing work along these lines?

          --

      • I assume the orginal poster meant to evolve programs before the contest. This is difficult though; what measure are you going to use to select the best robots? The sample ones? Your other generated robots? I don't think a genetic approach like this would work very well. I imagine there must be quite a bit of psychology in programming these robots - a robot that is devastating against one robot is likely to be very susceptible against the tactics of another. How do you avoid the rock-paper-scissors vulnerability?

        And evolving the bytecode would be hard. Much easier to use a higher level evolving system. You could constrain the programs you generate to a certain grammar at least to eliminate your problem of evolving syntactically-incorrect programs.

        There have been successful GP systems evolving programs at the machine code level, but none that I'm aware of based on Java bytecode.

        An idea that occurs to me: maybe you could use a simple GA system with a small number of parameters (gun fire rate, shot power, attraction to certain corners etc.) and try and measure your opponents' values for these (maybe hard, I forget how much information you have access to in the game) and try and combine the parameters of the best robots in your tournament. This might take a lot of rounds though before you found the best combination. Or if you were allowed to enter several robots and have them swap genetic material at the end of a round.

        I've played with the system, and it's a lot of fun. Especially if you can get a few friends to enter robots.
        • You could do it by starting with 100 bots. Sort by win/loss ratio. Take the top 50 bots and breed them with each other one in some fashion. That gives you 2500 bots.

          Now we need to filter those down. That's where a pool of control bots come in. Require new offspring to beat them, possibly within a time limit

          Level 1 - Opponent just sits there.
          Level 2 - Opponent sits there and fires in different directions.
          Level 3 - Opponent moves in a pattern while firing.
          Level 4 - Opponent moves in a pattern and always fires in the direction of bot.
          Level 5 - Opponent chases bot and fires regularly.

          Anyone who can't beat these bots in one try is eliminated. That should get you down to a manageable pool. If you have more than 50, use the time taken to beat the control bots as a tiebreaker. If you have less than 50... well, nature isn't looking at your species too kindly.

          Your new pool consists of the 50 "parents" + the 50 "children". In order to continue, the children have to best each other *and* their parents. Repeat as many times as possible.

          Get a checksum from each bot and maybe someway to track parentage and see who's dominating. This should hopefully avoid compeltely stupid robots and robots that are really good at killing their stupid offspring but nothing else.
          • Get a checksum from each bot and maybe someway to track parentage and see who's dominating. This should hopefully avoid compeltely stupid robots and robots that are really good at killing their stupid offspring but nothing else.

            I'm unconvinced! Unless you're going to code the bots yourself using a bit of pyschology, your only measure of success is going to be how could your robots are at beating the examples you give them.
      • Actually, if anything, Java would be a good match for this type of application. First off, Java has the ability to improve performance over time becoming much faster than C++ in some cases. Second, the platform independent nature of Java would lend itself to distributed computing. You could setup nodes running generations on several machines at once.

        That said, I agree, pure random bytecode is not the way to go.

    • several billion times?

      using this method would take several quadrillion times if not more.

      maybe if you took the top 200 bots, and just swapped their code in and out.... who knows.

      but pure random bytecodes is not feasible.
    • Instead of random bytecode, what if you used a system artificial neural networks (feedfoward multilevel percepetrons) combined with intelligent input calculations (such as "goodness" functions)? You could use one ann per functional area (movement, firing, prediction, etc) each fed by the result from their respective input functions in addition to basic input information (last known location of enemy bots, position, etc).

      Hmm, perhaps I found a topic for my genetic programming class...
    • by Hast ( 24833 ) on Thursday September 12, 2002 @06:38PM (#4247906)
      You wouldn't get results in this millenium if you did that. First of you want to make sure that you only generate valid code, and from what I've heard bytecode is a bit of a bitch to do by hand so generating java files which you compile is probably a better idea. (Or just use parameters which you tweak, that is the usual way of doing genetic programming.)

      You need to feed the generator with a lot of domain info too, otherwise it will just produce garbage. (Even if it is compilable garbage.)

      If you are interested in this stuff check genetic-programming.org [genetic-programming.org].

      I know that some guy used genetic programming to generate bots for Quake1. They were really stupid though. (He had a sort of blog where he told what had happened lately.) He got bots which would kill you right away if you circle strafed to the left. If you circle strafed to the right they would be completely lost. It's fun but not very usable.
      • When I was at university, I learned about an A.I. system which generated "concepts". It started with a base set of rules (say, for mathemetics, addition, subtraction, and so on), and generated new rules, or "concepts". Those were then rated by human experts and used to generate further concepts and determine a relevance ranking.

        This was many moons ago, so I don't remember many details. But one of the most interesting points I do remember was that the generated concepts had a very high usefulness index to start with, but became progressively less and less useful. This was intriguing; you'd imagine that using a base of complex and affirmed concepts would lead to more complex and subsequently useful concepts as the system learned what garnered a high approval ranking from the human experts.

        Mind you, it wasn't perfect. Amongst the cuter generated concepts was a parasitic concept. It didn't generate new concepts itself; it waited until a new concept had been generated and then attached its name to that new concept and claimed it had been the generator.

        Another concept decided that any concepts generated by the system were automatically useless and must therefore be immediately deleted. Funnily enough, the very first concept it deleted was itself. So much for "artificial intelligence".

  • I'm no expert on the subject but last I know there were some GL bindings for Java. It would be cool to have the robots battle in 3D space (with some real physics thrown in). Maybe in Robocode version 20.
  • Another Robots Battle prog (http://realtimebattle.sourceforge.net/)
    The biggest advantage of this one is that you can program your robot in any langages by interacting with stdin/stdout. Another good thing is realtime. And like it's written in C, it's quite portable
    Some robots of Robocode have parameters optimized by genetic evolution.
    I hope to see better robots with new technologies like Animat with sensor/actuator, Evolutionnary Neural Network, Multi-Agent (for team battle)
    • Re: RealTimeBattle (Score:3, Interesting)

      by Antity ( 214405 )

      RealTimeBattle [sourceforge.net] is cool. BTW, you can write your Bots in any language since communication is done using stdio.

      I wrote a bot for RealTimeBattle once ("Defensive Attack" [mindspring.com] - funny that this beast is still available) and found it to be real fun. I was a bit distracted that for the IBM project you could only use Java. With new experiments like this, I like to be able to use the language I'm best in.

      • Just fyi.

        The orignal Robbocode was intented to help people learn Java by tinkering your own robot (in Java Class) to fight the others robots running by the computers. The sole purpose is to help people learn Java.

        May be inspired by the other online combat projects I don't know, but people soon find it to be more fun to fight online, thus Robocode Rumble was born.

        The purpose of Robocode and Robcode Rumble is to encourage people to learn and use Java. You might wonder why it's by IBM not SUN. In case you don't realize, the biggest employer of Java on earth is not SUN, but IBM. :)
  • Since we're on the topic of AI/genetic/emergent algorithms. Could anyone suggest any good practical introductory books on these topics? (With some code to look at rather than abstract predictions on how "x" will save human civilization)

    This is a topic I've been interested in for a while, but I've yet to see any good information to start me off...

    • I found these free (donation suggested) web books [markwatson.com] to be a good primer on the subject.
    • I've used "Artificial Intelligence:A modern approach" by Russel/Norwig in a class on applied AI. It's pretty good and talks about a lot of different topics. The edition I have had a lot on logic and stuff like that too, so it may be a bit theoretical if you just want to get your hands dirty.

      For that I'd recommend searching the web. Lot's of AI stuff out there.
  • Hi

    If anyone's interested, here is a description [ntu.edu.sg] of Fermat's movement algorithm described more clearly along with other silly questions. This is the original set of answers I submitted to them.

    And if you're even more interested, visit Robocode Repository [robocoderepository.com] for all the test bots and related information you will ever need.

    Arun Kishore
    [about to sleep...]

Neutrinos have bad breadth.

Working...