How to Program 3D Games in QBasic

Written by darrin koltow
How to Program 3D Games in QBasic
Writing libraries of QBasic 3-D functions makes coding your second game easier. (binary world image by Attila Toro from

QBasic is a programming language made by Microsoft, and is based closely on the BASIC language. QBasic can produce many types of programs, including 3-D games. On step needed to program QBasic 3-D games is to call graphics routines that perform the basic 3-D transformations of movement, rotation and scaling on objects. An optional step is transforming the camera, which is the viewpoint through which the game's player sees the 3-D scene. You can use the 3-D programming skills you learn by making a 3-D QBasic game to make other graphics-intensive programs, like computer aided design applications.

Download an open source 3-D game written in another language. Example 3-D programs include Rigs of Rods and Cube 2. Studying an open source 3-D QBasic game would entail less work. However, few such programs exist.

Make printouts of all source files in the game, then manually trace through the program from its starting function to its end. Tracing through a program means to write down all variables you encounter and their values as they change from statement to statement. To help you learn how to step through a program, use a debugger for the language the game was written in. C++ debuggers are available from Open Wacom and Microsoft Visual C++ Express. Repeat this step a minimum of ten times. Completing this step will teach you how the game works, which you'll need to know before translating the game to QBasic.

Write the QBasic equivalent for each statement in the game's source. For example, the QBasic "REM" statement is the equivalent of the C++ comment syntax "/ /". And the "Do While...Loop" structure in QBasic is equivalent to the Java and C++ loop structure "for (i=0;i<n; i++) { /statements/.".

To learn other QBasic equivalents for statements in other languages, read the syntax specification for QBasic in the documentation that came with your QBasic editor. Read also the syntax specification for the game's original language. The Java language specification is on Sun's "Java Language Specification" page. You can read The C++ language specification on the home page of David Adams, a manager with the federal subatomic particle project ATLAS.

Run the finished QBasic translation of the original game, and fix any errors in it using your editor's debugging tools

Make small changes to the game, such as changing string and numeric constants.

Write the code for effecting larger changes, such as the appearance or behaviour of characters and obstacles.

Play the revised game.

Things you need

  • QBasic

Show MoreHide

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.