Python DevCenter
oreilly.comSafari Books Online.Conferences.


Python News Humongous Python

by Stephen Figgins

Bruce Dawson, Director of Technology for Humongous Entertainment, recently published a paper he presented at the 2002 Game Developers Conference, "Game Scripting in Python."

Humongous Entertainment is probably best known to children and parents for their adventure and backyard sports games. Previously they used SCUMM, a scripting language and game engine Aric Wilmunder and Ron Gilbert created for Maniac Mansion, when they worked at LucasFilm Games. Gilbert brought SCUMM with him when he co-founded Humongous and Cavedog Entertainment. In exchange, he continued to send updates back to LucasArts. While SCUMM had grown through the years, it was becoming a roadblock to game development for Humongous.

SCUMM was especially well-suited to adventure game scripting, and Humongous's first big hits were their adventure games, with characters like Freddi Fish, Putt Putt, and Pajama Sam. SCUMM wasn't as useful for their Backyard Sports games, like Backyard Baseball or Backyard Football. While this was clear early on, their developers knew the language well and were able to create workarounds. However, the programmers, especially in the sports games, were wasting a huge amount of their time dealing with limitations of the language. With Gilbert no longer working for the company, they decided try something new with their upcoming Backyard Hockey game.

With their upcoming Backyard Hockey game, they wanted to try something new. "We considered developing another custom language," Dawson told me. "We decided we made that mistake once. I see no need to repeat our mistakes. Let's make new and exciting different mistakes this time." They settled on a combination of C++ for intense graphics, resource loading, and physics, and Python for scripting and AI. They were already familiar with Python as a build tool, and several of their developers had experience working with it as well. Dawson wrote in his slide presentation for the games conference, "We started using it and couldn't stop. It was fun!"

Backyard Hockey, coming this fall, will be the first game they ship scripted with Python. While several game companies are now using Python in their games, Dawson says they are one of the few companies using Python as the base language of their game. "In most games, the game itself is written in C++ and they call out to the scripting language for a few triggers or AI events or something. With our games, and the Disney game Toontown, the executable is Python.exe. You boot up with a python script that starts the game, and it calls out the C++ modules to do the heavy lifting, like the graphics and sound. The game logic is written in Python, with the C++ off in the leaf nodes, instead of the reverse, which is much more common." For Backyard Hockey, all of the physics and graphics are in C++, and the AI and menu code is in Python.

To bring C++ and Python together, Humongous developers wrote their own glue code, YAGA. YAGA uses an interface description language (IDL) to define the interfaces. "You decide on an interface, create the IDL, then implement the interfaces you have written in C++," Dawson says. "There have been cases where they have implemented modules in Python, then in C++, and replaced them. To some extent, you can choose at runtime which implementation you want to use." The IDL also make their choice of a scripting language more flexible, as other languages could use YAGA modules as well. They have created several YAGA modules, including graphic, collision, and sound modules. This is all considered a part of their competitive advantage. It is not open source.

They have, however, contributed the HAPS debugger as a GNU LGPL project. Since Humongous develops for both Microsoft and Apple platforms, they needed a debugger that could work with both systems. Previously, this meant the SCUMM debugger had to be portable. For their new system, they decided to create a remote debugger. The debugger consists of an editor and IDE, and an embedded debugging host that communicates with the IDE via TCP/IP. To debug on Macintosh, they will port only the embedded host. Besides keeping development on one familiar system while debugging for multiple platforms, this approach allows them to run the game -- a full screen application -- on a testing system, while debugging the program on a separate development system.

Dawson is very excited about the change to C++ and Python, and the Backyard Hockey team is excited too. I asked him if the change has been difficult, though, moving from a simple scripting language to both C++ and Python. Dawson says that taking that all on at once is challenging, but after that initial transition, it gets easier. He points out that SCUMM is a dead-end language that doesn't train you well for other languages, but Python and C++ are skills you can more easily build upon, and not a career dead-end. Using Python is an all-around win for Humongous Entertainment.

Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.

Read more Python News columns.

Return to Python DevCenter.

Sponsored by: