January 29, 2014

Recently, I took it into my head to poke around with WebGL, the HTML5 API for in-browser 3D rendering. Okay, I actually used three.js, a handy library on top of it, but hey, you say tomato, I say ketchup. For real though, you have to be some kind of nutjob to get down and dirty with anything that looks like OpenGL.

Anyway, 3D stuff. And in the browser, no less. What's that, doctor? You say I've come down with a case of excitement? Dear me, I hope it's contagious.

So, with a bit of fiddling, I took Jinn and hooked it up with three.js to get Awash in Iron, the start of a 3D, tactical strategy game. Okay, there's not much of a game there, but I got enough going to be able to rattle off a braindump.

January 20, 2014

It's pretty common in the OO world for one object to delegate stuff down to another object. For example, in Jinn, I'm decorating cameras. Though each camera decorator has its own behaviour - say, staying within some bounds - it'll delegate to the camera it decorates for things like the position and the viewing dimensions.

In a less powerful language, setting up delegation often means a lot of boilerplate:

How awful would it be if every time you want to delegate a property, you had to write that same chunk of code? Thankfully, JavaScript lets us do some really horrific cool things and CoffeeScript gives us a nice way of writing them.

January 12, 2014

The physical universe is a crystalline wonder; a rigid lattice of the natural constants scribbled down on a physics cheat sheet. Gravity on the earth's surface is always going to be 9.80665m/s2. Maybe 9.9m/s2 in the winter; we all pack on a little holiday weight.

A video game's universe is altogether more squidgy; constants are only constant until they're inconvenient.

It can take a lot of fiddling to get these constant definitions just right. You're going to waste a lot of time if you have to quit out of the game, hop back to the text editor, nudge a value, maybe recompile, launch the game, and get back to wherever you were just to find out that 2 should've been a 3.

January 11, 2014

A big part of getting a job is having a resume, right? I mean, only very rarely does the job fairy poke her head out of her enchanted cubicle to magically bestow a career; usually, you've gotta get your name and selected marketable skills out there.

So, how does one put a resume together? Not the actual content; that, obviously, comes from a lifetime of experiences and liberal use of a thesaurus. No, instead we must ask by what means one assembles this sacred text.

Microsoft Word is great; a lot of very smart people have spent a great deal of time and energy making a semi-prescient typewriter. Microsoft Word is also not on my computer. Microsoft Word also costs the sort of money one needs a job to spend.

January 8, 2014

I've been graduated for, good lord, a little over four months now. Some people might take a fortune of time like that and spend it doing something exciting and horizon-expanding like travelling. Me? Well, I'm more of a hide-in-my-room kind of guy.

What've I been doing with this time then? Some might claim long stints in front of my computer were symptomatic of a bone-deep laziness. Faced with this accusation, I throw up my hands and protest (in a squeaky voice) that this was my long-desired PROJECT TIME.

As my accuser turns away, I quickly drop my hands. Holding them up there is a lot of effort for these lazy bones.

December 9, 2013

Recently, I answered a question about implementing the IO monad in Clojure. All well and good, except that it took me longer than I would have liked to get back into the swing of reasoning with monads. This is the sort of thing I want to be as natural as, if not breathing, at least working with classes, especially since it's a stepping stone to other concepts like comonads and arrows.

To put myself on firmer ground, I took a day or so to write, from scratch, a couple of monads as well the supporting structure.

We've talked about monads before, but implementing a more general monadic system is interesting. Let's take a look at how it can be done.