All ITKnowledge
Source Code
Search Tips
Advanced Search
Title
Author
Publisher
ISBN
Please Select
-----------
Business & IT Mgmt
Careers
Certification & Training
Database & ERP
Desktop Apps
Graphic Design
General Internet
Hardware & OS
IBM RedBooks
Network & Telecom
Web & Software Dev
-----------
New Arrivals
Tricks of the Windows Game Programming Gurus
by Andre LaMothe
Sams, Macmillan Computer Publishing
ISBN:
0672313618
Pub Date:
09/27/99
Search this book:
Introduction
Foreword
About the Author
Part IWindows Programming Foundations
Chapter 1Journey into the Abyss
A Little History
Designing Games
Types of Games
Brainstorming
The Design Document and Storyboards
Making the Game Fun
The Components of a Game
Section 1: Initialization
Section 2: Enter Game Loop
Section 3: Retrieve Player Input
Section 4: Perform AI and Game Logic
Section 5: Render Next Frame
Section 6: Synchronize Display
Section 7: Loop
Section 8: Shutdown
General Game Programming Guidelines
Using Tools
C/C++ Compilers
2D Art Software
Sound Processing Software
3D Modelers
Music and MIDI Sequencing Programs
Setting Up to Get DownUsing the Compiler
An Example: FreakOut
Summary
Chapter 2The Windows Programming Model
The Genesis of Windows
Early Windows Versions
Windows 3.x
Windows 95
Windows 98
Windows NT
Basic Windows Architecture: Win9X/NT
Multitasking and Multithreading
Getting Info on the Threads
The Event Model
Programming the Microsoft Way: Hungarian Notation
Variable Naming
Function Naming
Type and Constant Naming
Class Naming
Parameter Naming
The Worlds Simplest Windows Program
It All Begins with WinMain()
Dissecting the Program
Choosing a Message Box
Real-World Windows Applications (Without Puck)
The Windows Class
Registering the Windows Class
Creating the Window
The Event Handler
The Main Event Loop
Making a Real-Time Event Loop
Opening More Windows
Summary
Chapter 3Advanced Windows Programming
Using Resources
Putting Your Resources Together
Using Icon Resources
Using Cursor Resources
Creating String Table Resources
Using Sound .WAV Resources
Last, But Not LeastUsing the Compiler to Create .RC Files
Working with Menus
Creating a Menu
Loading a Menu
Responding to Menu Event Messages
Introduction to GDI
The WM_PAINT Message Once Again
Video Display Basics and Color
RGB and Palletized Modes
Basic Text Printing
Handling Important Events
Window Manipulation
Banging on the Keyboard
Squeezing the Mouse
Sending Messages Yourself
Summary
Chapter 4Windows GDI, Controls, and Last-Minute Gift Ideas
Advanced GDI Graphics
Under the Hood with the Graphics Device Context
Color, Pens, and Brushes
Working with Pens
Painting with Brushes
Points, Lines, Polygons, and Circles
Straight to the Point
Getting a Line on Things
Getting Rectangular
Round and Round She GoesCircles
Polygon, Polygon, Wherefore Art Thou, Polygon?
More on Text and Fonts
Timing Is Everything
The WM_TIMER Message
Low-Level Timing
Playing with Controls
Buttons
Sending Messages to Child Controls
Getting Information
The T3D Game Console
Summary
Part IIDirectX and 2D Fundamentals
Chapter 5DirectX Fundamentals and the Dreaded COM
DirectX Primer
The HEL and HAL
The DirectX Foundation Classes in Depth
COM: Is It the Work of Microsoft or Demons?
What Exactly Is a COM Object?
More on Interface IDs and GUIDs
Building a Quasi-COM Object
A Quick Recap of COM
A Working COM Program
Working with DirectX COM Objects
COM and Function Pointers
Creating and Using DirectX Interfaces
Querying for Interfaces
The Future of COM
Summary
Chapter 6First Contact: DirectDraw
The Interfaces of DirectDraw
Interface Characteristics
Using the Interfaces Together
Creating a DirectDraw Object
Error Handling with DirectDraw
Getting an Interface Lift
Cooperating with Windows
Getting into the Mode of Things
The Subtleties of Color
Building a Display Surface
Creating a Primary Surface
Attaching the Palette
Plotting Pixels
Cleaning Up
Summary
Chapter 7Advanced DirectDraw and Bitmapped Graphics
Working with High-Color Modes
16-Bit High-Color Mode
Getting the Pixel Format
24/32-Bit High-Color Mode
Double Buffering
Surface Dynamics
Page Flipping
Using the Blitter
Using the Blitter for Memory Filling
Copying Bitmaps from Surface to Surface
Clipper Fundamentals
Clipping Pixels to a Viewport
Clipping Bitmaps the Hard Way
Making a DirectDraw Clip with IDirectDrawClipper
Working with Bitmaps
Loading .BMP files
Working with Bitmaps
Loading an 8-Bit Bitmap
Loading a 16-Bit Bitmap
Loading a 24-Bit Bitmap
Last Word on Bitmaps
Offscreen Surfaces
Creating Offscreen Surfaces
Blitting Offscreen Surfaces
Setting Up the Blitter
Color Keys
Source Color Keying
Destination Color Keying
Using the Blitter (Finally!)
Bitmap Rotation and Scaling
Discrete Sampling Theory
Color Effects
Color Animation in 256-Color Modes
Color Rotation in 256-Color Modes
Tricks with RGB Modes
Manual Color Transforms and Lookup Tables
The New DirectX Color and Gamma Controls Interface
Mixing GDI and DirectX
Getting the Lowdown on DirectDraw
The Main DirectDraw Object
Surfing on Surfaces
Playing with Palettes
Using DirectDraw in Windowed Modes
Drawing Pixels in a Window
Finding the Real Client Area (51)
Clipping a DirectX Window
Working with 8-Bit Windowed Modes
Summary
Chapter 8Vector Rasterization and 2D Transformations
Drawing Lines
Bresenhams Algorithm
Speeding Up the Algorithm
Basic 2D Clipping
Computing the Intersection of Two Lines Using the Point Slope Form
Computing the Intersection of Two Lines Using the General Form
Computing the Intersection of Two Lines Using the Matrix Form
Clipping the Line
The Cohen-Sutherland Algorithm
Wireframe Polygons
Polygon Data Structures
Drawing and Clipping Polygons
Transformations in the 2D Plane
Translation
Rotation
Scaling
Introduction to Matrices
The Identity Matrix
Matrix Addition
Matrix Multiplication
Transformations Using Matrices
Translation
Scaling
Rotation
Solid Filled Polygons
Types of Triangles and Quadrilaterals
Drawing Triangles and Quadrilaterals
Triangular Deconstruction Details
The General Case of Rasterizing a Quadrilateral
Triangulating Quads
Collision Detection with Polygons
Proximity AKA Bounding Sphere/Circle
Bounding Box
Point Containment
More on Timing and Synchronization
Scrolling and Panning
Page Scrolling Engines
Homogeneous Tile Engines
Sparse Bitmap Tile Engines
Fake 3D Isometric Engines
Method 1: Cell-Based, Totally 2D
Method 2: Full-Screen-Based, with 2D or 3D Collision Networks
Method 3: Using Full 3D Math, with a Fixed Camera View
The T3DLIB1 Library
The Engine Architecture
Basic Definitions
Working Macros
Data Types and Structures
Global Domination
The DirectDraw Interface
2D Polygon Functions
2D Graphic Primitives
Math and Error Functions
Bitmap Functions
Palette Functions
Utility Functions
The BOB (Blitter Object) Engine
Summary
Chapter 9Uplinking with DirectInput and Force Feedback
The Input Loop Revisited
DirectInput Overture
The Components of DirectInput
The General Steps for Setting Up DirectInput
Data Acquisition Modes
Creating the Main DirectInput Object
The 101-Key Control Pad
Problem During Reading: Reacquisition
Trapping the Mouse
Working the Joystick
Massaging Your Input
Going Deeper with Force Feedback
The Physics of Force Feedback
Setting Up Force Feedback
A Force Feedback Demo
Writing a Generalized Input System: T3DLIB2.CPP
The T3D Library at a Glance
Summary
Chapter 10Sounding Off with DirectSound and DirectMusic
Sound Programming on the PC
And Then There Was Sound...
Digital versus MIDISounds Great, Less Filling
Digital SoundLet the Bits Begin
Synthesized Sound and MIDI
Its MIDI Time!
Sound Hardware
Wave Table Synthesis
Wave Guide Synthesis
Digital Recording: Tools and Techniques
Recording Sounds
Processing Your Sounds
DirectSound on the Mic
Starting Up DirectSound
Understanding the Cooperation Level
Setting the Cooperation Level
Primary and Secondary Sound Buffers
Working with Secondary Buffers
Creating Secondary Sound Buffers
Writing Data to Secondary Buffers
Rendering Sounds
Playing a Sound
Stopping a Sound
Controlling the Volume
Freaking with the Frequency
Panning in 3D
Making DirectSound Talk Back
Reading Sounds from Disk
The .WAV Format
Reading .WAV Files
DirectMusic: The Great Experiment
DirectMusic Architecture
Starting Up DirectMusic
Initializing COM
Creating the Performance
Adding a Port to the Performance
Loading a MIDI Segment
Creating the Loader
Loading the MIDI File
Manipulating MIDI Segments
Playing a MIDI Segment
Stopping a MIDI Segment
Checking the Status of a MIDI Segment
Releasing a MIDI Segment
Shutting Down DirectMusic
A Little DirectMusic Example
The T3DLIB3 Sound and Music Library
The Header
The Types
Global Domination
The DirectSound API Wrapper
The DirectMusic API RapperGet It?
Summary
Part IIIHardcore Game Programming
Chapter 11Algorithms, Data Structures, Memory Management, and Multithreading
Data Structures
Static Structures and Arrays
Linked Lists
Algorithmic Analysis
Recursion
Trees
Building BSTs
Searching BSTs
Optimization Theory
Using Your Head
Mathematical Tricks
Fixed-Point Math
Unrolling the Loop
Look-Up Tables
Assembly Language
Making Demos
Prerecorded Demos
AI-Controlled Demos
Strategies for Saving the Game
Implementing Multiple Players
Taking Turns
Split-Screen Setups
Multithreaded Programming Techniques
Multithreaded Programming Terminology
Why Use Threads in a Game?
Conjuring a Thread from the Plasma Pool
Sending Messages from Thread to Thread
Waiting for the Right Moment
Multithreading and DirectX
Advanced Multithreading
Summary
CHAPTER 12Making Silicon Think with Artificial Intelligence
Artificial Intelligence Primer
Deterministic AI Algorithms
Random Motion
Tracking Algorithms
Anti-Tracking: Evasion Algorithms
Patterns and Basic Control Scripting
Basic Patterns
Patterns with Conditional Logic Processing
Modeling Behavioral State Systems
Elementary State Machines
Adding More Robust Behaviors with Personality
Modeling Memory and Learning with Software
Planning and Decision Trees
Coding Plans
Implementing a Real Planner
Pathfinding
Trial and Error
Contour Tracing
Collision Avoidance Tracks
Waypoint Pathfinding
A Racing Example
Robust Pathfinding
Advanced AI Scripting
Designing the Scripting Language
Using the C/C++ Compiler
Artificial Neural Networks
Genetic Algorithms
Fuzzy Logic
Normal Set Theory
Fuzzy Set Theory
Fuzzy Linguistic Variables and Rules
Fuzzy Manifolds and Membership
Fuzzy Associative Matrices
Processing the FAM with the Fuzzified Inputs
Warm and Fuzzy
Building Real AI for Games
Summary
Chapter 13Playing God: Basic Physics Modeling
Fundamental Laws of Physics
Mass (m)
Time (t)
Position (s)
Velocity (v)
Acceleration (a)
Force (F)
Forces in Higher Dimensions
Momentum (P)
The Physics of Linear Momentum: Conservation and Transfer
Modeling Gravity Effects
Modeling a Gravity Well
Modeling Projectile Trajectories
The Evil Head of Friction
Basic Friction Concepts
Friction on an Inclined Plane (Advanced)
Basic Ad Hoc Collision Response
Simple x,y Bounce Physics
Computing the Collision Response with Planes of Any Orientation
An Example of Vector Reflection
Intersection of Line Segments
Real 2D Object-to-Object Collision Response (Advanced)
Resolving the n-t Coordinate System
Simple Kinematics
Solving the Forward Kinematic Problem
Solving the Inverse Kinematic Problem
Particle Systems
What Every Particle Needs
Designing a Particle Engine
The Particle Engine Software
Generating the Initial Conditions
Putting the Particle System Together
Playing God: Constructing Physics Models for Games
Data Structures for Physics Modeling
Frame-Based Versus Time-Based Modeling
Summary
Chapter 14Putting It All Together: You Got Game!
The Initial Design of
Outpost
The Story
Designing the Gameplay
The Tools Used to Write the Game
The Game Universe: Scrolling in Space
The Players Ship: The Wraith
The Asteroid Field
The Enemies
The Outposts
The Predator Mines
The Gunships
The Power-Ups
The HUDS
The Particle System
Playing the Game
Compiling
Outpost
Compilation Files
Runtime Files
Epilogue
Part IVAppendixes
Appendix AWhats on the CD
Appendix BInstalling DirectX and Using the C/C++ Compiler
Using the C/C++ Compiler
Appendix CMath and Trigonometry Review
Trigonometry
Vectors
Vector Length
Normalization
Scalar Multiplication
Vector Addition
Vector Subtraction
The Inner Product, or the Dot Product
The Cross Product
The Zero Vector
Position Vectors
Vectors as Linear Combinations
Appendix DC++ Primer
What Is C++?
The Minimum You Need to Know About C++
New Types, Keywords, and Conventions
Comments
Constants
Referential Variables
Creating Variables On-the-Fly
Memory Management
Stream I/O
Classes
The New Struct in Town
Just a Simple Class
Public Versus Private
Class Member Functions (A.K.A. Methods)
Constructors and Destructors
Writing a Constructor
Writing a Destructor
The Scope Resolution Operator
Function and Operator Overloading
Summary
Appendix EGame Programming Resources
Game Programming Sites
Download Points
2D/3D Engines
Game Programming Books
Microsoft DirectX Multimedia Exposition
Usenet Newsgroups
Keeping Up with the Industry: Blues News
Game Development Magazines
Game Web Site Developers
Xtreme Games LLC
Appendix FASCII Tables
Index
Copyright ©
Macmillan Computer Publishing, Inc.
Products
|
Contact Us
|
About Us
|
Privacy
|
Ad Info
|
Home
Use of this site is subject to certain
Terms & Conditions
,
Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction in whole or in part in any form or medium without express written
permission
of EarthWeb is prohibited. Read EarthWeb's
privacy
statement.