Palagpat Coding

Fun with JavaScript, game theory, and the occasional outbreak of seriousness

Wednesday, September 16, 2009

Cloning Zelda: With a Little Help from my Friends...

My Twitter friend Peter Higgins, who I've mentioned before, has been following my progress on Canvassa for the past several months, and last week he sent me a brief message, asking if I'd be okay with him forking the code on Github to re-arrange the overall structure of the app and make it more Dojo-y. I said sure, because anytime you've got someone with his programming chops offering to partner with you to help make your code better, you don't say no!

So anyway, a few days later, Peter sent me a Github pull request to take a look at his branch, and yes, it's quite different. So different, in fact, that I haven't yet figured out yet how to integrate his changes back into the trunk! But a couple of things jumped out at me:

  • He moved all of the namespaced code (basically all of my Dojo classes) into a subfolder off the main folder, so now you have /loc/Canvassa/index.html for the main page, but the game classes all live in /loc/Canvassa/loc.
  • He split up the Monster classes into individual .js files, and put them in a subfolder under the namespaced folder (/loc/Canvassa/loc/Monster)

In the short term, this has resulted in a LOT more http requests when the game is initially loaded. Long-term, though, it'll help since you only have to download the monster classes that have actually changed instead of re-grabbing the entire code glob when I tweak something about, say, the Octorok's behavior. And when the long-awaited day arrives that I put the "it's done" seal on this project, I can use Dojo ShrinkSafe to merge and minify all of the code into a single package, eliminating the multiple-http-requests problem.

For the time being, I've put my working copy of Peter's branch on my site here. It's slightly more functional than the version in my Part 5 working copy, including updates to medicine (it works), bait (it kinda-sorta works, but doesn't affect enemy AI yet), and the bombs and candle (they both more or less work now, but don't destroy scenery yet). But in the process of those updates, I somehow managed to break the boomerang, so I need to fix that before I attempt to merge it back into the trunk and blog about what I did to implement the new item behaviors. Hopefully that'll be a simple fix; I suspect I just broke something minor in the loc.Item base class.

Labels: , , ,


Post a Comment

Subscribe to Post Comments [Atom]

<< Home