Black, with Cream and Sugar

Non-stationary art got a big boost in 1930, When Alexander Calder invented the mobile. Now that the computer is ubiquitous, the possibilities for non-stationary art — interactive or simply involving unpredictable and non-repeating motion — are staggering. Okay, computer screens can’t do real 3D, and a mobile is real 3D. But even so, the sky’s the limit.

I’ve noted before that if interactive fiction has any hope of being taken seriously as an art form, it’s going to have to present a modern, attractive user interface. To be both attractive and deliverable to users, it will need to run in a standard Web browser. And that means that IF authors who don’t wish to be ghettoized or marginalized are going to have to come to grips, in some way, with Javascript.

The same could be said about almost any digital art form, not just IF. Sure, you can upload your photos to Flickr or your music tracks to Soundcloud, but at that point your audience will encounter that user interface, which may well detract from the experience you would like to convey. You’ll have no control over the presentation. And presentation matters.

The same can be said of conventional interactive fiction played in a browser-based interpreter. Yes, it can be played over the internet, but as an author you still have damned little control over the presentation. If you want that control, you will have to roll your own interface in Javascript (or spend a lot of money hiring somebody who can do it for you).

What I’m discovering today about Javascript is still rather preliminary — these are my impressions, and should not be taken as gospel. I may be wrong. But I’m learning some stuff. I can list seven different reasons why Javascript is problematical, if not worse. For the amateur programmer who just wants to do something wonderful, Javascript is sort of a minefield. Here’s why:

  • Javascript code tends to be as dense as an impacted wisdom tooth. You can do things like create functions inside of other functions, or return a function from a function, or send an anonymous function to another function as an argument. Constructs that end with a series of characters such as ))]}; are not uncommon.
  • Javascript variables are dynamically typed. One result of this is that when you look at a function someone else has written — in a tutorial, for example, or in a library — you may not be able to figure out what type(s) of argument(s) the function designed to receive. The argument list doesn’t say (int value, array chunk) — it just says (value, chunk). Until you become a power user, figuring out what the function does … well, good luck with that.
  • You don’t just have to learn Javascript. You also have to learn HTML and CSS. These are not terrifically difficult technologies, but each of them has its own syntax.
  • Javascript is not the same from one browser to another. It’s mostly the same, but there are bleeding edges. At some point, when you get beyond the tinkering stage, you’ll have to deal with this fact. It’s also a moving target — as is HTML. If you’re reading a how-to document that’s three years old, you can expect it to give you bad advice here and there.
  • The available learning materials are extensive, yet oddly inadequate. While there are plenty of free Javascript tutorials online, many of them duplicate the same extremely basic information, and none that I have so far found provides a thorough, detailed explanation of the more powerful features of the language, tailored to the needs of an intelligent novice. The advanced tutorials I’ve found tend to assume that you’re a professional programmer who can figure out a bunch of stuff with only a few terse bits of guidance. There is also a distressing tendency to spend chapter after chapter describing the details of the Javascript language without ever once mentioning how to use Javascript in a Web browser, which is where you’ll be using it.
  • To debug your Javascript, you’ll need to work with utilities like Firebug (in Firefox) and the Chrome Developer Tools. Again, this is not terrifically difficult (although there may be nasty bits that I haven’t yet discovered) — it’s just another facet of a very multi-faceted process.
  • Once you’ve learned Javascript, you’ll find ways to make your life easier using libraries such as jQuery. But until you become proficient in Javascript itself, jQuery is like a great big black box. It won’t make a lick of sense. Once you have become proficient in Javascript, then, you’ll discover that you’re still not out of the woods, because you’ll need to learn about jQuery too, and possibly other libraries as well. Each of which may be updated when you least expect it.

Right now I’m reading, or attempting to read, a very nice free book-length tutorial called Eloquent Javascript. It has interactive code examples and other goodies. Trouble is, by Chapter 4 the author is throwing complex modeling problems at you, and then giving the code for the solutions without bothering to explain exactly how the code works. I can stare at a seven-line function for three minutes and still not be able to figure out what it does. And the author doesn’t tell you.

Computer programming is fun, and I’m pretty darn sure that Javascript is the Gold Standard for creative types who want to be able to develop non-stationary art. Plus (and this is a big plus), all of this technology is 100% free! Amazing. So I’m going to keep plugging away at it.

I wish I could take a class, because I would love to be able to go up to the instructor after class and say, “I don’t understand this function. Can you tell me what it does?” Yes, there are online classes. (Not free.) I’ve looked at the curricula for a couple of them. I so do not need yet another tutorial that tells me how to use a for loop, or what “var” means. I want the real stuff, and I don’t yet know where I’ll find it.

This entry was posted in Interactive Fiction, media, technology, writing. Bookmark the permalink.

1 Response to Black, with Cream and Sugar

  1. georgek says:

    I can stare at a seven-line function for three minutes and still not be able to figure out what it does. And the author doesn’t tell you.

    I definitely know that feeling! All I can say (and I know it sounds dully obvious) is the more you practice it, the easier it gets.

    One thing you might want to look around for are languages that compile to Javascript. There seem to be quite a few now (in various stages of development). To get you started, I think there is Haxe, Python (through pyjamas), Common Lisp (through parenscript), Clojure (though if you don’t like )))) parens you might not like Lisp and Clojure at first)…

    Well wait, I should have Googled first:

    Look down the list at ‘static typing’, that might suit your taste.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s