Pixel Wars: Contest Entry
Avalander May 25
What I built
I built a multiplayer browser game inspired by r/Place. The goal of the game is to control most of the board. The board has (currently) 625 cells, and the player can claim any cell by clicking on it.
If you've followed my blog entries, you'll notice that I ended up not adding any limitations to claiming cells. The players can claim cells to their hearts content, without having to wait for other players or being limited in any other way.
Also, there is no wining condition. The plan was that the game would run forever (or until I decide to bring it down). Maybe it doesn't make for the most exciting game of the year, but it was interesting enough to play around with Pusher.
Link to Code
The code is available on GitHub.
How I built it
The backend is built using node.js. I wanted to try to capture the HTTP requests into streams that I would map and reduce to build the game state, and use listeners to dispatch messages through Pusher. I toyed with the concept a couple of hours, but solving it in a clean way turned out to be non-trivial, so I abandoned the idea due to lack of time.
Check additional resources a bit below for more info!
How I used Pusher
The whole point of the game is that each player needs to see updates to the board on real time. Therefore, whenever a player claims a cell, a message is sent to all connected players through Pusher with the updated cell.
I implemented a leaderboard, with the count of how many cells currently belong to each player, that displays the ten players with the highest score. The updates to the leaderboard are achieved through Pusher as well.
There's no real need to update the leaderboard in real time, it could be updated every few seconds, or every few minutes even. Therefore, I wanted to decouple it from updating the board cells. Since I don't expect much traffic, however, I don't need to be cheap with Pusher messages, and I'm sending updates every time a user claims a cell as well.
I wrote a few posts documenting my process and findings. You can check them here.
All in all, I'm just happy that I managed to have something that I could submit. It's been interesting and fun, but life got in the way and I couldn't put in as much time as I would have liked (I guess that's mostly everybody's situation, :P).