Hello Reddit! We are the dev team for Battlecode, here to answer (almost) all your questions.

What is Battlecode? : Battlecode is a beginner-friendly programming competition run by a team of MIT students over the month of January. Competitors write autonomous AI algorithms (in Java or Scala) to control an army of virtual robots and compete against opposing teams. Our final tournament is held live in Cambridge, MA (on MIT campus) and in past years finalists have been flown in from all over the world to attend.

Nothing beyond knowledge of the basics of Java is required! We livestream and post videos of our lectures and tutorials to help guide new competitors through the process of writing a player.

Anyone can register and make a team (1-4 people) in order to compete. Teams composed of all currently registered students (from any school) are eligible for a prize pool of over $50,000. Registration deadline is January 8th.

Proof: https://www.facebook.com/mitbattlecode/posts/10154878289464993

Website: http://www.battlecode.org/

Comments: 484 • Responses: 63  • Date: 

Beer_Is_Food597 karma

Have you guys ever thought about bringing a frog as a mascot and calling it a Battle Toad?

battlecode-devs429 karma

We haven't before, but we'll be giving it some serious thought now.

Answer from another dev: I definitely remember we had a team called "BattleToads" one year. We've also had similarly-inspired names like "Cattlebode", "Paddlegoats", and "Battlecod"

pyrovoice213 karma

is there a way to train on previous year's challenges or against a dummy ? This seems interesting

battlecode-devs247 karma

Yes! For 2016's files:

  • Download the files here.

  • View the game specs here.

  • Java API / documentation is here.

  • Troubleshooting/help/FAQ forum post is here

It comes with a dummy player "examplefuncsplayer" that basically moves randomly. You can also download source code from last year's participants here.

Edit: added links. We'll also make these accessible on the website at some point.

youPCbruh9 karma

Can I set this up in Netbeans?

battlecode-devs17 karma

The software should work fine in Netbeans. We only provided pre-configured setups for IntelliJ and Eclipse last year, though, but we're happy to help you get things working on Netbeans if you choose that route.

moviuro206 karma

Did you ever have issues with security? (eg. a "team" trying to upload some bad Java code to your machines) How did you deal with this?

battlecode-devs368 karma

We sandbox player code by sandboxing it at runtime - you're not allowed to access any tools but the ones we give you, so you can't, say, write files on the match-running servers.

It doesn't always work, though.

Last year's game was about zombies (not cliche at all, right?) They were supposed to show up periodically at spawn points around the map.

It turned out that there was a particular way to escape the sandbox and modify the "zombie spawn schedule" data structure while the match was running. Somebody sent us a match file that consisted of hundreds of zombies spawning every timestep until the match player crashed.

We got it fixed eventually.

moviuro114 karma

What kind of infrastructure is required on your side to run the fights? Do you take the opportunity to try out recent technologies such as containers and microservices/microkernels?

battlecode-devs137 karma

We run most of our stuff on VMs in Amazon Web Services. It's fairly simple, a few web servers, a server that just compiles code, and a few servers that pull from a match queue and run matches.

We've messed around with tools like Docker and Kubernetes but ultimately VMs serve our needs just fine for now.

Edit: simplistic -> simple

SparserLogic24 karma

Have you considered running on something like Lambda?

battlecode-devs31 karma

Most of our stuff is too heavyweight for lambda, although we might end up using it in our matchmaking system.

iseeapes14 karma

By the way, "simplistic" means too simple and is bad. You probably mean "simple" (which is generally very good in any kind of system).

battlecode-devs13 karma

Updated, thanks!

dantheman25266 karma

Are a lot of teams reusing their code from previous years and just improving on it? If so, is it possible to compete against that? Or is the game changed somewhat?

battlecode-devs109 karma

The game changes every year, and we don't release the details of the new game until competition starts on January 9th. This means that you can't just recycle the same code used last year.

That being said, some elements of the game often stay the same between years, and it can be an advantage to have competed before and be able to re-use some of your strategies. To help newcomers, we have available online the specs from previous years (here's 2016) so they can get a taste for what the game is like. We also encourage competitors to post their code online after the end of the competition or do a post-mortem analysing their strategies: you can see some of those here or by googling "battlecode 2016 post-mortem".

poopy_king49 karma

Are there any Russians on the team, and if so, why are they they best?

battlecode-devs119 karma

We did once, but they all left us to work at financial institutions.

awkward_pause_45 karma

What, in your opinion, were the most artificially intelligent robots to ever participate in the competition? What could they do and is there any plans of any team using something developed in the competitions commercially?

battlecode-devs81 karma

There's no plans to commercialize any code developed for Battlecode that I'm aware of. Competitors need to develop their strategies within the framework of that year's game, which is entirely virtual and therefore difficult to relate to any real-world applications. The closest field of modern research I could think of might be swarm robotics or something similar, involving the control of a large number of similar autonomous units.

It's also pretty hard to pick out a "most intelligent" example from our past winners. Battlecode isn't won based purely on who has the most complex AI. Sometimes very simple strategies can work well just by being unexpected and clever! For example, we've had competitors who ranked highly by producing almost no combat units and using scout units to confuse their opponents' armies or lead them into harm.

lukfugl27 karma

I read through last year's (zombie) specification, and one of the first strata that came to mind was bombarding the enemy player with self-infected (via viper) suicide scouts. Did anyone try that strategy? Was it effective, or was the building cost prohibitive?

battlecode-devs54 karma

Yes! Here's a video of a team using this strategy at the final tournament. Red team hid a single archon in the bottom right corner of the map (to keep it safe) while self-infecting their entire army, creating a swarm of zombies that annihilated the enemy team.

Not many teams adopted this as their primary strategy, though. One possible reason is that it's risky - if you positioned poorly, the zombies you create could end up attacking your own army instead of the enemies.

Edit: here's a quick guide to what the different units are in the video.

DonkeyKongsDong8 karma

I just watched the entire thing and that was one of the most oddly entertaining things I've watched all year. I have no programming knowledge at all, but it was really fun watching the different strategies and the battles!

battlecode-devs4 karma

Glad you liked it! Making Battlecode more viewable and enjoyable for everyone is something we're actively working to improve.

avgmr2 karma

I could see this drawing interest from further reaches if there was a better visual rendering of the action on top of it. Have you guys ever considered getting some game devs and artists to create a 3d game that could work with this?

battlecode-devs3 karma

We used to run a 3D client, as seen in some clips in this Battlecode montage. We haven't invested resources in a 3D client the last few years, but it's definitely something we will look into in upcoming years to improve viewing experience.

hayyeh43 karma

Is there any truth to scenes in movies like The Social Network where they make speed hacking/coding competitions a drinking game?

battlecode-devs122 karma

They say that peak programming efficiency is reached somewhere in the period of the first few drinks.

battlecode-devs286 karma

Battlecode does not condone underage drinking.

Anekdotin41 karma

It seems it only supports java. Any support for python in the future? We are here in Boston looking to compete as well!

battlecode-devs55 karma

We are hoping to incorporate python in the future, but unfortunately it's not available this year. However if you are familiar with python then Java should be easy to pick up, and it's always useful to learn a new language!

hukka864 karma

You can use jython, it's a python scripting based language with Java classes support. The spacing can get annoying and some type conversion is non-trivial, but it's relatively easy to use.

battlecode-devs11 karma

That's a good idea. Maybe we'll see Jython support in next year's competition!

codepunk1 karma

[deleted]

battlecode-devs9 karma

You'll be able to use Kotlin this year, which is kinda python-y. It's nicer than Java, anyway.

chaingang2206 karma

I haven't heard of Kotlin, so I could be missing something about it, but why the choice of adding Kotlin vs Python, since Python presumably is more commonly known?

battlecode-devs19 karma

Kotlin, like Java and Scala, compiles to JVM bytecode. Currently, Battlecode is setup in such a way that we can only introduce support for JVM languages without drastically changing our back-end infrastructure.

DoWhile34 karma

Battling army of robots? How would I know this is virtual and not being used for, say, xenocide? But seriously: has any amateur code from this competition led to greater applicability?

battlecode-devs22 karma

As far as we know, code from this competition is never used for anything outside this competition. Due to the format of our game, the final code isn't really useful outside of the game. We constrain players in the amount of computation power they can use, so winning AIs are programs that are really good at playing our game, but not good at anything else.

The skills used to create these AIs are good for other areas, however. Our sponsors work in areas ranging from investment trading to self-driving cars to intelligent medical diagnostics. They like to recruit from our competitors.

IGotSkills23 karma

Is it college students competing only or is it open registration? Are the battles remote or in premise?

battlecode-devs36 karma

Anyone at all can register to compete. The student requirement is for teams who want to be eligible to win prize money - All team members must be currently registered as students at either the middleschool, highschool or college level to win monetary prizes.

All scrimmages and tournaments can be done remotely save for the Final Tournament, which is held live at MIT. We have money available to help competitors who make it into the finals fly to MA if necessary.

TheHiguty9 karma

Is there any support for international students?

battlecode-devs25 karma

International students are welcome to compete! We've also helped fund plane tickets for past international finalists to get to the Final Tournament.

GfxJG8 karma

Even international students? I study in Aalborg in Denmark, would I be eligible?

battlecode-devs13 karma

Definitely - there are no restrictions on who can compete. We've had participants from quite a few different countries in the past (Norway, Canada, Germany, to name a few). If you qualify for the final tournament, we can even help pay for your travel expenses to MIT.

bcorni5 karma

Is graduate student college level or does it disqualify you for prize money?

battlecode-devs9 karma

Graduate students are eligible for prizes.

wjwwjw3 karma

What about PhD students?

battlecode-devs3 karma

PhD students are eligible.

Morpheus0123 karma

Are you guys influenced at all by Core War?

http://www.corewars.org/

As an MIT alum, Core War helped inspire me to go Course 6.

battlecode-devs15 karma

The current devs didn't know about Core War until you shared it but the concept sounds very cool! We wouldn't be surprised if the original founders drew some inspiration from it.

casioSorcerer18 karma

Can we run full test matches locally to test and debug a player we are developing? Or do we have to wait to scrimmage with another team before we can actually see our developed player in action?

battlecode-devs29 karma

Our client allows you to test your player locally, or even run different versions of your player against each other to see which is superior!

probablyunsound13 karma

Thanks for the AMA! I'll be participating :) Just a quick question:

  • Once you submit your code, that'll be the only code run until the end of the Tournament? Or do you get to make adjustments?

battlecode-devs14 karma

Not at all! You can continue submitting code up until the final deadline near the end of January, at which point this last version of your code is what is submitted to the Final Tournament. Throughout January competitors get to test and refine their code by scrimmaging with other teams in casual matches, and also by participating in the practice tournaments leading up to the final one. This gives you a chance to see what strategies other teams are using and to continually improve the performance of your own code.

wobble_cock12 karma

How do we know you are human and not a highly developed AI like Siri from AppleTM or Ava from Ex Machina?

battlecode-devs60 karma

Never fear fellow human comrade, for I am definitely a fleshy organic like yourself and not a Skynet sleeper agent. Ha. Ha. Ha.

poptartdinosaur12 karma

Has anyone ever registered alone and performed well? This is a great event!

battlecode-devs26 karma

Our 2014 and 2015 competition were both won by a solo competitor and plenty of others have ranked highly in the final tournament, so it definitely is possible. It's also possible to search for teammates using our forums if you don't want to compete alone.

aly532110 karma

Is this possible to do for someone whose only knowledge of programming comes from AP Computer Science? And is there an age limit?

battlecode-devs16 karma

AP Computer Science actually prepares you quite well for Battlecode, as the only real requirement for the competition is knowing your way around Java.

We don't place any restrictions on who can enter the competition, but only students, whether they are at the high school, college, or even middle school level, are eligible for prizes. Don't be dissuaded from participating if you don't think you have enough experience; last year a high school team took second place!

1010010101019 karma

What's the game environment like? Is it graphical or all console based? Also are neural networks welcome? I've been meaning to try back propagation with a hive-mind.

battlecode-devs14 karma

The game is visualized in a 2D space, and we have a graphical client that shows all the units as sprites that move around and shoot at each other. For an example of a match, here's the final round of the 2015 competition: https://youtu.be/RCdPQyG3c-U?t=11179

Nothing directly prohibits neural networks, but all units are only allowed a restricted amount of processing per round (measured by bytecode usage), so getting a proper neural network running would be difficult.

Professor_LurkKing9 karma

Any recommendations for a beginner to Java? I've been programming a fair bit but can't find any up to date resources online to improve my skills!

battlecode-devs17 karma

There are many resources online that can help with learning Java, and luckily Java has not changed much over the past years, so old resources may still be useful. A couple of great resources are these videos from The New Boston and the lessons from Codecademy. Additionally, we release a few tutorials and lectures of our own throughout the competition which show you how to perform certain actions and techniques for the competition.

Appare8 karma

Would a team of 4 people who are familiar with Java, but know next to nothing about developing AI be suited for Battlecode? I am really interested in this but neither I nor my friends know much about this kind of thing :)

battlecode-devs11 karma

Yes! Just knowing Java is enough. Many teams (including past finalists) fit your description - you can know nothing about AI and still have fun and do well. We also have a lecture series to help.

AngryPandaOnReddit8 karma

How difficult is the coding process for the competition and how long does it take?

battlecode-devs9 karma

To write a minimally functioning bot is not difficult. The files we give you to run the game include a simple bot. Many teams start development simply by improving this player.

That said, this is a large competition, and winning it is by no means easy. The contest lasts about three weeks, and so many teams will pour countless hours into tweaking their bots for maximal advantage.

If that sounds like more of a time commitment than you can afford, you might be interested to hear that there is a "sprint tournament" essentially identical in form to the main tournament, with the only difference being that the submission deadline is only about a week after the contest begins.

kradt7 karma

I don't know much about coding but could you code AI in Java? And if you did would it give that team an advantage or disadvantage? If it is a disadvantage now do you see that changing in the future?

battlecode-devs14 karma

You could write the sort of AI algorithms that Battlecode deals with in any programming language, although currently we have competitors work in Java because that is what our game engine is in. It's often algorithms that involve navigating around a virtual map with limited vision, or dynamically adapting strategies based on enemy movements or environmental cues.

We are thinking about expanding the competition to allow submissions in other common languages sometime in the future! However language choice wouldn't give competitors an advantage or disadvantage because we traditionally measure code efficiency in terms of Java bytecodes.

DanniDaniel7 karma

I'm confused. It seems like a non student can enter this, but cannot win prize money.

I was wondering can a non student get first place in the tournament? I'm guessing they just don't win money.

Also, was wondering is Greg McGlynn going to enter this year? He seems to just win every year.

battlecode-devs9 karma

You're correct about eligibility for competition and prize money. Anyone can compete, and only student teams can receive money. We also can't speak for Mr. McGlynn - you'll have to ask him yourself!

working2hardforthis6 karma

Have you had any teams consisting of active duty military members?

battlecode-devs9 karma

Not that we know of (at least for recent years). That said, we don't get to meet most of the remote competitors, so there could have been a team of active duty military members that we didn't know about.

iGotYourPistola5 karma

Programmer here, so you know what's coming.

Why Java? (I'm assumming Scala was easy to incorporate after Java). Also, any languages in the pipeline after python? (+1 for python though).

battlecode-devs9 karma

Java is a reasonably well known language (thanks in part to the AP Computer Science curriculum), and it's sufficiently fast to be used for all elements of our stack (normal python probably wouldn't be). Also, to copy and past an earlier answer:

Another reason we use Java concerns how we measure the limit of computation time that contestants bots' can use per round. If we didn't place a limit, things would get out of hand very quickly!

Ideally, we can do this in a way that is both deterministic and consistent across multiple problems. Measuring real time isn't deterministic. Measuring assembly instructions isn't cross-platform. Java bytecodes, however, satisfy both criteria, and so for now the contest is based on the JVM.

Finally, we also do some instrumentation of player code, which accomplishes a few things, like checking for use of disallowed methods (e.g. file I/O) and replacing some standard library methods with our own deterministic versions. This is currently implemented for JVM languages, and I don't think we're super excited about doing this all over again any time soon.

iGotYourPistola2 karma

I didn't realize so much was going on in the background; thanks!

battlecode-devs4 karma

If you're interested in learning more about how the engine is setup, you can take a look at the repo for last year's game server here!

WyoChuck4 karma

What percentage of the competitors are students and do you know the breakdown of education level of these students?

battlecode-devs7 karma

We don't have exact statistics, but here's our guess at estimates for last year's competition:

  • 95% are full-time students.
  • Among the students: ~75-80% college undergraduates, ~15% graduate students, ~5-10% high school students.

arup023 karma

Just the basics of Java to compete at MIT? Sounds slightly misleading.

battlecode-devs19 karma

The basics of Java is the only knowledge we presume competitors have. We upload lectures helping teach competitors how to build their first player and understand how game mechanics work. In general we have a wide range of competitors at different skill levels and we work hard to make the game accessible to those who aren't already extremely advanced programmers.

JVemon3 karma

I'm a biomedics student from a different country. So this means I can participate 100% online without ever having to fly there, right? The prizes only apply to MIT students?

battlecode-devs5 karma

The prizes are available to all students anywhere, not just MIT students. And yes, you can compete from your home up until the end of the competition and the Final Tournament - if you qualify for the finals, you'll probably want to fly in to MIT to attend.

CEBS133 karma

I am knew to battlecode, I read your FAQs but dont know where to begin. I already have coding skills. Do i have to wait for the lectures to start building my bots? How do i build my bot?

battlecode-devs3 karma

First thing to do is to register on our website, that way you'll be set to compete. You can also try to find some friends to be on a team with you and register them as well.

The competition won't begin until January 9th, which is when we'll release the specs for the 2017 game and start producing the lectures. In the meantime you can look through some of the specs for past games (linked elsewhere in this AMA), watch old lectures or just brush up on your own programming skills in preparation.

blurrr22 karma

Where are the rules or technical specifications for last years competition?

battlecode-devs8 karma

You can see the specs for the 2016 game here.

___MOON___2 karma

How much of the student body gets involved with this? MIT is a school for very intelligent people who really like computers, in short, so does the whole school get involved?

battlecode-devs5 karma

We currently have ~200 MIT competitors registered, and MIT has ~4500 undergrads, so, 4% of the student body? Or 2% of the student body including graduate students.

(Honestly, that's pretty good - it's hard to get the attention of MIT students, especially during the January break period).

BBBence11112 karma

What are the restrictions on this? Say, if a group of highschool students from Europe decided to join, could they?

What was in your opinion the best game in the battlecode series?

battlecode-devs2 karma

Anyone can enter, no restrictions whatsoever. Only all-student teams can earn prizes, though. In your case, you are definitely eligible.

Best game of Battlecode... very tough question! There have been a lot of high quality games over the years. Here are a couple that we really liked:

  • 2016 game with unexpected ending (link)

  • 2016 game featuring "foundation," a team that wins games despite never attacking the enemy (link)

  • 2015 close final series between the top two teams (link)

(Depending on how closely you/others want to watch these, here are some possible useful resources. a: Quick guide for 2016 game, b: 2015 game specs, c: Sprite reference for 2015 game.)

Chuckee791 karma

[deleted]

battlecode-devs2 karma

As long as you are relatively comfortable with the basics of Java, you will be able to compete! The lectures (available online) assume a working knowledge of Java, and walk you through the steps needed to write some basic players.

PackerCrackerBacker1 karma

Do you think competitions like this one are advancing our knowledge of AI usefulness, since they are situation specific and as you said "difficult to relate to any real-world applications"? On a side note, how close are we to sentient AI, and what regulations are in place when we eventually reach that point?

battlecode-devs3 karma

Battlecode as a competition is more concerned with the practical aspects of AI, as opposed to the theoretical aspects. Obviously, unless a war breaks out in which robotic zombies begin spawning from dens in predictable intervals (to use last year's game as an example), the code contestants write for Battlecode will never have direct real-world applications. However, we believe that the competition serves as an excellent tool for learning and applying practical AI techniques on the fly, and our sponsor pool reflects this. IBM Watson, several algorithmic trading firms, and self-driving car companies are among our sponsors.

nicktohzyu1 karma

How do you make this beginner-friendly?

battlecode-devs4 karma

Beginner-friendly is a relative term, but in our case it means you don't need extensive programming experience. If you've worked with Java before that's probably enough (and is the only knowledge we assume competitors have). You don't have to have experience with AI, for example.

We provide many helper functions the player can use. These do things such as:

  • Return all enemy robots within a certain area

  • Move toward a certain location

  • Spawn a unit in a certain location

  • Ect

More complex aspects like obstacle avoidance and strategy are (of course) left to the player, but it's possible to beat a nothing-bot with a few lines of code.

We also make the interface such that the competitors don't worry about anything but their bot. You can write your entire player in a single .java file if you want, and the server software runs it in a match for you.

sterichards__1 karma

I don't fully understand the scenario of the task. How does the code that the participants write interface with your code? Is it some kind of screen game that participants have to read the contents of the screen? My brains boggled. Is your system separate to the system that participants write? If not, what stops participants reading your code and easily creating a defeat against it? If so, how do they talk to each other and how is a win decided?

battlecode-devs4 karma

Contestants upload the code for their bots to our compile server, where it is compiled and checked for use of banned methods and classes (like java.io.File). This then gets passed to the tournament server, which uses some Java magic to interface the compiled players with the rest of the code for the game, letting the players be ran against each other even though they were indeed coded separately. The tournament server then outputs a match file, which contestants can watch using our client to see how the game went.

battlecode-devs1 karma

The game itself consists of an entirely virtual game map or board, on which little units can move about like figures in a video game. (Think fancy virtual chess.) Participants don't actively give any input during a match - their code is meant to run entirely autonomously. While it varies from year to year, usually their code tells the virtual units on the game board where to move or what to do based on the input they receive. Participants are limited to using the methods that we supply them with, which tends to keep unintended manipulation of the game state to a minimum, although there are sometimes people who figure out a workaround.

How a win is decided depends on the rules for that year's challenge! Sometimes it involves destroying all the enemy units, sometimes it involves collecting the most of a certain resource, sometimes even different goals.

Campity1 karma

I've never coded in my life, but I signed up. Any tips?

battlecode-devs3 karma

Your enthusiasm is definitely commendable. I'd second the suggestion to start by taking Codeacademy's Java introduction course!

Bopas21 karma

When do the updated lectures begin?

battlecode-devs6 karma

We post new lectures as they come out, which is usually on weekdays for the first two weeks after the start of the competition. This year's competition begins on January 9th.

battlecode-devs2 karma

This year's Battlecode starts on January 9th, which is the same date as our first lecture. That's when we will release the new game specs and start uploading our lecture videos.

Bopas21 karma

Will watch previous lectures be useful and relevant to this years competition?

battlecode-devs2 karma

The Battlecode game changes a lot each year, so most old lectures will not be directly relevant.

The old lectures might help give you a feel for Battlecode and what kind of code goes into writing a player program. There are also a couple of things that could be relevant across different Battlecode editions (depending on how the game changes), like how to move your bot, attacking, and pathing. In general though, if you go into Battlecode with no prep other than knowing how to code, you'll do just fine.

Edit: added 2 more sentences at the end.

Coffee_Is_Evil1 karma

How did you come up with the idea for this tournament?

Great job, btw! I'll try and convince my friends to make a team with me.

battlecode-devs6 karma

Battlecode was founded over 17 years ago so the original founders have long since moved on. (They include some successful names like David Greenspan and Aaron Iba.) It started as a class that was just for MIT students called Robocraft and eventually changed to the far superior name Battlecode, evolving over time to become the competition it is today.

Edit: The very first edition of Battlecode was actually a board game: http://web.mit.edu/ieee/6.370/2001/web/

hot_skillet1 karma

Were you guys using Craigslist recently to hire someone to post flyers?

battlecode-devs1 karma

Nope, that wasn't us.