Archive for the ‘Programing’ Category

RailsCamp 3

Sunday, September 19th, 2010

This September marks the third RailsCamp New England that I’ve attended. For those of you who don’t know, RailsCamp is the ultimate unconference: a get-together that has all the advantages of a conference, but in a much more informal environment. About 30 or so programers of varying degrees of familiarity with Ruby on Rails get together at a location, where we all proceed to hack our little hearts out. The venue is typically small, encouraging everyone to get to know the others in the room. People take turns giving presentations on topics ranging from e-commerce solutions in Ruby on Rails, “Things I Wish I Knew When I Started Rails”, to learning how to make the switch from Rails 2 to Rails 3 (something I still have yet to do). At the end of RailsCamp, everyone is encouraged to show off what they have been working on the whole weekend.

I love RailsCamp. I think it’s an awesome idea. Where else would find a place where you have experts in the field hanging out, specifically with the goal of teaching newbies in a one-on-one environment on how to improve their mad ruby skillz? I think the community for Ruby on Rails is probably what draws me to the language/framework the most. I’ve met some wonderful people over the course of these three RailsCamps, and I’ve gone from someone who knew next to nothing about Ruby, to someone who apparently spends most of her spare time hacking on a Ruby on Rails app (It’s a character sheet / campaign manager for D&D 3.5, more details on that project in a future post). But RailsCamp wouldn’t be possible without the help of sponsors, who help make costs more affordable, by covering some of the venue costs and paying for meals.

Which is why I want to end this post by thanking the people for making RailsCamp NE possible. Thank you, Velir and Vermonster, for sponsoring the 3rd rails camp. Thanks also to Brian Cardarella, for organizing Railscamp every six months, and taking the time to help find sponsors. RailsCamp wouldn’t be the same without you.

Javascript, Canvas, and the Return of the Old School RPG

Tuesday, July 13th, 2010

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.