Node Knockout 2011
This weekend I participated in Node Knockout 2011. It was a lot of fun and I figured I would tell you about it.
Node Knockout is a 48-hour coding competition. It started at 7PM CST on Friday. The primary technology around which this contest revolves is Node.js, which you have probably heard about if you are a developer and you pay attention to anything that doesn’t come out of Microsoft. Teams can be up to four people and you can make anything you want as long as it is with Node.js.
A couple months ago I grabbed three other geeks to do this event. One ultimately backed out because he didn’t care for the game we decided on (not blaming him as I might have backed out if someone if the rest of the team wanted to make a Barbie game or something) but we ended up with three, Amir Rajan and Josh Kappers and myself. At our first meeting (at Buffalo Wild Wings, which became our standard meeting place) I mentioned that I wanted to do a combo-retro game, like a clone of Gauntlet from the NES with Contra power ups. That would rock. We decided to do something else because that would involve at least a rudimentary AI, and we figured we might not have time. We settled on a redo of the old Joust game but multi-player and with some twists. This is why our team name ended up being being “Team Joust”.
As we got closer to the event, we messed around with Websockets hoping that it would work well enough for us to do this. By the time the event came around three of us were uncertain that we could get this to work for us so we decided about 45 minutes after the event started to switch games. Fun times! The game we decided on was a multi-player Risk-like clone. For a few days we had been planning a possible alternate just in case. It’s a good thing we did. We’ll get to to the game in a minute.
I’d hacked on some things with Josh at work but had never done a for realz project with him. I knew Amir through local user groups and the intarwebz but had never coded with him. You never know till you do a project with someone whether they are competent or if they are full of it. Now that I’ve worked with these guys I know that they have the stuff, though you always have to wonder if they think the same about you :) They were great teammates and I’d love to do it again with them next year.
So, multi-player Risk with some tweaks. We originally were going to go with a Ninja Pirate war game. For time reasons and because it was hard to find a good creative commons pick of a pirate, we stuck with Ninjas. And then even then there wasn’t enough Ninja in the game…so it ended just looking like a risk-type game. But oh well. You can always just say that there were Ninjas there. They were just hiding.
The game had two screens. This was the first, which we spent a lot less work on:
And this it with peeps logged in playing a game.
The second was the battle screen itself. This is what it looked like when the game was waiting to start:
This is what it looked like in play:
We originally planned on making it real time but ended up giving it 15-second turns. This made it rather quick-paced, which makes it easier to overlook the bugs. Hey, we only had 48-hours! Anyway, every 15 seconds, troops movements and troop regeneration happened and you had 15 seconds to queue up your next turn’s moves. Total troop cap was determined by the number of regions you had. We also had fog of war so you could only see the troop counts and ownership of regions directly next to ones you own. You enter into battle when you move your troops to a neighboring region that you do not own. The battles execute on each turn and can last multiple turns if enough troops are there.
We had planned on a few features that we ended up having to cut. Non-player-characters were in but we had to move them out about two hours before the end because of bugs in the implementation. We also had planned on giving you the ability to have different types of troops (each with different strengths and weaknesses) and build buildings that either increase total population or troop output. As it turned out we would have had to slow the pace of the game for the troop types and buildings features and that might have made it worse. It was real shame that NPC’s had to be cut as they definitely made the game play better (if they weren’t buggy, that is). But oh well!
Bugs and Polish!
There are a number of known bugs, which pretty much knocks us out of the running for winning the contest, in my opinion. If you want to try out the game, keep these in mind to help you through it.
- The front page has a major bug in that it lists games that are in progress and over, which you cannot join. Sigh. If you want to try it out, create a game and send it to a friend.
- Private games aren’t actually private because they show up in the list :)
- Two person battles work ok. There is a bug that we couldn’t figure out when you put three people in the same territory battling it out, so good luck if that happens.
- Fog of war almost entirely worked. The only bug with it we found after we launched. Basically, if you have troops in battle in a region, it doesn’t increase your fog of war visibility range. This isn’t a problem unless you lose the adjoining region, which means you can no longer see your own troops in the separated region.
- The map designer (me) made two regions look adjacent that aren’t. Fail.
- There is a one-way door between two regions, which means you can’t attack one region from another but the reverse isn’t true.
- The battle calculations weren’t always what you would expect. Frankly, this feature just didn’t get enough love.
- We have no instructions. That's not a bug. It's just something we didn't get to :). We also didn't mentioned that it currently only supports four players.
Hey…we had 48-hours! We really just needed a little more time and we would have knocked these out, but such is life. If you want to try it out, here is a link: http://nko2-team-joust.herokuapp.com/
So I don’t actually know Node.js very well. Neither did Josh or Amir, but we’re all quite a bit more comfortable with it now! And that was one of the main points of the weekend for me. Surround myself with some smart guys with some tech I don’t know and have fun making something.
This was also a weekend of Linux development for me. If you know me, you know how odd that is. Amir and Josh both worked on Windows boxes. I think I was the only one who had npm fully working, so we got to be really low-tech and pass Node packages around on a USB-key. I spent all my time on Vim, which is very different from working in Visual Studio. Still, it was fun.
Our communication layer was done using Socket.io. Unfortunately the sockets didn’t work for us but we still used it as our communication layer and it worked great for that. It gave us easy two-way communication between web page and server, which is feat.
We deployed to Heroku. There were other options but it was the one I was most familiar with so we used it. And deployment is super easy since you can just push with Git.
The weekend was rather hectic. Josh wasn’t able to completely focus on the event all weekend because of work responsibilities but we stole as much of his time as we could. He also worked remote Fri night and Sun, so we had to communicate via Skype. But it worked and he and Amir were both a force for awesomeness. When we were together we hung out in my study at home. We drug the kitchen table into the study, surrounded ourselves with sugary snacks, Dr Pepper, energy drinks, chips, and 5-hour-energy and hacked away. We were cutting features by Midnight Saturday and the last few hours were rather stressful as we removed bugs and introduced new ones. But we launched. And that is something.
On Writing Games
So I had never written a game before. Oh my that was fun. I need to find a day job doing this…
My favorite types of games are RPGs and strategy games, so I was kinda glad we ended up with the game we did. After hacking our way around this one I think we were all glad that we didn’t do the Joust game. I really don’t think we could have finished it in time, even if we could have gotten sockets to behave well for us.
We needed a fourth person or about 4-8 more hours to finish things up. This is partly because none of us were good at Node when we started, though more because this game involved a number of different components (interface bits, art, communication, moving, troop generation and a battle engine of some sort and all working multi-player). We could have finished up with it pretty snazzy if we just had a little more time. We weren’t even able to play the game effectively till a few hours before deployment, and that just doesn’t leave you enough time to knock out the bugs.
Node worked great. I think it says something about a platform that three devs who don’t really know it can get a game mostly working in (actually less than) 48 hours. Node.js development is not easy in some respects, especially for those coming from a .NET background. But it was great and I plan on using it more in the future.
So Where To Now?
Well, I think we’re going to keep working on the game. I want to put those features back in that we had to cut and make it more real-time so we definitely have a lot to change. But making games is a lot of fun, so I’m pretty jazzed.
Josh, Amir…you guys rock. And thanks to the Node Knockout folks for putting this on.