Programming

Clojurescript at London FunctionalJS

At the January’s London FunctionalJS meetup the technology under discussion and use was Clojurescript. There was an introduction to the language basics from Thomas Kristensen of Forward, which was really much more about the basics of the syntax. We then went into the dojo exercises: the choices were implementing the Todo list SPA (the Javascript world’s Pet Store), using Clojurescript with an existing Javascript framework people were already used to working with or doing some 4Clojure.

Everyone ended up doing the Todo list which is interesting in its own way. Clearly the SPA is seen as the benchmark for evaluating these kinds of technologies.

Most of the teams were able to get the basic Todo functionality done in terms of adding and removing things from the list and re-rendering it. Most teams seemed to abstract the rendering but most put the list management into the callback for the event.

Again I was interested to see that most people grasped the idea of an atom and were able to manipulate its value. Because that kind of stuff is second-nature to me now I was wondering if it would cause issue in terms of creating a modifying function rather than directly manipulating the value. The example in the setup functions of the dojo code using conj seemed to be straight-forward enough for everyone.

Identifying and deleting items seemed more problematic. Some people wanted to do it by index but for the most part matching the text of the todo-item seemed to be popular. Probably the sensible way to actually manage the items is to uuid the items to allow their underlying state to change away from the identity.

Laziness definitely caught people out, including myself! I’ve moaned about the fact that using map purely for side-effects in fact results in the form not executing. Despite this I fell into the trap again, however fortunately having encountered it before I could reverse into a quick doall.

Other teams imaginatively re-implemented doall using loop. Which I guess is testament to how easy it is to do things in a LISP.

One thing that was hellish in our team’s code and which I think cropped up in the other teams as well was the amount of set! we were applying to build up very low-level DOM calls. Right at the end I remembered that Google Closure was available to abstract some of that work away. However it still means that your knowledge of Clojure needs to be heavily supplemented by low-level DOM APIs as well as what is available in the Google Closure library (which is not the best known of libraries).

I was also wondering whether doto might not have cleaned up our code a lot. It’s an issue that a lot of Javascript mutable state is not easy to wrangle with things like threading macros that normally ease the pain. I’ve seen this in the WebGL dojos as well.

The final ugly issue of the evening was the project template that managed to both run on my machine and not run on my machine. The template was more complex that the standard SPA template as it used Compojure and Clojurescript (presumably using the former to serve static assets on localhost). Leiningen skeleton projects have to work and be reliable, otherwise potential adopters just get frustrated and quit.

The reactions were interesting, a guy on our team at the end asked why he would want to use Clojurescript. Good question. People who were doing things like building HTML5 games seemed to see the potential and advantage much more. This is an area I hadn’t really considered before but it does make a lot of sense as regular Clojure has already had a lot of success in implementing animation and complex state machines.

For me the alternating between high-level Clojure and low-level DOM APIs was painful. I’m going to be more interested in having wrappers that allow high-level programming consistently in a project. And I am going to be thinking about games more!

Standard
Computer Games

Final Fantasy: War of the Lions, War Against the Interface

This game is one of the highest rated PSP gaes on Metacritic but I have just found unbelievably frustrating. The amount of key pressing is unbelievable. If I press attack and there is only one target I can attack then you know what computer machine? Just select it for me. In fact wherever I just have one option why don’t you just automatically set it up so I can confirm it? If I am going to be selecting Wait from a menu loads of times why not bind the common options to the symbol buttons so I can just press a button series rather than using arrow keys and X all the time?

There is also a lot of Game Over in War of the Lions. Fail a battle, Game Over. Your character dies in a battle, Game Over (is there a way to save a dying character? if not then why make it a game ender?). And what happens when you get game over, the game reboots… from the start sequence. Sorry but when did I switch on Iron Man mode?

I know this is a port but that’s no excuse for making no effort to try and make the user interface fit the device. Even D&D Tactics is better than this. The excellent cut scenes really don’t compensate for the cruddy design decisions.

Standard
Computer Games, Games

God of War: Chains of Olympus

So far GoW: CoO (TLA 4TW) has proven to be my favourite PSP game I have purchased so far. Graphically it is an amazing title that really looks like a normal console game on a tiny screen. However the secret seems to be the way the game uses the PSP’s controls.

The tactile experience mirrors what is happening on screen. If you are struggling to break free from the grip of a monster then you are hammering keys, if your character is straining to snap open a chest then you are holding the button in a death grip yourself. The analogue stick has a better feel for movement. You feel like you directing this torrent of motion rather than going left a bit, right a square…

This link between interface and game only breaks down when you are asked to chain together various specific interface interactions very quickly to complete boss-type fights. In particular I find rotations quite difficult because the on-screen icons are not very clear as to whether you are aiming for clockwise or anti-clockwise.

Standard
Computer Games

Take Command a satisfying replacement for Sid Meier’s Gettysburg

So I finally installed Take Command: Second Manassas (TCSM) after many delays. I really loved Sid Meier’s Gettysburg (SMG) and I have been looking for a replacement for it for a while. To be honest the graphic content is not really far off its venerable ancestor but it is a satisfying game that seems to capture ACW tactics in a visually appealing way.

Some interesting features are that the battlefields seem to be bigger and therefore you are actually expected to use Road Column movement! In SMG column movement was just a way of breaking your troops unless they were reinforcements. TC: SM introduces couriers that actually ferry orders between the general and your command. That’s a really atmospheric touch.

One thing that is a bit disappointing is that barriers on the battlefield do not seem to interact with the troops in a decent way. During the tutorial I lined some troops up behind a wall, which was relatively easy, however later they decided to concentrate their fire to their left and therefore the unit AI wheeled the line left putting straight through the wall rather than anchoring on it. Apart from breaking the illusion this also gave me a UI headache as I could not easily tell whether the AI had opened itself to enfilading fire or not. Since the unit seemed to retain its defensive bonus I assume this was only graphical compromise but I would be annoyed in a tighter balanced scenario if I could not easily see that a unit had broken cover.

Standard