Hackathon and Typescript 2hu

Posted by spotco on October 22, 2012

Update: Sometime in these last few weeks or so, Jump Goober Jump's online mode has hit over 500 levels! In celebration, here's a dump on the xml level files. Feel free to laugh at my level schema. Also, updated art gallery, powered by seadragon ajax. Dat zoom~!

So I redesigned the website in the weekend before school, and left it in its not-entirely finished state (blame it on homework every weekday) until now. Most of the todo's in the first post are still there, but I did implement a pretty rudimentary blogging system that can store posts/etc. It's done in all plain text files and the PHP include function, which I think is hilarously hacky.

The way I have it, it's basically like ruby on rails .erb template files, only minus the need of a whole bloated (opinions) framework. You probably could fashion one out of this.

Speaking of web frameworks, I think my recent hackathon project could have definitely used one. Something about these projects leads to flat, unorganized project directories and just a spaghetti of code in general (compare this to my facemii project from last year). A framework would have helped, but some sort of database-abstraction-orm would have been even better. We had a three-table deep database and I had to write this amazing bit of PHP-ery to get a simple json output webservice. It was about as fun to write as it looks (I compared scrubbing toilets in code). Oh, and for future reference php's array_push+arrays do NOT have reference semantics.

Good news though, we were second place! We made a pinterest-y projects page for the nonprofit asha. Being a ``webapp''-tastic, we used bootstrap (just like everyone else competing, hence google's 24 hours of bootstrap). It turned out nice, but more importantly I have two gym bags now one from google and one from yahoo. Which to use?


Last bit, and this could probably be another post in itself (and may be in the future). For some reason, I was convinced into making a bullet hell shooter game in javascript. Since I was doing this, I decided, I might as well learn something new. So, that's how I got started doing Typescript.

You may have read all the pessimistic blogs, or have some personal vendetta against Microsoft, but screw all the haters TYPESCRIPT IS EVERYTHING THAT I HAVE EVER WANTED AND HOPED FOR. Syntatically and structurally, it's a lot like actionscript3 (something very near and dear to my heart). You can have classes, interfaces, java-like inheritance while at the same time the function-closures and loosey-gooseyness of regular javascript.

But besides that, two really big things for me here. First, I can finally write javascript in a full auto-completing IDE (visual studio). Sublime text is good, but it can't show methods and display documentation like this can. I can't say how long I've been waiting for this day ;_;. And second, I can write typescript in multiple files and the compiler will compile it into one single output js.

tsc app.ts -out app.js

This shit'll go through your imports and automatically order the generated code in the output json so that all the dependencies are satisfied. Last thing: optional typing. It's the best of two worlds, what's not to like? So if you're out there reading this, I recommend that you go out and try Typescript on your next big(500 line+) javascript/web project. Not paid for that at all.

Finally, about the game itself, I followed my generic GameEngine with displaylist-array, base GameObject -> GameEnemy subclass pattern. The canvas api is pretty verbose, so I wrote some nice ts object-oriented wrappers. I was thinking that the source could be some sort of ts-based game framework, though I have no idea who would be interested in that.

Source is here and game is here.



leave a comment!