Monday, 8 October 2012

Cave building in Clojure+Clojurescript

I'm still messing around with Clojure and ClojureScript, trying to find the sweet spot of development as far as development environment and toolkits go.

I'm trying to get some performant Html5 canvas usage, so I've been tinkering with KineticJS recently. I've been struggling to get real-time (or near real-time) graphics so far without resorting to WebGL - which just feels like cheating. Surely canvas is hardware accelerated by the browser and should be fast enough?

So, this evening I put together a Compojure back-end with a single web service return JSON data. This uses a simple cave generating algorithm of mine which hopes to randomly produce realistic looking caves. It randomises every block, then uses smoothing, and finally adds some random shafts.

This JSON is then consumed by some ClojureScript client side code using Google Closure and KineticJS. Screenshot below:

So, what are my thoughts?

I'm disappointed in the rendering performance; I'm guessing I must be doing something wrong.

So, next step WebGL I wonder? I'm trying very hard to embrace the web development revolution - even though part of me still wants to write good old fashioned native code.