I am excited to announce that Icarus, a Node.js multiplayer avoidance game that I wrote during the summer of 2012 at Hacker School is deployed and ready to be played on Nodejitsu. This game is built in Node.js with the use of websocket for event emits. You may peruse the code on github. Enjoy.
Thursday: In the ideation stage, the concept of the multiplayer game came to me as something that would be fun to implement. After speaking to more advanced developers and getting rounds of thumbs up, I decided to make the game. Designing a game is exciting.
Friday: Enjoyed coding the universe with vectors. The universe component came together nicely, with gravity modelled after Newtonian mechanics.
Wednesday: Simmering and reading other people’s codes. Then, I took a break to read books and to play with Haskell. Haskell seems like a great language for those coming from pure math. In an act of brazen braggadocio, I showed my Instafun app to a designer friend visiting from abroad who suggested to put the app up and offered to re-skin it. How cool is that?!
Thursday: Some small incremental changes and a crude form of collision detection is working. CPU usage is still beyond the acceptable range. If Mozilla’s BrowserQuest can stay under 70% of a CPU, so should Icarus. That is a generous benchmark to use going forward.
Friday: A preliminary version of websocket is working and is broadcasting each player’s position all connected sockets, except the one on which it is being called. This is important, since in human-machine interaction, to avoid movement lags, the player should see his/her Icarus move with mouse movements, whereas other players positions are broadcasted by the server to the client.
Saturday: Since universe is instantiated on client side, in a multiplayer situation, each player is looking at a different screen and the collision detection algorithm is detecting collision in each instance of the universe. Time to rewrite the game logic of the universe on the server side. I decided to break universe and Icarus (player) into two models. Server side would have both models, so does client side. Socket.io and Backbone.js are going to be my closest companions in the coming week.
Tuesday: I paired more with Dave on Icarus’s server side logic. We’ve enhanced code structure, played with snazzy CoffeeScript, and worked through debugging. Dave took a break in the afternoon to become familiar with Backbone.js. I spent the afternoon wrestling with websockets. To note, non-blocking code is so much better than blocking codee. How could programmers live without it for so long? Also, out of curiosity, how does WoW, or any other large scaled multi-player games structure their server side and client side models?