weiss nicht ob das hier schon mal gepostet wurde,
ist auf jeden Fall sehr interessant.
http://www.pagetable.com/?cat=14SCUMM Script
Monday, May 30th, 2011
Ron Gilbert posted this as a comment on The Mansion – Technical Aspects.
SCUMM script was a little odd. When I first started designing the language, I was going to base it on Lisp. I was use to using it to customize emacs that we used to do all our coding. This was not on PCs, but on large multiuser UNIX machines. The Lucasfilm games group was part of the Lucasfilm computer division (which later became Pixar) and we had some very smart people that connected the C64 to the UNIX machine. From my UNIX terminal, I had complete control over the C64 and wrote a source level debugger for SCUMM. The 6502 assembler was custom written by Chip Morningstar and ran on the UNIX machine.
But I digress. So, SCUMM started out as Lisp based, but I quickly abandon that approach in favor of something that looked a little more C-like, but some aspects of Lisp remained, mostly in the naming conventions. Commands and variables used – (dashes) as separators.
sandy-rescued = 1
This was a single variable, not sandy minus rescued. So how did SCUMM do subtraction? You didn’t. Until Monkey Island, there was no way to do complex expressions. if you wanted to subtract a value you used:
count -= 5
If you had a complex expression, you had to chain them using +=, -=, /= and *= using temp variables. Ugly, but it made the interpreter much simpler.
(Side note, the C64 interpreter was not named SPUTM, that name didn’t come about until the PC version).
One of the goals I had for the SCUMM system was that non-programers could use it. I wanted SCUMM scripts to look more like movies scripts, so the language got a little too wordy. This goal was never really reached, you always needed to be a programmer. :-(
Some examples:
actor sandy walk-to 67,8
This is the command that walked an actor to a spot.
actor sandy face-right
actor sandy do-animation reach
walk-actor razor to-object microwave-oven
start-script watch-edna
stop-script
stop-script watch-edna
say-line dave "Don't be a tuna head."
say-line selected-kid "I don't want to use that right now."
if (melt-down) {
say-line selected-kid "I don't think this game is very fun."
}
There were no functions, everything was a ‘script’, a small piece of code that looked a lot like a function, but it ran in it’s own virtual process.
script watch-clock {
do {
object clock state ON
break-time 60
object clock state OFF
break-time 60
}
}
Note the lack of a until/while on the do loop. The script would just continue until someone killed it.
Time was always measured in jiffies (1/60 second). Later on I added the ability to say ‘break-time 1 minute’ and the compiler just multiplied by 60 before emitting the opcode.
If you did…
start-script watch-edna
start-script clock-tick
…you now had 2 additional scripts running and they all ran at the same time using preemptive multitasking. It was a heck of a lot better than doing state engines. If you wanted to keep an eye on something, you’d just say…
start-script watch-edna
…and then forget about it. That one script could do whatever it needed and start a cut-scene if the need arose.
This may seem pretty tame today, but back then, it was like magic.
Bonus information: The SCUMM compiler was written in Yacc and Lex.