How we added tournaments to Prismata in 30 hours: a hackathon post-mortem 21


One week ago we ran our Prismata tourney hackathon, in which we attempted to develop a tournament feature for our online game Prismata in only 30 hours. Overall, it was an excellent experience for us in which we were highly productive. In this article, we’re going to describe how things went, what we accomplished, and what we learned.

But first, here’s the highlight reel:

[youtube=http://youtu.be/hQE39nDg4RM&w=880&h=495]

How it went down

To be clear, this hackathon wasn’t some kind of last-minute crunch in the face of a looming deadline. Tourneys were merely a feature that we knew we eventually wanted, and I felt that ignoring all other distractions for a day and a half would be a good way to get a prototype into the client fast so we could get some user feedback. Yes, we promised everyone that we’d host a tournament 30 hours after we started (and we even invited some poker and Hearthstone pros!), but this was mainly just something I wanted to do to add a bit of an incentive. At least for me, fear of failure is very motivating!

Hackathon-style coding—meaning a blocked off segment of time in which developers work in intense collaboration on one single core product or feature—is something dear to our hearts. In fact, the client and server for the first web-based version of Prismata was developed during a week-long hackathon way back around the Christmas holidays at the end of 2011 and beginning of 2012.

Initially, only our founding members (me, Will Ma, and Alex Wice) were going to participate, but two of our other developers (Alexey Kozhevnikov and TC Fraser) were eager to pitch in (and no, we didn’t force any overtime on them; we sent them home for the night!) We scheduled the hackathon to begin at 1pm on Wednesday and continue until 7pm on Thursday, straddling two work days so that about half of the 30 hours would occur during regular work hours.

There were two major components to the tournament code: the client code, which runs on the user’s machine and is written in Actionscript 3, and the server code, which is written in Python and runs on our servers, being responsible for globally managing the tournaments. Our respective roles in the project were something like this:

  • Alex: He wrote the brains of the tournament; modules to decide who to pair against who, keep track of wins and losses, and decide the results of the tournament. Alex planned to eventually add dozens of tournament types, but for the hackathon, he focused on building robust infrastructure for single elimination and Swiss tournaments.
  • Me (Elyot): I wrote almost all of the remaining server code, plus various bits of client code to interface with it. The functions I wrote allowed users to see which tournaments were going on, report their results, and join and leave tournaments. I also wrote the code that automatically started games.
  • Alexey: He did a couple of things. Alexey spent most of the first day writing client-side code to allow users to be summoned into tournament games while they were playing, observing games, or examining replays. Prior to the hackathon, users could only enter games from the menu screen, and a lot of work was necessary to allow users to transition from one game screen to another. During the second day, Alexey worked mostly on code that updated the client’s view of the tournament, ensuring that users correctly were able to see the current tournament standings and results.
  • Will: Developer of the Prismata game engine itself, Will spent most of the hackathon working on behind-the-scenes code for the client-side view of the tournament, ensuring that each user would properly know everything about all ongoing tournaments, and verifying that this information was updated correctly as tournaments progressed.
  • TC: Our user interface intern, TC built all of the menus screens, buttons, and lists that you currently see in the tournaments section of the game. We decided on a fairly simple interface for now, opting for something that would be working as soon as possible.

 

Doing it live

What made the hackathon even more exciting was that we streamed the whole thing live on our twitch channel. Due to some reddit posts on /r/gamedev and /r/programming that became quite popular, we ended up getting thousands and thousands of viewers. The twitch chat gave us a chance to interact with fans and obtain suggestions on features they’d like to see in Prismata’s tournaments. A few twitch viewers even spotted bugs in our code as we were developing it!

All of the documentation we generated for the project was made publicly available. You can still check it out:

  • Our FAQ, which explains who we are and why we ran the hackathon
  • Our trello board (an online TODO list)
  • Our dev plan, including the client-server protocol
  • The tourney settings spec, which lists all of the options that we planned to support for various different tourney types

There was one pretty annoying issue that was felt by our team. After some testing, it was decided that the internet connection at our office didn’t have nearly enough upload bandwidth to allow us to have a high quality stream (and good stream quality is important if we want our viewers to be able to see the code we’re working on). Unfortunately, this meant that I had to stream from home and communicate via instant message and video chat with the other team members, who all worked together at the office (another option would have been for everyone to work from my place, but the living room would have been REALLY crowded)! Fortunately, my home is only a two-minute walk from the office, so people could pop over if there was anything serious to discuss.

 

The results

It worked! We ran a full 38-person Swiss tournament only minutes after the timer hit zero. Some user interface features were still missing, but overall, the hackathon was a massive success.

There was actually only one major bug: the withdraw from tournament button didn’t work due to a faulty assertion that wasn’t removed before the final version of the software was pushed. The code itself wasn’t even wrong, but the button refused to work unless all assertions passed, so users could only remove themselves from an ongoing tournament by forfeiting a game.

We also got many assertion failures when games were dispatched (not because anything was wrong, but because somebody forgot to remove the assertions). Originally, this was a major "oh shit" moment for me, as I witnessed everyone's chat filling with dozens of error messages. Fortunately, nothing bad actually happened. I get sent an email for each error message seen by each user. There were thousands of them.

We also got many assertion failures when games were dispatched (not because anything was wrong, but because somebody forgot to remove the assertions). Originally, this was a major “oh shit” moment for me, as I witnessed everyone’s chat filling with dozens of error messages. Fortunately, nothing bad actually happened. I get sent an email for each error message seen by each user. There were thousands of them. >_<

List of features that worked by the end of the hackathon:

  • Single elimination and Swiss tourneys
  • Ability to choose time controls and unit pools for the tourney
  • Public and private tourneys, with the ability for the host to invite friends to join
  • Ability for players to view all public tourneys, see the tourney lobby, and register/unregister
  • Support for draws, host kicking, and forfeits/noshows (with automatic kicking of noshows)
  • Automatic timed dispatching of tourney games, with users automatically transferred into tourney matches

Some fun facts:

  • Total man-hours worked by 5 developers over 2 days: about 90
  • Total lines of code added: 4439
  • Total number of git commits: 146
  • Total number of tasks in the DONE pile on our trello board: 53
  • Number of players in our first ever Prismata tournament: 38 (+9 late registrants)
  • Winner of that tournament: Poker superstar Mike ‘Timex’ McDonald

Overall, the hackathon was a fun and highly productive experience. My biggest regret: having our team physically separated because of the need to stream from home. I think our communication efficiency would have been a bit higher if we’d all been in the same room while working on the project, and this would have led to fewer misunderstandings, fewer bugs, and faster bug-fixing. Nevertheless, the stream got thousands of views and generated a lot of interest in Prismata, so it was definitely worthwhile to have one of us (me) work from home so that the hackathon could be streamed. Rumour has it that our building is receiving a wiring upgrade soon that will facilitate fibre internet, so perhaps we’ll be able to stream the next hackathon live from Lunarch Studios HQ. Interested in Prismata? Sign up for the beta at prismata.net


About Elyot Grant

A former gold medalist in national competitions in both mathematics and computer science, Elyot has long refused to enjoy anything except video games. Elyot took more pride in winning the Reddit Starcraft Tournament than he did in earning the Computing Research Association's most prestigious research award in North America. Decried for wasting his talents, Elyot founded Lunarch Studios to pursue his true passion.