Crystal Space 3D

In 2001, revenue from the sales of video games exceeded $9 billion, a new record. By the end of October 2002, sales of video games had already surpassed $6 billion, and was expected to eclipse $10 billion by year-end, setting yet another record (a final revenue tally for 2002 was not available as we went to press).

This month, Linux Magazine, in partnership with SourceForge.net, launches a new, regular column called “SourceForge.net’s Project of the Month.” Each month, this column will highlight one of the many innovative Open Source projects hosted on SourceForge. Stay tuned to this column to discover new software, meet the coders behind the code, and learn how you can contribute to the Open Source cause.

By the way, this column does not replace Linux Magazine’s popular, hands-on, “Project of the Month” feature. The former “Project of the Month” column has simply been renamed “Do It Yourself,” and appears on page 12. “Do It Yourself” will continue to bring you clever, hands-on projects guaranteed to make your Linux life better.

In 2001, revenue from the sales of video games exceeded $9 billion, a new record. By the end of October 2002, sales of video games had already surpassed $6 billion, and was expected to eclipse $10 billion by year-end, setting yet another record (a final revenue tally for 2002 was not available as we went to press).

While video games have steadily gained popularity since Pong was first released in 1972, recent advances in graphics hardware and software have made games more exciting than ever. Whether you’re into fragging (Unreal), grinding (Tony Hawk Pro Skater), incanting (Baldur’s Gate), or full-scale invasion (Medal of Honor), the graphics of the latest generation of games magically transport you to other worlds.

At the heart of an advanced game is a 3D “engine” that translates abstract, geometric models into the images you see on screen. (Hardware is often used to accelerate the engine.) Most engines are proprietary: if you want to write a game of your own — the next Doom, for example — you’d have to create your own engine. That’s quite an onerous task.

Jorrit Tyberghein, 33, and Eric Sunshine, 35, are the project managers for Crystal Space. Jorrit, who is also the founder of the project, lives in Belgium; Eric lives in the U.S. Linux Magazine Editor Martin Streicher and SourceForge.net Site Director Pat McGovern recently interviewed the two programmers to find out what makes them and their project tick. Here’s their story.

How did you get involved with Crystal Space?

JORRIT TYBERGHEIN: Around January 1997, I saw Doom and Quake, and I didn’t understand how the games worked. So I started doing research on the Internet. Crystal Space was born out of that research. The project was first published on the Internet in August 1997. We’ve been hosted on SourceForge since December 1999.

ERIC SUNSHINE: Originally, I was porting the project to several different platforms (NextStep, OpenStep, Rhapsody, MacOS/X, and BeOS). Creating these ports highlighted numerous, inflexible, monolithic, and poor designs that made porting onerous. Many of the problems arose naturally from the fact that the majority of the contributors to the project at that time had seen it simply as a Quake clone. They were intent merely on matching the features and design of Quake or other similar games. My view, on the other hand, was that the project should be a generalized 3D development kit useful for many 3D visualization tasks. Furthermore, the kit should not impose a particular design on developers. Consequently, as an outgrowth of my porting work and the desire to simplify future ports, much of my subsequent effort has been directed toward the goals of modularizing, generalizing, abstracting, and normalizing the project.

What makes Crystal Space unique?

TYBERGHEIN: Crystal Space is very modular, and a large part of Crystal Space could be used for any kind of application. Crystal Space is also Open Source. Comparable engines are usually proprietary or have some other restriction making them unsuitable as Free Software. Crystal Space is also very portable and is very actively developed. There are improvements almost every day.

Who should use Crystal Space?

SUNSHINE: The project is suitable for anyone requiring 3D rendering of at least game-quality. While game developers are certainly the most abundant audience, we try to keep the design and API as application-independent as possible. Crystal Space itself has no game-specific features. As an example of its suitability for larger audiences, the Virtual Object System project (http://interreality.org) is an interesting example of a non-game project that leverages Crystal Space as a visualization tool.

Who are the lead developers?

TYBERGHEIN: This varies wildly from time to time. Some notable developers at the moment are: F. Richter, who does various clean-ups here and there; Anders Stenberg works on the OpenGL renderer and landscape engine; Marten Svanfeldt and Philipp Aumayr also work on the OpenGL renderer; and Norman Kramer works on various parts of Crystal Space. Philip Wyett maintains the Windows code base.

SUNSHINE: In addition to Jorrit’s list, I should mention some past developers of note: Andrew Zabolotny created or heavily augmented several key facilities currently in use, such as the software renderer, makefile system, virtual file system, shared class facility, and the Crystal Space windowing system; Wouter Wijngaards created the particle effects systems and isometric engine; Christopher Nelson created an alternate windowing system and the “large” terrain engine; Martin Geisse did various cleanups and improvements and implemented some of my re-designs of inflexible and monolithic facilities when I was too busy to implement them myself. Thomas Hieber coded the Quake map converter.

What’s been your greatest challenge?

SUNSHINE: As with any Open Source project, finding and retaining well-rounded, well-versed, and committed developers for the long-term can be a challenge. It’s important to keep in mind that, with volunteer projects of this nature, you can’t order people to do some work or to finish what they started. Furthermore, the majority of contributors are interested in only one or two small facets of the project and focus exclusively upon those areas, sometimes without regard to the impact on the overall project. Consequently, and unfortunately, there are times when portions of the project must be jettisoned for lack of utility, completeness, or cleanliness.

On the other hand, the project has been fortunate enough to find several willing long-term developers who have contributed a good deal of quality work. Additionally, because of the open and friendly atmosphere, and as a result of open communication, we’ve also had success with several short-term contributors.

TYBERGHEIN: Making sure all of the developers follow the design principles for Crystal Space, and keeping the documentation up-to-date. I think we succeed rather well in the former area, but only moderately well in the latter.

Has Crystal Space been well-received?

SUNSHINE: Yes. Game development is of great interest to a lot of game players, and Crystal Space provides a powerful, free, Open Source framework for people to create their own games. Other important factors include the open and friendly atmosphere, encouragement for contributors, responsiveness to problem reports (though there are times when we could improve in this area), very active development, and a committment to quality. Jorrit’s easy-going nature coupled with my advocacy for more structure and insistence upon correctness seems to work out well.

TYBERGHEIN: I agree. It manages to do what many people want it to do: provide a framework for making 3D games. Crystal Space may not be the easiest beast to get used to, but we have a good community, and problems are usually fixed very quickly.

What’s been accomplished recently?

A screen from Planeshift, a 3D game based on Crystal Space

TYBERGHEIN: These are the most recent important accomplishments: we transitioned to XML for our map format; we introduced smart pointers to make reference counting easier (this used to be one of the big problems in Crystal Space); and the effects system uses some of the new features of newer 3D cards — this is currently being redesigned, however. We’ve made huge optimizations for big levels. One of the biggest projects using Crystal Space is PlaneShift (http://www.planeshift.it) and they are pushing Crystal Space to its limits. Recently, we also added a new physics plugin based on the ODE library (http://q12.org/ode/ode.html).

Upcoming important events include a rewrite of the renderer to leverage future 3D cards, adding more features and optimizing performance of the landscape engine, and adding more support for dynamic loading or delayed loading.

Where do you see the project going?

TYBERGHEIN: At the moment, we’re doing a lot of work on support for the latest brands of 3D cards (from NVIDIA and ATI). That means support for vertex shaders — special effects like bump mapping, per-pixel-lighting, and shiny surfaces — and other features of those cards. This work has a rather big effect on Crystal Space as the current rendering system predates those features and isn’t actually able to make good use of them. So we’re hard at work redesigning stuff. My (relatively) short term goal for Crystal Space is to make it compete with commercial alternatives. We’re already making good progress, but we still have a lot of work to do.

How can others contribute?

SUNSHINE: We accept practically all contributors, ranging from coders to designers to proof-readers. The atmosphere tends to be very relaxed. As much as possible, we try to ensure quality of contributions through proper discussion, rather than merely rejecting offers.