In all likelihood, I doubt that I will survive the Zombie Apocalypse. A sad fact, it’s true, but at least I can console myself with the fact that I’ll be on the winning team, providing that the zombies prevail, a cure is not found, and I’m not eaten to complete bits before turning into one of the smelly undead. One of the things that clued me in on the fact that I probably wouldn’t survive as a human, was the fact that I suck at first person shooters. 9 times out of 10 I end up the player who gets killed the most, and I lack the coordination skills to run and accurately shoot at the same time. As a result, first person shooter games tend to make me very violent, and swearing real life pains and torments upon my friends who decided to play with me. Figures that I’m the type of person to get competitive at the one genre I truly suck at.
As a result, I tend to prefer RPGs. Mostly because it doesn’t actually involve good coordination skills with an xbox controller, but either button mash with attack/block keys, or wait for your turn, select your attack, and then let the dice roll and hope you don’t die. I find if I do poorly in these sort of situations, I can just blame it on the game logic rather than my inadequacies as a player. Not necessarily a logical conclusion, but it doesn’t prevent me from attempting to stab stuff outside the virtual world. Plus, on the more English-y side, I find RPGs tend to have better stories than other genres. If I’m going to be playing a game by myself, I would like to at least be engaged with some sort of interesting story. Graphics don’t really factor into my enjoyment of a game – I’m just as willing to play something in 8-bit as I am with 3D environments, high polygon count, and amazing textures – just as long I find the story interesting.
Which brings me to the point of the post, if in a highly roundabout way. Typically, in-browser games are most often seen in the form of Flash. Most of the interesting apps I’ve played on Facebook that held my attention for more than a week before ultimately getting blocked were Flash games. Flash, after all, is a very popular media for interactive stuff that moves around. Unfortunately, (for Flash developers at least) Flash is starting to lack it’s ability to be used in every browser that is browsing the internet, providing that browser has downloaded the proper Flash plug-in. As smartphones and tablets are becoming the new popular method for browsing on the go, we still have yet to see many (if any) of these platforms actually support Flash . This is understandable, as Flash does tend to put a bit of a drain on battery life.
So what is the alternative? Javascript. After all, it’s already natively supported in most browsers. You don’t have to download anything. And if you’ve checked out the awesome stuff you can do with Canvas these days, it’s a wonder why more sites aren’t making the switch (we are, for the purposes of this post, ignoring Internet Explorer). Last March I decided to start experimenting with Canvas after seeing some examples of what awesomeness
Javascript is up to these days (including a NES Emulator, which is so full of old school awesome I cannot even begin to express it properly in this post). In between attempting to finish up my English and Computer Science majors in one semester (which pretty much involved non-stop essay writing), I decided to start playing around with Javascript and Canvas. And what better way to do it, then with the one type of genre I’m actually somewhat decent at: RPG.
Thus, in the middle of Rhode Island, on a rainy March day at RailsCamp (which, oddly enough was supposed to be used as a Ruby on Rails gathering, but a bunch of us decided to use the time to experiment with Javascript and Canvas) (oh, and I designed the t-shirt) Javascript RPG was born. (We’re still working on the title). I decided I wanted to see if a an RPG would be possible to run it on Javascript. As homage to my Zelda days, I promptly found a sprite of Link and began coding.
At the end of RailsCamp the basics of the experiment had begun, and I had a working mockup of Link moving around a pretty simple map (There is even a pretty unflattering picture of me presenting this Javascript RPG). There was hyrule music that stayed on constant loop, and every time Link changed direction, an entirely new .png file had to be loaded. As a result sometimes Link would vanish for a step or two because Javascript was unable to load the image fast enough. The map was an array file that said “1″ was a rock and Link couldn’t pass, and “0″ meant to draw grass and Link could walk through it. There was no real way to modify the Link sprite or the map without major changes to the code, and almost all of the original code was being stored in index.html.
Flash forward 3 months. After running around writing essays like a madwoman while attempting to find spare time to program for class, never mind for fun, did some artwork/logo design for Daymash.com (look for the morbid dying suns), I had finally graduated with a degree in English and Computer Science from Colby College, and found myself suddenly with an excess of spare time because I didn’t have time to actually search for a job while attempting to graduate from college (so if you’re looking for a programer/web developer, here’s my resume). Thus I dusted this project off in my guthub account and started work anew. Brushing up on my
AJAX skills, I moved map and sprite handling off of the index.html page, created their own classes, and then had them handle all of their information using JSON, making it very easy to update new information. Instead of having a new image every time Link changed direction, I set up the system so the javascript could handle a sprite sheet and show the needed segment. The map is still as ugly as ever, but Link now has a nifty little walking animation. At one point, pressing “Z” had Link hold out his sword and some random bad guy jerkishly moved about the screen, but that was before I added animation and Sprite.js handled all movements (these elements are currently commented out until I can more elegantly handle them).
If you go to my github page, you can see the project as in currently stands. I’ve tested it out in Firefox, Safari, and Chrome, and it should work in all three (although Chrome can’t handle the JSON when playing with it locally). Or if you want, you can click the screenshot of the game up above to see a working version on my server. Just press the arrow keys on your keyboard, and Link should be able to walk around. My next goal is to either to add the attacking action again, or create a menu. If there is any interest, I can post some more in-depth explanations about the mechanics of parts of this RPG experiment. Otherwise, my next post will be on how I managed, after four years studying two different disciplines, to find a way to combined English and Computer Science for my final project.






Sarah,
If it’s any consolation, no one would survive the zombie apocalypse while running and shooting at the same time. It’s done in the movies, tv and games all the time. In real life, to quote Rocky the Flying Squirrel, “That trick never works”.
If you are not shooting from a stationary position, it’s only luck that you will hit anything you are aiming at.
Regards,
George