Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Examining the 3D Game Studio Toolkit


Aug00: Programmer's Toolchest

Clayton is a computer consultant in Knoxville, Tennessee. He can be contacted at [email protected].


The 3D Game Studio from Conitec (http://www.conitec.com/a4info.htm) is a Win32-based authoring system for creating interactive 3D applications. The royalty-free package includes a 3D engine, 2D engine, object-oriented scripting language, 3D map editor, actor modeler, game compiler, and run-time module. 3D Game Studio's feature set is diverse enough to allow for the development of anything from third-person games to virtual tours of geographical locations. You can also use it for quick prototypes, nongame applications (such as virtual exhibits), or even 2D applications. 3D Game Studio also includes two editors -- the world editor (WED) and model editor (MED). The WED and MED combination make creating levels, placing lighting effects, and modeling actors a straightforward process. In this article, I'll provide an overview of the 3D Game Studio system, then build a typical three-room world and include actor movements. The scripts that implement this example are available electronically; see "Resource Center," page 5.

Building Environments and Models

Defining a world with WED is intuitive. The editor resembles many popular 3D applications, with top, side, and back views, as well as a 3D preview of the level. The package contains a library of over 800 prefabricated textures, building parts, furniture, vehicles, weapons, and actors, which lets you create many types of virtual environments. Also, you can import file formats from computer games (like Quake), thousands of additional preconstructed levels (MAP files), texture collections (WAD files), and 3D models (MDL or 3DS files), most of which are available on the Internet.

A 3D Game Studio level is an environment that's as simple as a single landscape or as complex as an entire city with stationery and moving parts. Within this space, you can place static objects such as light sources and sound sources that emit 3D background sounds. Three kinds of movable objects can also be placed within the level: models, created using MED and used for actors; sprites, in BMP or PCX format that can be designed with any Windows paint program; and map entities, which can be imported from different 3D file formats including 3D Studio.

The WED uses blocks to build a level. This type of construction is known as "Constructive Solid Geometry" (CSG). Within the editor, you can design various sizes and shapes of blocks which can be added, subtracted, intersected, and merged to create an almost endless supply of geometry.

MED is used to create the models for 3D Game Studio. MED looks similar to the WED in that it shares the same basic top, front, and back views, as well as a fourth view to visualize the model in 3D. It has an easy-to-use interface for basic 3D model editing and animation. The interface also includes a skin editor and painter. The skin editor is used to import skins to display on a model, and lay out skin mapping coordinates that define what areas of the skin are mapped onto which areas of a model. The skin painter is a basic 3D painting utility for adding texture to models. While you could use an external paint program to create skins, the painter has all the basic functions you need to quickly modify the skins for models.

In addition to the bundled tools, there are numerous third-party tools (WorldCraft or Quake Model Editor, for instance) that can be used to fill voids you may find.

Once the environment and models are completed, you set a "marker" for the default start position of a level. The placement of additional map entities and sprites also take place at this stage. As soon as the levels are ready, it's easy to generate file sets and executables for distribution via the Internet or CD-ROM.

The 3D Engine

At the heart of the development system is a 3D engine that runs the application, generates 3D effects, and controls the artificial intelligence of the actors and user interface. The general-purpose A4 3D engine is both fast and flexible. It maps shadows, handles static and dynamic worlds, and creates 2D or 3D objects in real time. Due to a sophisticated three-fold culling algorithm, even huge worlds of 50,000 polygons are rendered without visible frame rate loss. Everything in the engine can be controlled with the World Definition Language (WDL) scripting language, allowing for the creation of artificial intelligence and behaviors for every object in the virtual world.

According to Conitec literature, other engine features include:

  • Six degrees of freedom, true perspective rendering.
  • Blazing fast, even without hardware acceleration.

  • Eight-, 16-, and 32-bit color, up to 1600×1200 screen resolution.

  • Static light sources, 3D sound sources.

  • Shadow mapping, four-level mip mapping.

  • Colored dynamic light sources, colored fog areas.

  • Real-time creation of polygon objects and entities.

  • Semi- and alphatransparency for sprite and flare effects.

  • Huge outside areas with animated sky and backdrop bitmap.

  • Multiple 3D views and customizable cameras for first- or third-person games, side scrollers, split screen, remote, or missile cameras.

  • Support for animated Model (MDL), Sprite (BMP, PCX), and MAP entities.

  • Smooth morphing for model frames.

  • Three-dimensional shape collision detection on fixed and moving world parts.

  • Realistic physics and quaternion-style multiaxis rotations.

  • Three-dimensional objects can be taken or manipulated by mouse in real time.

  • Bitmap particle generators for smoke trails, explosions, tornadoes, and the like.

  • CD audio, MID, and WAV support for music and 3D sounds.

  • Integrated 2D engine renders background pictures, 2D sprites, panels, buttons, sliders, overlays, 2D controls, text, and AVI movie scenes.

  • Multiplayer mode via split screen, modem, network, or Internet.

  • Everything customizable by scripts -- actors, weapons, physics, movement, game behavior, and user interface.

  • Unlimited level change.

  • Console mode for testing or script debugging.

  • Eight-bit mode for low hardware requirements.

The World Definition Language

With the WDL scripting language, you can give the UI and virtual world entities custom behaviors. These custom behaviors are powerful enough to allow for development of anything from an adventure game to a flight or vehicle simulator.

WDL scripting allows control over everything in a 3D Game Studio world -- actors, weapons, vehicles, platforms, effects, traps, puzzles, buttons, menus, and even external I/O devices such as trackers or light shows. Scripts can be attached to every entity, and can be triggered by certain events of the virtual world, like being clicked on, coming within a certain distance to another entity, spotting a player, or whatever you imagine. All language actions and properties follow simple naming conventions, with a syntax similar to C or JavaScript. It's not difficult to pick up the language, and the package includes a large collection of WDL scripts so that you can develop programs using predefined scripts or modifying them as necessary.

Sounds and Multimedia

Because some basic sound and video functionality has been omitted, the multimedia capabilities (or rather, lack thereof) are the main complaint I have with 3D Game Studio. The toolkit automatically handles all detection and configuration of a variety of sound cards without any interaction from you or end users. It also passes joystick, mouse, and keyboard inputs without the need for even a single line of code. In games, sound effects use distance-dependent volume controls. This lets a distant object sound far away, and get louder as you approach it.

In addition to the ability to play spot effects, the toolkit supports MIDI files for background music, and supports the .IBK format for FM-synthesized instruments and drums. Although the toolkit does not support MP3 (depending upon the version you purchase), CD audio music is available.

3D Game Studio currently supports only AVI for video playback. Adding support for MP3 or other compressed audio formats along with options for additional video playback is a must for future developments.

Putting the Engine to Work

To illustrate how you use 3D Game Studio, I'll quickly build a three-room world in the WED, then add an actor that has movement actions.

After opening WED, select New from the File menu, and you are presented four blank window views: Top, Back, Side, and 3D. (It's easier to see what the final output is going to be if you turn the 3D View window to Render with textures.) Next, you add a large cube to Level by selecting it from the Object menu. You then hollow out the square to create an open room. This is done using the built-in Hollow Block command in the Edit menu; see Figure 1.

You copy and paste the square four times, placing it in some form of intersecting room pattern. Figure 2 is the approximate formation of rooms. To create an opening between the rooms, place another cube in the level and locate it where there is a need for an opening.

Once in place, it's easy to remove areas that are intersecting with the newly placed cube. Using another WED built-in command (CSG Subtract) cuts away areas the cube is touching. Repeat this as necessary to create doorways to all the rooms. Next, you place light sources throughout the level, which is done basically the same way as placing the cubes.

After placing three or four light sources, you're ready to preview the Level. Press the Build button from within WED. If you've done everything okay, you'll see a level like Figure 3.

WDL Programming

Once a map has been developed, it's time to delve into WDL. (Note the unique naming conventions used in 3D Game Studio. For instance, instead of calling a "variable" a variable, it's called a "skill.") In the examples presented here, I've placed comments before and after several lines of code. For comments in A4, just use "//" at the beginning of a line or for several lines you can use a "/*" combination to begin and a "*/" to end the comment.

//this is a comment

/* this is a multi

line

comment */

At the beginning of a WDL file, a directory path should be given, and additional WDL files can be included. If you include them, you'll have access to all of their functions from within your level's main WDL file. Each WDL statement or instruction must end with a semicolon. If you forget, you get numerous errors from the engine.

To run a script, place the WDL file into your map using the File/Map Properties/Scripts options from within WED. To create a new script, select New and a default name will appear, such as the name of your level followed by the WDL extension. This is the text file I'll be entering all of the scripts into. It will already have information regarding the basic setups for the level, including built-in WDL templates (to access them, they should be copied to your working directory), supported video displays, and main action. You can use a text editor to view and edit this file.

To display an opening credit splash screen at application start, define that splash screen as a PANEL in the WDL script; see Example 1. The two SKILL definitions state the initial screen resolution of 320×40, and 8-bit color mode. The first three lines of the main action, which is executed at game start, display the splash screen for 16 ticks (approximately 1 second) before loading the virtual world. To run the sample, you must design the splash screen. With a graphics editor, create a file called SPLASH.PCX, scale it to the appropriate resolution, and reduce it to 256 colors.

Again, strings can save text information. Example 2(a) is an example of WDL that creates a string. Example 2(b) displays the string using the Action command. After placing this code into our WDL file, run the WED level by clicking the Build button. This will place you inside your virtual world.

Our next step is to place an actor onto the screen for us to move. Copy the Guard.mdl file (included in the installation of 3D Game Studio) into your work directory. (In fact, it would be a good time to copy the entire prefab WDL files into your work directory if you haven't yet done so.) Place the model somewhere in the level using the WED Load Entity command and right-click on it. Select Properties from the pop-up menu and choose the player_walk action. Figure 4 shows that the move is already available because I placed the prefab WDL files within my directory and used the INCLUDE function to add them to the available actions (actually, by allowing WED to design the basics of my level WDL file, it included this information automatically).

With only a few lines of WDL code, you have a virtual environment complete with a movable guard and a light source. This is just a simple overview of the power behind the A4 engine and WDL scripting language.

Conclusion

3D Game Studio is a powerful piece of software for anyone who wants to write 3D applications. The toolkit provides a complete environment for 3D authoring with only a few minor omissions for audio and video playback options. Another area that should be developed is an open architecture that would allow for plug-ins or some other form of user-developed creation of add-ins.

Although the tools are easy to use, I still wouldn't recommend the kit for novices, since the toolkit does require some programming skills and concepts. Experience in some sort of structured programming language would be advantageous. Still, if you're looking for an excellent toolkit to quickly prototype and develop 3D graphics application, you will definitely want to check out Conitec's 3D Game Studio.

DDJ


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.