dx_lib32 Project

A game framework for Visual Basic 6.0... made in Visual Basic 6.0 and powered with DirectX 8.1.


Date Start 07 August 2001
Date End 08 October 2009
Role Programmer
Technologies Visual Basic 6.0, Win32 API, DirectX, DirectX 7, DirectX 8.1, FMod 3.6, OGG Vorbis, Doxygen, Inno Setup
Platforms Windows
Genre 2D, Game Framework

One of my most important projects in this portfolio and one which I learned a lot of coding practices and deep kwnoledge of Windows APIs and Visual Basic 6.0 full capabilities. A game framework to develop “real” games with Visual Basic 6.0 and DirectX.

The history

After tried to develop a couple of games in Visual Basic 6.0 (The Light Star’s Adventure and T.L.S.A: Argos Operation) using the built-in controls based on GDI API, and after a year learning game development on a specialized and popular game engine for MS-DOS, DIV Games Studio 2, I decided to search in internet for third party OCX controls and ActiveX libraries designed with game development features for Visual Basic 6.0 (sprite rendering, basic audio mixer, advanced input, etc…), and in fact, I found a lot of them in several forums related with this language and the game development fever of these days.

After tried some of them with a several limitations I took the decision to start to learn how to develop with the DirectX APIs thanks to the official Microsoft support through the DirectX 7 for Visual Basic Type Library, an official DirectX 7 API interface library for Visual Basic 6.0, shipped with the Microsoft DirectX 7 SDK, and try to design and develop a little framework that replicate in Visual Basic 6.0 most of the features I learned with DIV Games Studio 2.

In 2002, after a year of development and with the limitations of the DirectDraw7 renderer and after tried to improving it using Direct3D7 Inmediate Mode to bring effects like transparencies or rotations, I jumped to DirectX 8.1 (the latest version supported in Visual Basic 6.0) and abandoned the goal to replicate the DIV Games Studio 2 features to start to design an own implementation and features.

The first public version, dx_lib32 1.3, was release in 2004, shipped with sample programs but without any documentation, only the official forums in the main game development comunity in Spain, Stratos-AD.

In 2006 dx_lib32 2.0 was released as major update, more stable, with a large list of improvements, new features and bugfixes, with new and more simple sample programs, in Visual Basic 6.0 and Visual Basic .NET, and a fresh documentation in Microsoft Compiled HTML format (*.CHM), created with a port of Doxygen for Visual Basic 6.0, with full API documentation, article pages describing some features and a glosary of terms.

The last compiled version was dx_lib32 2.2.0, released in 2009, and in 2012 I published the sources of dx_lib32 2.2.1 in GitHub under GPL licence. Since 2009 I discontinued the development in favor of modern options like .NET Framework, C# and XNA Framework.

The project

dx_lib32 is a single ActiveX DLL library composed of 5 specialized classes that works as APIs:

  • dx_Gfx: The graphics API based on Direct3D, with a powerfull renderer for sprites, primitives (points, lines, circles, boxes, complex poligons…) and texts with True Type Font support, with support for basic sprite transformations for scaling, rotations, mirroring, texture filters, color effects, advanced filters (alpha blending operations, inverse colors, xor colors, grey scale, crystal effect) and advanced features like dynamic vertex lighting and sprite projections to able render in isometric or oblique projections (e.g.: like classic Prince of Persia).

  • dx_sound: The audio and music API based on DirectSound, with a simple to use multicanal sound mixer, with support for basic sound effect filters (chorus, compressor, echo, distortion, flanger, gargle, waves reverb), support for CD audio playback, audio record from microphone, and simple music player, based on DirectShow, to support formats like MP3 or WMA or even OGG Vorbis (if the codec is installed), with multicanal support (2 channels) to able create fading transitions between 2 music sequences or any mixing that you want.

    A curious fact: dx_lib32 1.3 audio implementation was based on FMod API instead of DirectSound and DirectShow.

  • dx_Input: The game input API based on DirectInput and Win32 API, to bring a complete support for keyboard and mouse management, and access to joystick support.

  • dx_Video: The video playback API based on DirectShow, offering a simple way to play videos in several formats, from AVI and WMV to MPEG if the codecs are installed.

  • dx_System: A helper API with a mixture of features like math functions, timers, file management, INI File support, debug features, Windows Registry functions, basic cryptographic functions, or PAK File Format support (the uncompressed package container file format used by Quake and Half-Life engines to distribute the game assets and updates).

dx_lib32 was designed exclusively for Visual Basic 6.0 in mind, but thanks to the COM/ActiveX interface is supported by Visual Basic .NET, C# and even C++ or any language with COM/ActiveX support.

This library has been designed initially to work in Windows 98 and later in Windows XP, but thanks to his minimal and core dependencies (Visual Basic 6.0 runtime, DirectX 8.1 ActiveX library and a subset of core Win32 APIs) is supported in all Windows versions, from Windows 98 to current Windows 11, without require any change on original code. In fact, today is possible to run compiled games from Windows XP in Windows 10 or Windows 11 without any special setup.