Sunday, December 16, 2012

Adventures in Jamming More JavaScript Into My Head

Years ago, I picked up Head First Design Patterns by Freeman, Robson, Bates, and Sierra. I was impressed with how much more effective it was at getting some otherwise dry concepts into my head, certainly as compared with the authoritative "Gang of Four" book that covered the same topics.

Also, the cute woman with ponytails on the cover didn't hurt.

Recently, I've stocked up on a bunch of JavaScript books, including the definitive guide, which is huge, but that's what I'd expect from a definitive guide, I suppose. Also, a much smaller volume with just the good parts, and then also a copy of the definitive guide to closure. Not to mention, I got a copy of "Eloquent JavaScript", only to discover that I already had a copy on the shelf. Not a reflection on the book itself, just an indication that I can be scattered between my book purchasing and self-directed studies.

I've heard it asserted that if a software engineer is any good, they're as fluent in their primary programming language as they are in their primary natural language. JavaScript isn't my primary programming language as measured by fluency, but it's what I'm getting paid to write in these days, hence the attempt to cram stuff into my brain.

I've also picked up the Head First JavaScript book, and am going through it. It's not heavy material, certainly. I do miss the woman with ponytails. Maybe I should review some design patterns.


All of that, in a weird way, is preface for what I actually intended to post about. Right now, I'm looking for a game development framework that allows me to write in JavaScript and deploy to the web (easy), Native Linux (pretty easy), and Android (somewhat tricky). I had been somewhat actively helping out with PlayN, but that's writing in Java, and that's no longer my priority.

There are a few frameworks out there that get me most of the way to where I want to be, including PhoneGap and LycheeJS. There are many many more, too, as this list attests. I haven't tried most of the entries on that list, certainly.

A bit ago, I spent some time trying to get PhoneGap up and running, and I eventually backed up and re-installed Eclipse and set up a fresh Eclipse workspace, and all of a sudden, PhoneGap started working better. But not great - the documentation seems to be out of date and the samples weren't working for me. But maybe having access to the Android camera interface isn't important to me from within a game. Or maybe it is. Something to revisit.

I've also been looking at LycheeJS, which looks like it's pretty close to what I want - a one-stop framework that goes everywhere I want, but it wants to live in a Ubuntu environment, which isn't exactly the same as my Fedora workstation. That may be a small issue, and I'd be happy to help the author expand his scripts to support Fedora as well. It looks like the website is in a state of half-completion; many pages of the documentation are missing, and some are only half-written. Which I certainly sympathize with, I get distracted by shiny objects and leave ideas uncompleted.

This weekend, in addition to getting a PhoneGap sample semi-working on my tablet, I also spent some time trying to get a small game working inside LycheeJS. I was pleased to see that some of the concepts presented were echoes of things I had been working with in my own toolkit, in particular I have an idiom that I call "Modes", which are states of gameplay. A menu is a mode, the main gameplay experience is a mode, and dialog boxes are modes. I like to stack them so that dialog boxes consume input, but still allow the underlying mode to render. LycheeJS has a similar concept, called game.state, which is pretty similar, minus the notion that they might be stacked. Perhaps stacking them isn't critical; I thought it was a good idea when I first coded them. I may find that it's not important, or I may find that it's easy to add a stack, or I may find that it's a lot of work, but it's still worth it.

I'm not currently able to get the LycheeJS build script to generate an Android APK, almost certainly because  of the Fedora/Ubuntu mismatch. I've decided not to let that slow me down, but to get to understand the framework (and jam some JS into my head along the way) first before worrying about playing games on my phone or tablet.

It's not too painful to do a build to a Linux executable, running in its own window. One thing that is somewhat unpleasant there is what has been driving me nuts already; JavaScript's tendency to fail silently. One typo and whatever you were doing just stops. But usually, not stops altogether with a stack trace, which could be helpful.

Late this afternoon, I tried running a bit of code that turned out not to be valid JavaScript, and proceeded to hang my whole machine (an impressive feat, one which I haven't done much of since writing DOS code, years ago). This was using the Linux build, rather than the browser target. Perhaps I'll shift over to running in the browser as my typical working target, and getting comfortable with the Chrome debug console.

I also spent a chunk of time this weekend checking out node-sdl, which could be a piece of a cross-platform deployment strategy, but I got hung up on trying to figure out why some of my gamepads and other input devices weren't showing up usefully in the samples. I suspect that SDL is complicit, but I'm not sure if it's worth chasing at this point. If my CH Flight Sim foot pedals aren't recognized by a framework I'm not currently using for a game I'm not currently writing, does it constitute a bug?

Friday, December 14, 2012

Persuasive User Interfaces in Media

So, I just watched WarGames again for the first time in years. It's a little goofy, and I found myself distracted, trying to figure out where Wm H Macy would show up. John Spencer was easy to pick out as the captain sitting at the launch console at the beginning of the movie who wanted to get someone on the horn before he blew up twenty million people.

But I found it curious to see the give and take between WOPR/Joshua and Lightman/Falken.

After WOPR calls Lightman back at his Seattle phone number, WOPR complains that Falken (who WOPR thinks that he's talking to, even though it's Lightman at this point) is a hard man to get in touch with. You don't find a lot of user interfaces that actually try to seek the user out. At some point later in the movie, McKittrick (Dabney Coleman) says that computers don't call people. That's funny now, because robots call people all the time these days. And email that come from unmanned email addresses are the norm.

Early on in the movie, WOPR invites Falken/Lightman to play a game. ("Shall we play a game?", which strikes me as a nicely formal way of phrasing it, reminiscent of machines that can't use contractions.) Lightman has read the list of games (which was available from the login prompt, which strains credibility as much as anything else in the film), and asks to play "Global Thermonuclear War". In an interesting confirmation interchange, WOPR asks "Wouldn't you prefer a nice game of chess". Again with the formalism; 'nice' and 'prefer' make it sound like we're talking about a cup of tea. This is fitting - Falken is portrayed as being anti-military, and has a (British?) accent, so he must be more refined. Playing wargames via computer is more the realm of McKittrick who has a neutral US accent, and actually engaging in war is the realm of Beringer, who has a Southern accent. A cheap trope; if you were smarter, you'd hate war, and you'd probably have an accent and extend your little finger while sipping from your teacup.

We have confirmation dialogs today (Are you sure you want to delete this file?), but they're guarding against destructive behavior, they're not usually expressing surprise at a deviation from character. (John never plays Global Thermonuclear War at home!)

Much of the suspense of the movie revolves around getting WOPR to stop racing towards launching nuclear missiles. There's a point where someone presses the "Lock Out" button, which seems to sort of protect against changes in plan. The heroes have to "reason" with WOPR by figuring out that they can log in to the tic-tac-toe program (which has been removed from the games directory... why?) to teach WOPR futility, and that epiphany will immediately translate over to the (simulated?) battle with Russia that it's playing in the other process.

During the tic-tac-toe game, someone makes a comment about WOPR's resource usage; it does seem like the machine, while capable of multiple processes, has turned its attention to "solving" tic-tac-toe.

When I was a kid, my notion of AI was formed by Star Trek and Disney. If you could trick the computer into a contradiction, you could crash their agenda, and maybe even make the hardware explode.

With WOPR, the pattern seems to be that if you can teach the computer a small lesson, the computer will immediately extrapolate and apply that lesson to other running processes.

And, if you watched "Electric Dreams", teaching a computer about love will make them route a disastrous amount of current around the world over the phone grid. But only after you play cello with it, beat it with a baseball bat, and cry on it.

Thursday, December 13, 2012

Word Gripe of the Day

"Temporary"

Years ago, my father teased me suggesting that the definition of "temporary" was "without a defined endpoint in time", and the definition of "permanent" was "without a defined endpoint in time". I think he brought this up more than once over the years, and at one point it occurred to me to reply that perhaps he needed better definitions.

At the time, I thought he was deliberately choosing terrible definitions to be cute, but I don't think most people have better definitions. If I had to come up with definitions, I think the distinction would have to do with expectations after a sufficiently long time into the future - if the expectation is that the phenomenon would come to a stop by then, you probably mean "temporary". If the phenomenon has gone on without interruption or sign of decay, then that's "permanent".

But I don't think people really think about these words - I heard a weather report mentioning that it was raining, but that it was likely to be temporary. Erm, I certainly hope so. And employment is sometimes described as being temporary. Well, for my case alone, I only plan to be alive temporarily, so my employment is also constrained to be a temporary arrangement.

12 Games in 12 Months

 One of the blogs that I read on a regular basis is "Tales of the Rampant Coyote" (a name which almost, but not quite, sticks in my head... "rampant, um..."). Today's post links out to Christer Kaitila's project of "12 Games in 12 Months", which matches an idea I was thinking about for 2013. I recall Petri Purho challenged himself to make a game every month, and I thought that was ambitious.

"Ambitious" is a good word. "Uncomfortable" is right in there, too.

I don't know if I can really pull off a game a month, even with a low "game jam" level of quality, but I think it's worth giving myself a challenge like that.

There's a lot of little games I'd like to play around with, and a lot of game frameworks out there. And I've got commitments of work that I want to do, anyway.

I may regret doing this, but I'm throwing my hat in the ring - for the calendar year 2013, I challenge myself to make a "game" every month. The scare quotes there are deliberate weasel space; I know I'm going to push the boundaries just to squeak in on some months, and I know that I'm not going to polish them all, and some of the games that I intend to count will be ports of games I've already made to new frameworks (Woody Tigerbaum, you have been warned).

As I go, I expect to post here with a few links, a few screenshots. And, if I really have my act together, I'll post to github with code repositories.

Even as I wrap up this post, I'm reminded of Chris Hecker's "Finish Your Game" rant, which somewhat argues against the game jam idea of sketching a game idea and moving on to something else. I love listening to Chris, I think he has some great ideas, but I don't know that I should always take his advice (and it'd be a cheap shot to say that Chris ought to finish his own games - he's working on one now, which is good. But hey, what happened to that rock climbing physics game? I guess "Spore" shipped, so that's good...).

I have a big game that I want to work on, and working on 12 small games in 2013 means I won't be working on The Twenty in as much depth. Then again, I haven't worked on it that much in 2012, unless you count my NaGaDeMo game. So maybe that's OK.


Shall We Play a Game?

The only correct answer is "Love to". And you get bonus points if your voice was in the weird high-pitched scratchy tone from the movie.

Back in 1983, I saw a little movie about a nerdy guy named David L. who lived in the Seattle area and liked computer games.

The cast includes Dabney Coleman and Ally Sheedy, of course. John Spencer and Michael Madsen are credited, and IMDb says that William H. Macy has an uncredited role as a NORAD officer.

And it introduced me to Matthew Broderick, who went on to memorable roles in Ferris Beuller's Day Off, Project X (opposite Helen Hunt), Godzilla, and The Producers.


Tonight, as part of their "The End of the World as We Know It" (nice) series, SIFF is showing WarGames. It'll be good to see it again on a big screen, and presumably with other film/game/computer geeks.


All right, so maybe you're not able to make it to Seattle tonight, but you still want some voice synthesized game experience, and match three is your speed. You could check out WarGames: WOPR for Android - a game I didn't expect to like, but I found myself sticking with through the end. You play in the role of WOPR, which gives the various characters in the game chances to play against you, providing a little variety in opponents. Additionally, there are two different sets of pieces and several active and passive powerups that you can buy and upgrade, so the game changes as you go along, rewarding you for continued play, even if you're stuck on a single level.


I haven't yet seen WarGames: The Dead Code and I don't think War Games: At the End of the Day is at all connected. Somewhat tantalizingly, IMDb says that there's a 2014 WarGames movie - there's no real information on IMDb, but if you do a Google search, the snippet for the IMDb page lists Seth Gordon as the director. Curious.

Note to myself: I should try to see WG:TDC soon (this weekend? Over Christmas vacation?).

Note to the reader: if you like geeking out to this kind of '80s nostalgia, and you haven't read Ready Player One yet, you owe it to yourself. Fast reading. Sort of like if "Ender's Game" was written by Neal Stephenson. Or if "Reamde" was... well, it's a lot like "Reamde".

None of these links are paid. So click away!

Wednesday, December 12, 2012

Introductions

Um, hello.

This being my first post on this blog, I feel like I should say a few words about who I am and what I think this might be.

I'm a guy who likes technology, and in particular programmable devices. I'm most happy when I can run Linux on a machine, and I bought a PS3 when I learned that Linux was sort of supported on it. And then I was crushed when it was silently made incompatible with using your PS3 for gaming.

For me, at least, having to decide between Linux and PS3 games, Linux won.

I also have less geeky pursuits, from theatre to dance to backpacking. Those may also show up here, but probably in lower frequency.

Expect random braindumps, scribblings of discoveries and aspirational "To Do" posts.