July 15, 2019
Archives  Features  Dim3: The Making of a Game Engine  

Dim3: The Making of a Game Engine
September 24, 2004 | Mark Satterthwaite

Click to enlarge
Ever since Doom and Marathon all those years ago, gamers on both sides of the Mac/PC divide have been extending games with brand-new content. Back in those early days most used excellent third-party applications like Pfhorte to create whole new worlds for other gamers to experience. To this day the Marathon engine is still being expanded and developed by plenty of good folks as part of the Aleph One project. The sophistication of game engines has continually increased and so has the power of the tools, we have passed from the dark age of WolfEdit through Forge and Anvil to the dawn of Valve’s Worldbuilder and UnrealEd. Unfortunately as time has passed, fewer of the original developers have taken the time to support our beloved platform and port their tools to the Mac. A stalwart few, notably Blizzard and Ambrosia, continue to offer tools with as many of their games as possible, though Mac gamers probably have as few tools now as we did before Marathon Infinity. Still, creative and dedicated members of the Mac community continue to provide superb modifications to the games we are able to edit.

This absence of creative outlet has been noticed by less ‘high-profile’ developers, the first was GarageGames who released Torque. A commercial-grade engine for small indie teams, it contains only the barest bones of an engine. Editing fully built and featured games like Quake could be as simply as creating new models and levels, or as complex as changing the gameplay from an shooter to rally racer. The point is you don’t have to code everything if all you wanted to do was make new worlds.

Dim3 is similar to Torque in that respect, while everything must be controlled and yes, you have to create the controls. But you don’t need to know anything as low-level as C. Dim3, or Dimension3 to give its proper title, has been hand-crafted by Brian Barnes to fill the void for would-be games creators on the Mac.

Brian had a notion that since Mac gamers were doing such great stuff with obsolescent engines designed only for FPS or strategy games, what would they be able to do with an engine designed to cater to their every whim? So he has endeavored to make Dim3 as versatile and flexible as possible while still remaining true to his other fundamental principle: it has to be free to use. From the outset Dim3 has been aimed not at the programmers but at the creatives and content creators who inhabit the Mac platform. So to take away the pain of creating a game with low-level C, it was decided to replace the scripting language with the much more approachable Javascript.

Most games rely upon behavior routines programmed in C, which is a small and quite elegant language, but is certainly not easy to learn nor use for the less technically inclined. To be able to make a game more easily, a less involved way of controlling a game's many assets had to be found. Based on Mozilla’s "SpiderMonkey" Javascript engine, Dim3 offers similar flexibility but without the need to learn quite such a difficult and comparatively low-level language.

If any of you have ever made a program using Apple’s Applescript Studio in Xcode then you will have some idea of how this system works. Everything that is to be controlled in scripts is given a name, sometimes called a tag, so that it can be identified. Each of these objects can then have be used in functions and have its own script. These scripts are executed in response to events in the engine/game or via input devices. As an event happens the appropriate script is called and executed, so in an FPS game clicking the mouse button launches the I/O script which launches another script which fires the characters weapon, a simplification and generalization to be sure but indicative of the process. Scripts permeate throughout Dim3, everything is done in scripts, all the character animation and AI as well as the more mundane input handling so it’s crucial for developers to be given the functions and features necessary to make them work.

Dim3 dutifully provides the basic functions and flags that enable the creation of complex interfaces, AI routines and graphical effects. As for the graphics, Dim3 offers some powerful functionality. First up is the lighting system: lights can be any 24bit RGB and are completely calculated dynamically. This means lights have the ability to mix, move and change on the fly. There are preset behaviors for lights, along with normal consistency (lights can flicker, pulse, fail and more). Lights are fully scriptable and can be attached to object bones, statically to a map or spawned by a script. It’s as good a system as any I have seen and the same ideas and principles were used to power the Doom 3 lighting engine.

Perhaps Dim3’s most advanced graphical feature is its DOT3 bump-mapping which is beautifully exposed by the superb lighting. Bump maps can be applied to the textures of maps or models and will give both enhanced texture and depth (if you have ever witnessed Halo running with full shaders then you have seen what this can do for environments). As for models, the normal-mapping systems employed by Doom 3, Halo 2, etc. are supposedly an advancement on standard bump-mapping, so while Dim3 may not produce such powerful results it should yield a similar effect. Standard texture maps for models and maps are 32bit PNG files with power-of-two sizes. Translucency effects are fully supported, as are animated textures. There is also a full volume based shadow system, which provides accurate and optimized shadows for models. It does not, however, provide self-shadowing, despite it having the capability to do so, as that is nowhere near fast enough. Also Dim3 has its own particle effects system, and like everything else, it is fully scriptable. Developers can create multiple particle effects for a game, which can have their own gravity, direction, growth rate, texture, color and more. Finally maps can be marked by weapons fire or other events, and each can have its own texture and settings.


Archives  Features  Dim3: The Making of a Game Engine