Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesThe Games People Write


December 1995 / Special Report / The Games People Write

Playful advances in Windows 95 make it easier to develop games for Microsoft's new OS

John Montgomery

At last, Windows has been freed from Solitaire confinement. You can now run real games -- action games, shoot-'em-up games, network games, games with video. All this, thanks to Microsoft's Win32 game-development tools. The Game SDK can help create games as fast if not faster than the games we got used to under DOS, game designers say. Not only are they faster, they're easier to develop. According to LucasArts programmer Matthew Russell, "Because the Game SDK provides a layer of abstraction between the game developer and the hardware . . . it's actually easier to do in Windows what we do under DOS, especially for high-resolution graphics ."

Blowing Up Mines weeper

The Game SDK has four main parts: DirectDraw, DirectSound, DirectInput, and DirectPlay. The first three of these APIs provide interfaces that enable programmers to write directly to video, audio, and joystick hardware. DirectPlay makes writing multiplayer games easier. Let's take a look at each.

The DirectDraw services handle graphics functions typical of games, including overlays, stretching, alpha blending, and Z-buffer-aware block-transfer engines ( blters for short). It provides services for managing display memory and hardware, as well as some memory-management features (e.g., allocation).

Architecturally, DirectDraw has two main parts: the DirectDraw hardware abstraction layer (HAL) and the DirectDraw services. Hardware developers write the device-dependent code (either as a video driver or as a separate DLL), one end of which talks to the hardware, the other of which exposes the hardware's functions to the HAL. Software developers write t o the HAL.

When your graphics hardware doesn't support some feature, DirectDraw uses software emulation. To a game, the emulation looks like part of the HAL, so it doesn't need to know that DirectDraw is emulating some functions. This means that a developer can be sure that the same code will run on most video hardware, even if some functions must be emulated. Most games, however, will probably query the hardware to find out what functions it supports, then actually execute differently to make sure performance is optimal.

DirectSound works pretty much the same way: A generic API call passes through a HAL, which turns it into something your audio card can understand. DirectSound exploits accelerated sound hardware, including hardware mixing and sound-buffer memory. Your games don't have to ask specifically for hardware acceleration: DirectSound takes care of it automatically. DirectSound also supports 3-D audio, which is what makes airplanes in games sound like they're flying by from one side to an other.

Like DirectDraw, DirectSound allows software emulation of features your hardware doesn't support. However, when a game loads, it'll probably query DirectSound to figure out what your hardware supports and will then alter its functions to match the audio capabilities of your PC.

The drawback with DirectSound's emulation is that it uses the waveform hardware on your sound card, which poses two problems. First, the emulated sound isn't going to be a perfect match of what the DirectSound HAL could generate. Second, when the emulation layer has allocated the waveform hardware, DirectSound is locked out, and vice versa. (According to Microsoft, the next version of DirectSound should fix this.)

DirectInput is mainly for joystick support , and it's the least complex part of the Win32 Game SDK. According to the SDK documentation, DirectInput is in fact currently just another name for an existing Win32 function called JoyGetPosEx. "The developer is still forced to rely on p rocessing the Windows message queue for keyboard input," says Matthew Russell of LucasArts.

Net Games

Now we come to DirectPlay, the network-enabling part of the SDK. It works with Windows 95 and NT and provides a way for games to talk to each other without worrying about the underlying communication protocols (network or serial).

DirectPlay has two parts: the IDirectPlay interface and the DirectPlay server. IDirectPlay provides methods that enable you to create and destroy players, send messages to players, invite players into games, and so on. DirectPlay servers are basically HALs for networks, on-line services, and modems.

When you run a DirectPlay-enabled game, it talks to the DirectPlay object, which interacts with one of the servers, which talks to the transport. Your game can query the DirectPlay object to find out about the network (e.g., its bandwidth) to adjust the game's requirements.

Once your copy of the game is on the network, it looks for other g ames that have the same globally unique identifier (GUID, which the developer creates and which is unique to each game). Once your copy has found another copy, the game sets about creating players for each individual. Then the game can begin.

Reversi of Fortune

There are two other APIs you may hear about in relation to Win32 games: WinToon and the 3-D tools.

WinToon is a frame-based animation playback system. Microsoft points out that it's a developer toolkit, not an authoring tool. Basically it enables developers to create the foreground movie and the background. But, says Ken Nicholson, director of ATI Interactive, "WinToon isn't that great for games." Performance, he says, is the main drawback. "WinToon is built on top of the graphical device interface, and GDI is slow. GDI is designed to move graphics across the bus," which is too slow for games. Nicholson says most developers will probably find DirectDraw a better tool.

Why? Because DirectDraw lets you get a poi nter directly to video memory and page flip (prepare a screen off screen, then tell the hardware to switch to that screen). It enables you to put your own graphics into the video card's video space, which gives you some extra memory to store graphics. Plus, DirectDraw gives you access to the blter. It can also do transparent blts (it knows how to copy irregular shapes), effectively saying "copy all the pixels that aren't a certain color." WinToon can't do any of that.

The Windows 95 game-development tools also include some extensive 3-D features. If you're developing a game that needs a 3-D engine, you could choose to write to the Reality Lab 3-D API. If you already have an engine, you're more likely to port it to support Direct3D (which behaves pretty much like the other Direct SDK subsystems). Basically, the architecture places the Reality Lab API on top of Direct3D, which in turn talks to the 3-D device driver interface, which is basically the 3-D HAL.

But these 3-D tools aren't going to mean g reat leaps forward for 3-D games. Nicholson explains: "The 3-D hardware that's coming out doesn't do geometry acceleration. Because of that, the types of games are going to be about what you get with Descent, but with better resolution. [The PC is] not going to be a PlayStation. The Pentium just can't do the math to keep them moving."

The Games

So who's creating games? Well, there's id Software, with Doom for Windows 95. Yes, your favorite shoot-'em-up is available for Windows. It runs pretty well, too, if the prerelease version we played is any indicator. Microsoft is also entering the 3-D action genre with Fury3, a game that puts you into the pilot's seat of a fast fighter shooting down enemies left, right, above, and below.

If you prefer both feet firmly on the ground, Accolade's Super Busby for Windows 95 will give you a treat when it becomes available soon. Running at speeds of up to 70 frames per second, Busby gives the DirectDraw architecture a run for its money as this bobcat saves the world from the yarn-craving Woolies.


PRODUCT INFORMATION


DOOM FOR WINDOWS 95...........price not set

id Software
Mesquite, TX
(800) 434-2637
(214) 613-3589
fax: (214) 686-9288


FURY3.........................$44.95

Microsoft
Redmond , WA
(800) 426-9400
(206) 882-8080
fax: (206) 93-MSFAX

http://www.microsoft.com



SUPER BUSBY FOR WINDOWS 95....$26

Accolade
San Jose, CA
(800) 245-7744
(408) 985-1700
fax: (408) 246-1053


Video APIs Under Windows 95

illustration_link (28 Kbytes)

Windows 95's graphics architecture hinges on the unified display device driver, which the video hardware vendor will typically write. One end of the unified display driver talks to the video hardware; the other end exposes the hardware's capabilities to Win 95's various APIs and graphics engines. Most game developers we talked to indicated they would usually write to DirectDraw and Direct3D, with some other calls to higher-level APIs.


A Sidewinder That Doesn't Bite

photo_link (49 Kbytes)

Microsoft's Sidewinder is one of the first digital joysticks. It delivers smoo th performance and has an extremely ergonomic feel.


Playful Advances Make Better Games

screen_link (56 Kbytes)


John Montgomery ( jmontgomery@bix.com ) pilots BYTE's features section.

Up to the Special Report section contentsGo to previous article: Multimedia MasterpiecesGo to next article: I'm GameSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM   Copyrigh
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network