You have the freedom to change the ScriptEase patterns in so many ways… In effect you have the full power to write a computer program, which can do whatever you want, without having to deal with the syntax, the minutiae, the detail of writing a program.
- Duane Szafron, Professor of Computing Science, University of Alberta
Members of the ScriptEase team include Duane Szafron, Robin Miller, Maria Cutumisu, Jeff Siegel and Curtis Onuczko (pictured above) as well as Jonathan Schaeffer, Mike Carbonaro (Associate Professor of Education), Alan Schumacher (B.Sc. intern) and Kevin Waugh (B.Sc. student).
You wake up in a strange inn. Your back is soaked with sweat, and your eyes are swimming with spectres from the nightmare that woke you up. You blink. At the foot of your bed, a scowling, pointy-headed creature with ash-coloured skin hunches over your weapons chest. It’s an evil elf! You spring from the bed and kill him swiftly with your bare hands, and you’re still standing over his body when the innkeeper’s daughter arrives.
This scenario is the beginning of one of many adventures to be had in Neverwinter Nights (NWN), a fantasy computer role-playing game (CRPG) from Edmonton-based game company BioWare.
Creators of games like NWN need to both write stories and program the stories into the game. To program the stories into the game, you must be fluent in the computer language the game was written in. In game companies, writers who don’t know how to program hand their stories over to programmers who then program the stories into the games.
“Nowadays more and more authors are actually not programmers; they’re writers,” says Duane Szafron, a professor of computing science at the University of Alberta (U of A). “If they have to haul a programmer in every time they have an idea for the game, there’s a time efficiency loss, and there could be a loss of translation in terms of what the author wants to have happen in the game and what the programmer programs.”
In 2001, Szafron, along with Jonathan Schaeffer, another professor of computing science, and a team of U of A researchers, started seeking a solution for these game programming woes and others. The result is ScriptEase, a program that allows people to write and program NWN adventures without knowing the game language, NWScript.
ScriptEase enables non-programmers to quickly write and program a new NWN adventure by selecting and altering four types of patterns: encounter patterns, behaviour patterns, plot patterns, and dialogue patterns.
“We realized that in CRPGs there are patterns that happen all the time, certain little idioms that occur over and over again. And we realized… that we could take these idioms and automatically generate code for these so that the game author wouldn’t have to write any,” says Szafron.
For example, remember the weapons chest from the opening scenario? A chest full of bounty is a common idiom in CRPGs, says Szafron. Removing something from a chest often causes something else to happen, like a guard attacking you.
The results of setting the options of the "Container disturb - specific item" encounter pattern in ScriptEase.
To accommodate this common pattern, the ScriptEase team created an encounter pattern called Container Disturb (Specific Item). If you want to create a special chest, all you have to do is select this pattern and modify it according to your needs.
The ScriptEase researchers have identified and developed more than 100 patterns. “When game authors write computer games, they use these patterns all the time, but they don’t think of them as patterns,” says Szafron. “Instead, every time they want something to happen when an item is removed from the chest, they have to write (fresh) scripting code.”
Does ScriptEase stifle creativity by breaking down human ideas into pre-cut patterns? Szafron emphatically says no. “You’re not done when you pick the pattern and set a couple of options. You have more power. You can adapt the pattern in much richer ways; you can totally change the pattern. In fact, you could turn a pattern into a different pattern.”
ScriptEase’s reliable, automatically generated code also reduces human error, says Maria Cutumisu, a PhD student completing her thesis on ScriptEase behaviour patterns. “(When using ScriptEase), you don’t have to manually script anything, so you cannot make mistakes like when you write code manually.” Getting a number or a letter wrong while programming manually can cause errors or create an unintended effect in the game, she adds.
The research team is also finding that ScriptEase could have several useful applications beyond the commercial game world. The team is exploring the educational value of high school students learning to write interactive stories with ScriptEase. The researchers have also experimented with the potential for teachers to use ScriptEase to write educational games. ScriptEase has the power to transform NWN into an entirely new game, although the new game would have the same graphics and “look” as NWN.
While ScriptEase is a powerful program, it is designed specifically for NWN and can only be used with that game. To adapt it to another game you would have to replace and rewrite roughly a quarter of the 70,000 lines of Java code. And currently, game companies do not typically use programs like ScriptEase to write their games faster—instead they do it the time-consuming, old-fashioned, manual way.
But both Szafron and Curtis Onuczko, a master’s student completing his thesis on ScriptEase plot patterns, anticipate a time when this will change.
“The game companies (told) us they have a huge bottleneck,” says Szafron. “The bottleneck is not in designing better graphics or rendering algorithms. The bottleneck is in getting the content into the games quickly enough… It now takes usually over a year to do a full, quality commercial game, just like it takes a year to make a movie.”
“Anything you can do to speed up content generation is a huge win for the gaming industry,” Onuczko says. “All it might take is one popular game to come out that is written using patterns, one really good commercial game.”
Article and photo by Erin Ottosen, 2007.