Skip to content

DarkBASIC Pro Game Programming

Spend $50 to get a free DVD!

ISBN-10: 1598632876

ISBN-13: 9781598632873

Edition: 2nd 2007 (Revised)

Authors: Jonathan S. Harbour, Joshua R. Smith, Smith Joshua R.

List price: $59.95
Blue ribbon 30 day, 100% satisfaction guarantee!
Out of stock
what's this?
Rush Rewards U
Members Receive:
Carrot Coin icon
XP icon
You have reached 400 XP and carrot coins. That is the daily max!


Learn to write 2D and 3D games without any programming experience by harnessing the advanced 2D/3D graphics features of DarkBASIC Professional! Bring the "fun factor" back into game programming and let DarkBASIC Pro handle all the game mechanics behind the scenes--an easy-to-use language with powerful features. Create self-contained executable games with the graphics and sound files stored inside the exe file. No DarkBASIC runtime library is needed: compiled programs are self-contained and require only that DirectX is installed. Finally, a book for complete beginners who want to learn to write games! Revives the language that most game programmers started with: BASIC.
Customers also bought

Book details

List price: $59.95
Edition: 2nd
Copyright year: 2007
Publisher: Course Technology
Publication date: 9/7/2006
Binding: Mixed Media
Pages: 616
Size: 7.50" wide x 9.00" long x 1.30" tall
Weight: 2.750
Language: English

Jonathan S. Harbour is an associate professor at the University of Advancing Technology (Tempe, AZ). His web site at includes an online forum and blog for book support. His most recent game projects are Starflight - The Lost Colony ( and Aquaphobia: Mutant Brain Sponge Madness (

Joshua R. Smith is a full-time professional game developer at Semi-Logic Entertainments in Palo Cedro, California. He has worked on several commercial games, such as Real War and Hot Wheels: Stunt Track Driver 2. Joshua is an avid C programmer but finds BASIC intriguing. He is currently living in Redding, California. In his spare time, he enjoys playing video games and spending time with his wife.

The Basics of Computer Programming
Introduction to Computer Programming with DarkBASIC Professional
DarkBASIC Professional
What Is DarkBASIC Professional?
Who Created DarkBASIC?
Windows and DirectX
Your First 3D Program
Your First 2D Program
Your First Game
The Importance of Commenting Code
DarkBASIC Hides the Complexity
Features of the DarkBASIC Language
System Requirements
No Runtime Required
BASIC Graphics
BASIC Commands
Programming Basics: Variables, Data Types, and Scope
Short Course on Programming
What Is a Computer Program?
Solving Problems
Three Steps to Solving Logical Problems
Video Game Basics
Why Do We Play Video Games?
The Game Engine
Writing Some DarkBASIC Code
The "Hello World" Program
Commenting Your Code
Starting and Stopping the Program
Understanding Variables
What Is a Variable?
Variable Notation
Data Types
Variable Scope
More Variables: Strings and User-Defined Types
Programming Strings
Declaring Strings
Assigning Values to Strings
Copying Strings
String Conversion Commands
String Manipulation Commands
Printing Text on the Screen
Font Commands
Font Size Commands
Text Style Commands
Text Transparency
User-Defined Data Types
Defining Your Own UDT
Using a UDT
Nested UDTs
Program Logic: Branching Statements, Functions, and Algorithms
Introduction to Program Logic
What Is a Branching Statement?
The Key to Program Logic
Making the Program More Useful
Branching Statements: Decisions, Decisions
The IF...THEN Statement
The IF...ELSE...ENDIF Statement
Dividing and Conquering with Functions
What Is a Function?
Using Functions
Divide and Conquer
Returning Values
Testing Parameters and Return Values: The Return Value Program
Writing Your Own Functions
Advanced Logic Programming: Algorithms
Short-Circuit Logic
Repetition: Looping Statements, Data Sequences, and Arrays
Understanding Looping Statements
What Is a Loop?
Using Looping Statements
Introduction to Data Sequences and Arrays
Keeping Track of Data
Storing Data Efficiently
Data Sequences
The DATA Statement
The READ Command
Testing Data Sequences: The ContactData Program
The RESTORE Command
What Is an Array?
Testing Arrays-The BouncingBall Program
Arrays of User-Defined Types
Number Crunching: Math Operators and Commands
Mathematical Operators
Relational Operators
Equal To
Not Equal To
Less Than
Greater Than
Less Than or Equal To
Greater Than or Equal To
Basic Math Commands
Square Root
Absolute Value
Converting Decimal to Integer
Exponent (Raising to a Power)
Random Numbers
Creating Random Numbers
Seeding the Random Number Generator
Reading the Date and Time
Getting the Current Date
Getting the Current Time
Higher Math Commands
Sine and Cosine
Reading and Writing Data: File Input/Output Commands
Introduction to File Input/Output
Drive and Directory Commands
Getting the Current Directory
Printing a List of Drives
Printing a List of Files
Changing Directories
Getting the List of Drives
Getting the List of Files
Creating and Deleting Folders
Introduction to Files
Reading and Writing Files
File Access Modes
Basic File Commands
Searching for Files
Getting Detailed Information About Files
File Management
File Input/Output Commands
Opening and Closing Files
Reading and Writing Integers
Reading and Writing Bytes
Reading and Writing Words (2 Bytes)
Reading and Writing Longs (4 Bytes)
Reading and Writing Floats
Reading and Writing Strings
Writing Your Own File
Using the Clipboard
Reading from the Clipboard
Saving to the Clipboard
2D Game Programming
Introduction to 2D Graphics: Basic Vector Drawing Commands
Graphics in Abundance!
Behind the Magic
Pixels and Resolution
Bits, Bytes, and...Polygons?
Double Buffering
Drawing Commands
DirectDraw versus Direct3D
System and Video Card Commands
Graphics Card Commands
Transform and Lighting Commands
Memory Commands
The CheckSystem Program
Display Mode Commands
Reading and Setting the Display Modes
Display Mode Properties
The DisplayModes Program
Basic Graphics Programming
Changing the Drawing Color
Clearing the Screen
Reading and Setting Pixels
Drawing Lines
Drawing Rectangles
Drawing Circles
Drawing Ellipses
Bitmapped Graphics: Bitmaps and Images
Introduction to Bitmaps
What Is a Bitmap?
Bitmap File Formats
Creating Bitmaps
Uses for Bitmaps
Creating and Loading Bitmaps
Loading a Bitmap File
Creating a New Bitmap in Memory
Checking the Status of a Bitmap
Loading a Bitmap
Bitmap Information Commands
Determining the Width, Height, and Color Depth
The BitmapInfo Program
Basic Bitmap Commands
Copying One Bitmap to Another
Changing the Current Bitmap
Saving a Bitmap to a File
Deleting a Bitmap
Special Effects Commands
The Bitmap Mirror Effect
The Bitmap Flip Effect
The Bitmap Fade Effect
The Bitmap Blur Effect
The Bitmap Gamma Effect
ImageShuffle: A Complete Bitmap-Based Game
2D Actors: Basic Sprite Commands
Introduction to Sprites
Creating and Loading Sprites
Grabbing Sprites Out of a Bitmap
Loading a Sprite Image Directly
Drawing a Sprite
Sprite Properties
Drawing and Moving Sprites
Drawing a Sprite
Setting Sprite Rendering Properties
Making Sprites Visible or Invisible
The All-Powerful Game Loop
Creating a Game Loop
Game Timing Commands
Getting the System Time
Refreshing the Screen
Starting Work on Darkanoid (Your First Complete Game Project)
Current Development Goals
The Source Code
2D Acting: Sprite Animation
Animated Sprites
Drawing Animated Sprites the Hard Way
Drawing Animated Sprites the Easy Way
Creating and Editing Sprites Using Pro Motion
Manipulating Sprites: Rotation and Scaling
Using Pre-Rotated Sprite Sheets
Rotating Sprites on the Fly
Resizing Sprites on the Fly
Darkanoid: The Continuing Saga
Updating the Level Data
New Sprite Constants
Creating the Paddle, Ball, and Block Sprites
Drawing the Blocks
Moving the Ball
Moving the Paddle
2D Game Physics: Sprite Collision Testing
Detecting Sprite Collisions
Types of Collisions
Collision Commands
The Collision Test Program
Darkanoid Revisited
Adding a New Sprite Structure
Modifying the Global Variables
Building Blocks
Moving the Ball
Moving the Paddle
Getting Input: Keyboard, Mouse, and Joystick Commands
Introduction to User Input
Keyboard Basics
Mouse Basics
Joystick Basics
Keyboard Commands
Reading Text Input
Reading Key Presses
Reading Special Keys
Reading Multiple Keys and Scan Codes
Non-Blocking Input
Mouse Commands
Hiding and Showing the Mouse
Mouse Position
Mouse Movement
Mouse Buttons
The Mouse Handler
Joystick Commands
Analog versus Digital Input
Joystick Position
Joystick Movement
Joystick Buttons
Joystick Sliders
Joystick Hat and Twist Commands
Defining Control Devices
Getting a List of Joysticks
Setting the Control Device
Control Device Position
Force Feedback
Programming Force Feedback
Standard Force-Feedback Commands
Special Force-Feedback Commands
Using the Force
Game Audio: Sound Effects and Music
Sound Effects
Sampling Rate
The Wave Sound Format
Loading Sound Files
Playing Sound Files
Panning and Volume Control
Sound Buffer Properties
3D Positional Sound Playback
Changing the "Listener" Position
Setting the Mood for the Game
Loading Music Files
Playing Music
Music Playback Properties
Enhancing Darkanoid
Multiple Game Levels
Variable Declarations
Initializing the Game
The Game Loop
Drawing the Blocks
Loading the Levels
Rebounding the Ball Realistically
Rebounding off the Blocks
Drawing Explosions
Moving the Ball
Tracking the Ball in Pause Mode
Moving the Paddle
Checking for Collisions
Launching Powerups
Moving the Powerups
Creating Explosions
2D Game Worlds: Level Editing and Tile-Based Scrolling
Introduction to Scrolling
A Limited View of the World
Scrolling the Screen
Tile-Based Backgrounds
Backgrounds and Scenery
Creating Backgrounds from Tiles
Creating a Tile Map
Tile-Based Scrolling
Dynamic Tile-Based Scrolling
The DynamicScroller Program
The DynamicScroller Source Code
Advanced Sprite Programming: Alpha Channel Transparency and Angular Motion
Alpha Channel Transparency
Comparing Color Key and Alpha Channel Transparency
Creating an Alpha Channel in an Image
Angular Motion
Fixed Angles of Travel
Free Angles of Travel
Programming Angular Motion
Testing Angular Motion
Playing Intro Movies and Cut-Scenes
Introduction to Movies
Game Cinema
What Is a Movie File?
Loading and Playing Movie Files
Basic Movie Playback Commands
Looping Movie Playback
Changing the Position and Size of a Movie
Changing the Position of a Movie
Changing the Scale of a Movie
Movie Trailers
The PlayMovie Program
3D Game Programming
Fundamentals of 3D Graphics Programming
Introduction to 3D Graphics
Introduction to Vertices
Introduction to Polygons
Basic 3D Graphics Commands
Creating Stock Objects
Transforming and Drawing 3D Objects
The MakeObjects Program
Adding Textures to 3D Objects
Lights, Camera, Action: 3D Lighting and Camera Control
Lighting the Scene
Ambient Light
Directional Lights
Point Lights
Spot Lights
Controlling the Camera
Creating New Cameras
Adjusting the Camera's Position
Pointing the Camera
Testing the Camera Commands
3D Actors: Loading and Rendering 3D Models
Learning about 3D Models
Loading a Mesh File
Drawing a 3D Object
Testing 3D Animation
The AnimateModel Program
The AnimateModel Source Code
Landscaping: Building 3D Terrain Using Matrices
Using Bumpy Terrain
Following the Contour
Multiplayer LAN and Internet Programming
Introduction to Multiplayer Games
Single-Player Versus Multiplayer
Multiplayer Support in DarkBASIC
Packet Transport
The TCP/IP Protocol
Selecting the Correct Transport
Establishing a Network Connection
Creating the Server Path
Establishing the Client Path
Making the Connection
Passing the Data
Getting the Number and Names of Players
Sending Information
Reading Information
Additional Multiplayer Commands
Buffer Size
Net Game Commands
Adding and Removing Players
Memory Blocks
Creating Memory Blocks
Destroying Memory Blocks
Writing Data to Memory Blocks
Reading Data from a Memory Block
Miscellaneous Memory Block Commands
Using Memblocks
Battle Checkers
Getting to Know Battle Checkers
Building the Game's Source Code
Global Variables
Animation Variables
Animation Data
Animation Variables
Checker Board
Game State
Main Functions
Game Loop
Player Moves
Player Jump Attacks
The Mouse Pointer
Selection Box
Valid Moves
Valid Attacks
Artificial Intelligence
Valid Computer Moves
Performing Computer Moves
Creating the Board
Creating the Models
Moving Pieces
Animating Models
Initializing the Game
Creating the Mouse Pointer
Creating the Square/Piece Selector
Recommended Books and Websites