What SCUMM Can Teach Programmers

I’m a huge fan of the LucasArts graphic adventure games. I’ve been reading up on the history of the company in Rogue Leaders: The Story of LucasArts, and I noticed that some of the success of these games was credited to the SCUMM game engine.

Monkey Island Concept Art

It became clear to me that I was never going to complete Maniac Mansion writing the whole thing in 6502 assembly language.

- Ron Gilbert

Thanks to this game engine, numerous key gaming franchises owe at least part of their success to a scripting language. The Rogue Leaders book mentions that at the time Maniac Mansion was developed, the developers wanted to remove the burden of working with assembly language so they created what sounds suspiciously like a programming language and virtual machine. Big budget games are typically developed with lower–level languages like C and C++ (although there are exceptions), but back in the 80s assembly would have been more common.

This all makes me wonder how important SCUMM was to the success of LucasArts. There’s no reason why a scripting language shouldn’t be used for an adventure game — developers can be left to focus on being creative within the game world rather than worrying about technical details. This has parallels with web development, where manipulating text and high–level protocols are important and we’re focused on satisfying business and usability goals rather than low–level technical details.

The Language

Monkey Island Concept Art

As a programmer I’ve always wanted to know what SCUMM was like. I was born in the wrong time and place to be a “Scummlet”, and although ScummVM is an amazing piece of work it doesn’t reveal what real SCUMM scripts were like (it does have detailed documentation on the opcodes though). Fortunately, Ron Gilbert gave a talk that revealed some fragments of the language at GDC, entitled Classic Game Postmortem – MANIAC MANSION. In this talk the following scripts are revealed:

script clock-tick {
    do {
        clock-state = not clock-state
        object living-room-clock state clock-state
        play-sound clock-tick
        break-here 60
    }
}

And:

cut-scene {
    ...
    actor nurse-edna in-room edna-bedroom at 60,20
    camera-follow nurse-edna
    actor nurse-edna walk-to 30,20
    wait-for-actor nurse-edna
    say-line nurse-edna "WHATS'S YOUR POINT ED!!!"
    wait-for-talking nurse-edna
    ...
}

If these are indeed real SCUMM scripts then it looks like:

  • It’s superficially C–like: assignment with =, curly brackets, etc.
  • script looks like a function
  • There are coroutines, probably implemented with green threads
  • Each line seems to be a tuple of pairs with object noun or verb noun (these are implemented as opcodes)
  • There may be some Lisp influence, Ron Gilbert mentions he was looking at Lisp then wanted to make something more C–like (with help from Chip Morningstar)

In Modern Terms

This language is best described as a DSL — although functions like actor are implemented as opcodes in the VM rather than libraries built on a core language (Ron mentions this, and see actorFollowCamera in ScummVM). Perhaps a DSL for assembly language?

We don’t know what the core language’s reserved words were, and it’s obvious from ScummVM that the language changed a lot over the years. It seems to have some interesting ideas and it was definitely way ahead of its time. Remember, the first SCUMM game came out in 1987 for the Commodore 64.

We can learn a lot from SCUMM. It doesn’t look like a “pure” language, it actually seems messy. But it was ported to many platforms, and it was used to create entertaining games that sold millions of copies. It makes me remember that the best tool for the job shouldn’t just be technically excellent, it should also be able to cater for a developer’s creativity.

1 The Exceptions

I’ve seen GOAL mentioned a few times anecdotally, so I was interested to see this Lisp runtime mentioned in a Hacker News comment

As far as I know, the games we did at Naughty Dog (Crash 1–3, Jak 1–3 + X), and later Uncharted were the only major console games which large amounts of runtime Lisp. The Jak & Daxter series was 99% written in my Scheme dialect GOAL, including all the assembly. The only parts that weren’t were libs talking to Sony’s libraries (C++).

There are high–level simplified examples of GOAL in Postmortem: Naughty Dog’s Jak and Daxter, and echoes of SCUMM:

There are other major compiler advantages: a unified set of assembly op–codes consistent across all five processors of the Playstation 2, register coloring when writing assembly code, and the ability to intermix assembly instructions seamlessly with higher–level code. Outer loops could be written as “slower” higher–level code, while inner loops could be optimized assembly.

References

blog comments powered by Disqus