Monday, February 2, 2015

[MF] My Battlecode Report

Hi guys. If you were following the last game jam post you might have noticed that I had promised a grand description of a game that I wanted to make, but then I disappeared and never posted again! Well, I'm back, but not with that game. The reason is that I was hard at work on another side project: my submission to the 2015 Battlecode AI project.



You might ask, what is Battlecode? From its website: Battlecode "is MIT's longest running hardcore programming competition, featuring a unique challenge that combines battle strategy, software engineering and artificial intelligence." Teams of between 1 and 4 coders spend the month of January (IAP for MIT, Winter Study for Williams) coding up AI's to control a Starcraft-like army of (virtual) robots to destroy each other. The tournament is open to anyone, so long as half your team is students. The winner for the past 2 years is a Physics Ph.D student from Columbia University. The prize for winning the tournament is $10,000, but there are side prizes and tournaments including a newbie tournament. The total prize pool is apparently $50,000, and there are also a lot of free t-shirts from sponsors. So yeah, worldly gain and all that. But the true prize is eternal glory.

The exact game you are playing changes every year. I've been doing Battlecode for 2 years now. This year the game was notably complex. There were several units and a tech tree. The goal was to destroy the enemy headquarters, which was protected and buffed by several nearby towers. With 6 towers, the HQ was a formidable enemy, with a high range, high damage, AOE attack. Destroying the towers gets rid of those buffs.

The tech tree
An example of what the start of a game looks like
To destroy the towers you have several units at your disposal: miners to mine the ore around your base, drones to explore the map and deliver supplies, soldiers and bashers to be useless and die, a superunit commander to eat enemy soldiers and miners, tanks to be almost useful, and launchers to destroy everything. Robots communicated with a length 65000 int array. You could do really cool distributed computations with that array. Robots needed to be supplied or else they would move and attack slowly. I won't go into the full specs, which are, again, very complicated, but if you want to they are located here.

I worked pretty hard at this competition. My team was called darkpurple because go ephs! Unfortunately, I did not quite have the time to devote myself 100% to it, like many competitors do, since I was working on my thesis as my "day job", but #1: no excuses and #2: I did reasonably well considering the constraints. The game is very competitive and you must spend as much time as possible updating your strategy with feedback from scrimmages with other players. I had a pretty slow start, getting beat out of the sprint tournament in the first round. However, I buckled down and improved and did better in the seeding tournament. Finally, in the qualifying tournament I felt like I had a really good bot. I won my first 3 matches pretty easily. In the 4th round I faced my first formidable opponent, but I ended up beating them too. I only needed 1 more win to secure a place in the final tournament. Unfortunately I would go on to lose 2 matches in a row and get eliminated from the qualifying tournament. It really sucked to be so close, but yet not make it; to be in the top 24 but not the top 16. I still got invited to the finalist celebration in Boston, which was really fun and where they gave me a lot of free stuff, but not being able to compete for ultimate, glorious victory dulled any mild joy I could experience*.

My meta-strategy was as follows: if my opponent cannot mine, they cannot build units to fight me, and also launchers are a super-powerful unit that destroys everything so build a lot of them. I implemented this with an initial, limited rush of soldiers to poach their miners by guessing where they will be based on my miners' locations. I then build a defensive commander because a lot of people were having a lot of success with commander harass and I wanted to stop that. After that, I just build a whole bunch of launchers and try to destroy the enemy towers. A team of 3 drones keeps my army supplied by running supplies from the HQ.

The end of a game. Victory! Darkpurple12 over Darkpurple3


There was a lot of micro strategy involved. Launchers try to kite units that try to attack them, since they have the longest range out of any unit (this made tanks useless against launchers unfortunately). Units generally avoid damage. Miners kept a lookout for new mining locations by looking up a mining queue stored in team memory. Pathing was done bug-style because there were bytecode limits imposed that put any question of bfs astar or anything else out of the picture, although it was possible to do a distributed type of bfs.

I thought this competition was very fun and I got a lot out of it. It sucks that this will probably be the last time I will get to compete in it, unless I go to grad school. It would be really cool to make the final tournament, and it shouldn't be that hard since I've been close for 2 years. I would recommend it to any Williams student wanting an extremely engaging winter study activity.

So that's what I did, instead of making a game for the game jam.  

*that's not true, I did have fun.

Edit: By the way, my source code is located at https://github.com/mjfwilliams/Battlecode2015

(my submitted team was in teams/Darkpurple)

1 comment:

  1. Want To Boost Your ClickBank Banner Traffic And Commissions?

    Bannerizer makes it easy for you to promote ClickBank products using banners, simply go to Bannerizer, and get the banner codes for your selected ClickBank products or use the Universal ClickBank Banner Rotator to promote all of the ClickBank products.

    ReplyDelete