After considering various permutations of and puns on the words “balls” and “pucks”–”brass balls,” “balls to the wall,” “all the pucks,” “zero pucks,” “smarmy pucks,” etc.–I decided on “Snarky Pucks” as at least a working title and registered snarkypucks.com. The joke may be a little subtle (Google shows only 600 results for the phrase “snarky fucks”), but it actually gives some idea of what the game is about.
I started out working on the client side in CoffeeScript/jQuery/HTML5, with my very first steps being related to scrolling and dirty region management on an HTML5 canvas. I assumed that the environments would be comprised of a set of 2D vector features (based simply on canvas’s drawing primitives), and that it would be best to avoid redrawing all of the visible features when scrolling. Instead, I copy the moved portion within the frame and dirty the exposed portion, which seems to work well, though I’ve only done the most basic testing on my phone. One of the useful features of HTML5 canvas is that you can stack them on top of one another with transparency, avoiding the need to dirty and redraw everything in a lower layer when you change something in a higher one. I found this especially useful for the editor tools–dragging out a line, for example.
After getting a basic scrolling grid up and running, I started working on a track editor in tandem with the basic functionality that will be shared with the editor and the actual game: feature management, intersection testing, serialization to JSON, etc., etc. It gave me a chance to return to some of the fun 2D geometry of Spiral Knights(‘s gameplay), and I used the same space representation: a spatial hash at the highest level (avoiding the need to specify/limit the track size), with quadtrees as the hash values. The editor is essentially just a vector graphics editor, complete with undo/redo, group selection and editing, and import/export; in fact, I used it to create a basic logo for Facebook:
My last client-side push before delving into the server code was to add a test mode that simulates the process of entering and executing moves that the game will use, as well as the interactions between pucks and their environments. I’m using an extremely simple point model for the physics, with the pucks’ motion governed simply by their initial velocity and constant friction (notably, pucks have no “spin”), which makes it easy and efficient to depict where the pucks will travel if they don’t collide with other pucks:
Since then, I’ve been riding Ruby on Rails for the server code: authentication (including Facebook login), player management, track management (saving, revising, publishing), game creation, and soon, game invites. My plan is to stick (for now) with bare bones page-oriented interfaces for the admin interfaces, but create a more AJAX-y, “SPA”-type interface for the actual gameplay. So far, I’m liking the concept of Rails more than I like Ruby as a language, but I figured I’d start with the framework that spawned so many, many others.