| |
| |
Introduction | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Algorithms | |
| |
| |
Summary | |
| |
| |
| |
Repetition: Looping Statements, Data Sequences, and Arrays | |
| |
| |
Understanding Looping Statements | |
| |
| |
What Is a Loop? | |
| |
| |
Using Looping Statements | |
| |
| |
FOR...NEXT | |
| |
| |
DO...LOOP | |
| |
| |
REPEAT...UNTIL | |
| |
| |
WHILE...ENDWHILE | |
| |
| |
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 | |
| |
| |
Arrays | |
| |
| |
What Is an Array? | |
| |
| |
Testing Arrays-The BouncingBall Program | |
| |
| |
Arrays of User-Defined Types | |
| |
| |
Summary | |
| |
| |
| |
Number Crunching: Math Operators and Commands | |
| |
| |
Mathematical Operators | |
| |
| |
Addition | |
| |
| |
Subtraction | |
| |
| |
Multiplication | |
| |
| |
Division | |
| |
| |
Exponentiation | |
| |
| |
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 | |
| |
| |
Tangent | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
2D Actors: Basic Sprite Commands | |
| |
| |
Introduction to Sprites | |
| |
| |
Transparency | |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Music | |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
Landscaping: Building 3D Terrain Using Matrices | |
| |
| |
Using Bumpy Terrain | |
| |
| |
Following the Contour | |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
| |
Battle Checkers | |
| |
| |
Getting to Know Battle Checkers | |
| |
| |
Building the Game's Source Code | |
| |
| |
Declarations | |
| |
| |
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 | |
| |
| |
Summary | |
| |
| |
Epilogue | |
| |
| |
| |
Appendices | |
| |
| |
| |
ASCII Chart | |
| |
| |
| |
Recommended Books and Websites | |
| |
| |
Index | |