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.
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.