Many of use have played or at least seen games such as Final Fantasy VII, EverQuest, Diablo, and Warcraft. Even as development geeks, we would have to have been living under a rock not to have seen or played those and similar games. After looking that those games, the raw power, blazing speed, and smoothness of the game play, we turned to our trusty copy of Visual Basic with a decidedly evil grin. (How many times have you seen a program or software package and thought to yourself, I could make one better than that!) Minutes after thinking about it we realize that Visual Basic just flat cannot cut it in terms of multimedia development on the level of those games. Or can it? Until now, aside from the offerings by forward thinking developers like Patrice Scribe, the answer was a resounding NO. DirectX 7 has changed the rules for VB programmers. It effectively ELIMINATES one of the last limitations of Visual Basic.
DirectX is actually a suite of technologies and methodologies that encompasses virtually every aspect of multi-media programming, from games to presentations. This article is an over simplification of DirectX technology. Put simply, DirectX provides a level playing field for working with multi-media applications and hardware. By giving developers a single set of APIs, programmers can concentrate on content as opposed to spending time and resources developing drivers for the plethora of hardware devices out there. DirectX is aimed squarely at Windows 2000, Windows 98, and Internet Explorer.
Through the use of a hardware emulation layer (HEL), DirectX enables you to software-based drivers that act like hardware-based drivers. [Example: Through the use of HEL, you can have real-time 3D worlds that do not require the user to have a 3D Acceleration Card as HEL emulates the functionality required. In addition, the hardware abstraction layer (HAL) uses software drivers to communicate with the various hardware components for sound, video, input, etc. These features combine to provide a robust, if somewhat complicated, development environment.
Visual Basic is introduced to the picture by way of a DirectX Type Library. (vbx7.dll) The Library acts as a translator that makes calls to the core DirectX components. The drawback is that Visual Basic does not DIRECTLY access the DirectX components; it uses the library as a buffer. This can create some performance issues if you compare the same application written in Visual C++ with one in Visual Basic. However, with the speed and power of todays computers, even this distinction is fading fast. You are given access to a set of APIs (application programming interfaces) that control virtually all aspects of a multi-media application. The primary components are:
Direct 3D provides device-dependant access to 3D video hardware in a device-independent manner. Being a low level API, Direct3D is aimed at programmers who wish to port games and multi-media applications to Windows.
DirectDraw allows you to manipulate display memory. It gives you access to display devices while maintaining compatibility with the Windows graphics device interface. One of the strongest features of DirectDraw is that it works with a number of display devices (video cards, monitor, etc.)
DirectInput provides an interface for a wide range of devices such as joysticks, headgear, multi-button mice, and even devices that support force-feedback. This set of APIs work with the device drivers, bypassing the Windows message system.
DirectMusic works with message based musical data converting them into wave tables for use with a software synthesizer such as Microsoft Software Synthesizer. The samples in the wave tables are streamed to DirectSound. Instrument voices are synthesized from samples according to the DLS (downloadable sounds standard.) DirectMusic is ideal in its support for MIDI (Musical Instrument Digital Interface). Based on compositions arranged in the DirectMusic Producer, DirectMusic can compose tracks at run-time.
DirectPlay is the set of APIs that allow you to connect games over modem links, networks, and the Internet. Based on generalized communication capabilities, DirectPlay allows you to efficiently manage connections between hosts and clients.
DirectSound employs hardware acceleration and 3D positioning to provide professional quality audio performance. DirectSound includes voice management and software 3D audio processing algorithms. DirectSound is basically a sound-mixing engine.
DirectShow is the streaming media component of DirectX. It enables the high-quality capture and playback of multimedia streams such as AVI, MP3, and WAV files. With DirectShow you can create DVD Players, Video Editing Packages, Converters, MP3 Players and Encoders, and other video/audio manipulation applications.Whew. DirectX is complicated; you can find a wealth of information including the whopping 180 MB SDK Download at http://www.microsoft.com/directx. In future articles and on my site (www.cason.addr.com) I and several other developed will take you through DirectX 7 development in VB almost exclusively as well as general game design methodologies and programming.