oreilly.comSafari Books Online.Conferences.


Stratagus: Open Source Strategy Games

by Howard Wen

Sometimes calling something free might not make for the best publicity. Such was the case with FreeCraft. This open source project began with much promise — an engine that game developers or hobbyists could use to create real-time strategy (RTS) games for Linux, Windows, and other platforms. It also annoyed game developer and publisher Blizzard Entertainment (renowned for its RTS franchises Diablo, StarCraft, and WarCraft) for two reasons.

First, FreeCraft allowed players to use the assets from their copies of WarCraft 2 to run the game on the FreeCraft engine (and, thus, on a Linux system). Second, its name highly resembled that of StarCraft. The company sent a cease-and-desist letter to the people behind FreeCraft and the project apparently shut down.

In truth, they instead laid low for a while, eventually rechristening FreeCraft as the much better named Stratagus. There are no essential technical differences between Stratagus and FreeCraft — Stratagus continues where FreeCraft left off. The goal of making a customizable RTS engine remains the same, although the designers now de-emphasize compatibility with WarCraft 2.

The Stratagus engine copies the basic, standard gameplay features of the typical RTS game engine. Its developers admit that they implemented the controversial association with WarCraft 2 because it was easier to use the Blizzard game's graphics than to create their own, though they intended this only as a temporary means to make their engine work.

Learning Lab TigerLinux/Unix System Administration Certification -- Would you like to polish your system administration skills online and receive credit from the University of Illinois? Learn how to administer Linux/Unix systems and gain real experience with a root access account. The four-course series covers the Unix file system, networking, Unix services, and scripting. It's all at the O'Reilly Learning Lab.

"FreeCraft's original aim was never limited to emulating Blizzard's games but to create a flexible engine that could be used to build new real-time strategy games," says Russell, the Melbourne, Australia-based lead programmer and manager for Stratagus. (The developers who agreed to an interview for this article requested that we refer to them by only their first names and that we not ask any questions about their project's present legal standing with Blizzard.)

None of the current Stratagus developers were part of the original team who first created FreeCraft. Before it closed from Blizzard's legal threat, the project had already changed hands completely. Russell wasn't involved with FreeCraft at its conception — he came onboard later, sometime before Blizzard sent its cease-and-desist — but he remains committed to it today due to a personal conviction for Linux.

"There is a lack of gaming on the Linux platform. I use Linux exclusively, which leaves me with, basically, no RTS options, which are my favorite games," he says.

Stratagus has come a long way. New and original games such as Magnant and Invasion: Battle of Survival that run on it demonstrate the power of the current engine. It's a project worthy of its own identity.

Magnant (Click image for larger view)

A Configurable RTS Game Engine

Stratagus has many of the same features found in commercially produced RTS game engines. It was actually one of the first RTS engines with the ability to display multiple map views on the screen at once, back in the FreeCraft days. It still lacks, though, in the graphics area. For now, the engine can only display 2D graphics, while the latest RTS titles on the market have 3D graphics.

Still, the main advantage of Stratagus over commercial engines is that players can easily modify games or create their own. Of course, there's both the Linux factor and its cross-platform compatibility, since Stratagus runs on Mac OS X and BSD, too. "One big disadvantage of commercial RTS games is they only provide a Windows version. You will rarely see a commercial RTS game for Linux," points out Nehal, who resides in Vancouver, Canada. He helped to develop the code for the sound and user interface of FreeCraft and contributes to its successor.

Stratagus is written entirely in C with Lua used as the configuration language. External libraries used include gzip, bzip2, and Simple DirectMeda Layer.

Incorporating the ability to run WarCraft 2 on the engine did not require reverse-engineering -- nor was this even necessary to do. The Stratagus developers claim that Blizzard's file formats are well documented on the Web. "As far as the gameplay is concerned, we were never trying to be completely compatible. We added support for features found in their games and in many cases improved upon them," says Russell.

Helping to avoid further issues with Blizzard, a side project supports the creation of graphics and other assets for Stratagus. The Aleona's Tales project invites artists to submit their original work so others can use them for games under development with Stratagus.

Over the course of the evolution of the Stratagus code, from FreeCraft to its present state, keeping the game optimized so games run at an acceptable speed has presented a continual challenge. Adding features to the engine has stressed the engine's performance, especially code for supporting AI, path finding, and larger map sizes. The developers have delayed features such as pixel-based movement and units occupying more than one tile space on the game map solely because they would degrade game performance too much.

Invasion (Click image for larger view)

"Finding a balance between making more things configurable and still maintaining an easy-to-understand configuration is becoming an issue. Every time we make something more configurable, the configuration files get a little bit longer and more complex," says Russell. "Now that we have several games that use the engine, it is becoming increasingly important to minimize changes to the configuration format. One small change can result in a lot of work, so it's important to spend extra time and get the design right."

Real-time Online Gameplay

The big new technology under development for future versions of Stratagus is a meta-server which will enable the engine to connect Internet players to play together. "We intend to add a team play mode where you can share resources and technologies with your allies. [This] will allow for a much better community with features such as online chat and user statistics," says Russell.

On the game development tools side, a new map format is under development to allow for more robust gameplay scenarios. Secondly, the developers plan to rewrite the user interface to achieve a more appealing, unique look.

How to Help

The Stratagus team is open to others interested in helping out, including writing and debugging engine code. They could also use use original graphics and sound effects for games. Documentation is another area in which to make your mark -- the Stratagus configuration files need more documentation and tutorials on how to make games for the engine are always welcome.

If you're interested in using Stratagus to make your own game, contact the Stratagus team. "We would like to make the engine support your game without having you fork the code. We would be willing to work alongside people wishing to do this," he says. "With [our] limited development team, anybody wishing to contribute in this way is most welcome."

However, be aware that it's always a challenge to build a new game from scratch. "It may require time and patience to learn to work with the engine," Nehal says. He points out that many Stratagus game projects have started but never completed.

Perhaps the call for volunteers should also go out to people willing to resume unfinished works. Maybe these incomplete games need the renewed development that comes after a name change.

Howard Wen is a freelance writer who has contributed frequently to O'Reilly Network and written for,, and Wired, among others.

Return to the Linux DevCenter.

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: