We Write Code Logo
sarah

I often envisioned hackathons as high-pressure, weekend-long events involving sleep deprivation with a diet of pizza and Mountain Dew, which is perhaps a big part of the reason I’d never attempted one in my development career thus far. That is, until a few weeks ago when the opportunity came up to join a few coworkers in participating in a sort of hackathon known as a “Code Jam” for charity with the Pi515 organization. Similarly to a charity run where participants pledge a certain amount of money for each mile, we committed to a few hours on a Friday night with a donation from We Write Code.

There were basically no set rules about what we needed to build, so the four of us spent some time during the week leading up to research and brainstorm. Eventually it was settled that we would build a game, but the challenge was to control the scope of the project so it would be reasonable to complete within a four hour time constraint. The first decision to make was deciding what technologies to use. There was some consideration of using Unity to take advantage of having some core mechanics already in place, but in the end we decided to go with just plain ol’ vanilla JavaScript to avoid spending time learning a new API and to stick with something we all felt very familiar with. 

When Friday night arrived, we got on a call and essentially pair-programmed (group-programmed??) through a basic shell for our project. We decided on an in-browser simulation game, and created a simple game loop function that updated an object storing our game state which was then rendered onto a 100x100px canvas area. One person took on the task of adding sound effects and someone else created 4 sprites to represent each of our characters moving around the grid. We were able to achieve all of this through event listeners and the canvas element, without pulling in any external libraries or packages. Then each of us wrote a game function for our character, defining a set of rules for that character’s movement that made a request to update our game state on every “tick” of time.

In the end, with four developers in four hours we made twenty-five commits with about 800 lines of code added. Although what we achieved was of course only a silly game in which our sprites floated through outer space, toward various coordinates of the grid, to some sound effects of thunderous applause—I think we all enjoyed seeing what we were able to come up with when we had very little time and resources. No one in our group had much in the way of game development experience to begin with, and while I certainly wouldn’t venture to say that I do now after this event, I think it gave us all a chance to work on a kind of project that was very unique for all of us and approach some mundane JavaScript skills in a new way!