075_breakthroughs in Delphi graphics and game programming

Source: Internet
Author: User
Document directory
  • Breakthroughs in Delphi graphics and game programming
Breakthroughs in Delphi graphics and game programming

DelphiTutorial Series of books(075)DelphiBreakthroughs in graphics and game programming Organize netizens (state)Email:Shuaihj@163.com



  • By John Ayres
  • Wordware Publishing, Inc.
  • ISBN: 1556226373 pub date: 12/01/99


In the beginning, there was darkness. In this age of innocence, the uninitialized ed masses practiced the art

Entertainment with small pieces of paper bearing symbolic images of kings, queens, and jesters. Sometimes,

They used minute pieces of metal and plastic, shaped like various real-world objects, moving them about on

Large, colored cardboard sheets in accordance with the runes inscribed upon small white cubes. To the casual

Observer, all was content, but in the minds of the newest generation born of this age, there was a yearning

More. Unbeknownst to the world, this yearning grew, and soon these young pioneers began working in

Dark recesses of colleges and universities to bring about a change that wocould alter the course of history in

Ways no learned schlar cocould have ever imagined. brandishing vacuum tube sabers and using arcane words

Of power such as Ram, Rom, bit, and byte, these acolytes of technology brought forth a new creation

Known as the computer. But, their new creation was naive, and lacked intelligence or sophistication;

Control it, they had to use a mystical, magical language known as Code. Thus, the art was born, and a new era

Had begun.

The first age was marked by the genesis of immense, hulking beasts that required enormous resources

Sustain life. These new life forms were rare, but typically stood several stories tall and required incredible life

Support systems to maintain an agreeable environment. These giants were moody and possessed little

Intelligence, but through great effort, they cocould be trained to perform incredible feats, for their day.

Digital Landscape was dotted with few of these behemoths, and their trainers were monk-like in their

Dedication. Unable to break free of their confines due to the immense size of their charges, these monks were

Forced to toil maddeningly long hours. Their torturous task of preparing the vegetarian meal of holy leaves

Consumed by these monsters had them working late into the night, and the art required to create these holy

Leaves was arcane indeed.

These monks practiced the great art in the same dark recesses from whence it was conceived, and the art

Grew. The once young pioneers had become pedantic, wizened old masters. These old Wizards were still

Rebellious and, yearning for a new form of entertainment, they used the art in ways that the powers that be

Felt were unproductive. Away from the watchful eyes of their overseers, they shaped the art in ways that

Previusly existed only in their dreams.

In the dark hours of the morning, these masters used the art to coax the new creations into providing their

Long-sought-after entertainment, and they played games such as tic-tac-toe and Pong. Several of these

Wizards used the art to create much more sophisticated forms of entertainment, and played games such

Checkers and chess with their silicon automatons. In the wake of the first age, walking in the shadow of

Evolving art, a new form of the art began to grow.

Like din1_urs, the reign of these behemoths was relatively short-lived. A new catalyst known as

Corporation had used the knowledge learned in the first age to effect an evolutionary step known as

Home PC. Thus, the second age began.

In the second age, the pantheon of Overlord gods began to form, controlling the evolution of this new

Creation from on high. Deities known as gates and Jobs worked their mystical creation power behind

Curtains of reality, but their new creations were protozoan in nature. A step back from their massive

Predecessors, these new single-cell machines were much less sophisticated and powerful, and teetered on

Edge of extinction almost as soon as they had appeared. However, these new creatures had become visible

The uninitialized ed masses, and began to elicit their attention. At first, few of the untrained cocould afford to adopt

One as a pet, but their popularity grew, and soon creations of these made their homes on each tops in

Homes and businesses. The art, still arcane in nature, had begun to emerge from its dark recesses, and several

Of the untrained began to delve into its mystical powers.

The net, the once-dark netherworld populated solely by the wizards and masters of the art, has now become

Tourist attraction, replete with amusement parks, rest stops, and gift shops. Rumors of new CPUs with speeds

In excess of 1,000 MHz are being whispered in the dark corners of cyber café S and coffee shops. Thus, we

Stand at the dawn of yet another new age. As the sun breaks over the distant horizon, its golden, shimmering

Rays cascading over the silicon juggernaut that stands before us, the prospects of the future are at once both

Exciting and frightening.

Thus, our journey begins.


Chapter 1-the lure of game programming

The dark side of the game programming Industry

Difficult learning curve

Long hours

Corporate instability

The light side of the game programming Industry

Fun and rewarding

Fame and fortune

The people

Game programming, in Delphi?

Delphi as a Games Development Platform


Untapped markets

Types of games

Real-time strategy

Turn-based strategy

First-person shooters

Adventure games

Action games

Puzzle games

Sports Games

Board and card games


Windows, Delphi, and games


Chapter 2-the anatomy of a game

Game dissection: the vital organs



User input

Real-time event-driven programming

Basic game architecture



Game startup

The game loop

Game ending

Shutdown and exit

The game loop

Retrieve user input

Perform antagonist AI and other game logic

Update sprite positions

Check for collisions

Start sound effects

Start music

Render the next frame

Check for game end

Speed Delay

Game states

The demo state

The playing State

The intermission state

The paused state

The game over state

Case Study


Chapter 3-basic graphics programming

The graphical Device Interface

Graphical elements





Graphical element classifications

Video mode resolutions and color depth


Color Depth

Video Board Memory

The components of a color

Palettized Modes

Non-palettized Modes

Graphics Output Techniques

The device context

Painting on the canvas

Bitmap Essentials

Bitmap types: DDB and DiB

The tbitmap object

Raster operations

Simulating transparency


Logical vs. System palettes

Using a palette

Further Adventures in Windows Programming


Chapter 4-an introduction to DirectX

What is DirectX?

The promise of DirectX

Benefits and drawbacks of DirectX Programming

The DirectX Architecture

DirectX Components

DirectX and Delphi

The DirectX SDK

Project Jedi

Other components and headers

A DirectDraw tutorial


Functional Overview

Com fundamentals


Page Flipping

Resolution, color depth, and video memory

Wide wed versus full-screen

Initializing DirectDraw

Rendering with GDI

Flipping the Surfaces

Displaying bitmaps

Surface memory location

Loading and displaying the bitmap

Blitting Surfaces

Lost Surfaces

Retrieving DirectDraw capabilities

The DirectX baseline Application

DirectX result codes

Retrieving the DirectX version


Chapter 5-palettes

What is a palette?

The idirectdrawpalette object

Creating the palette object

Defining palette colors

Using the palette object

Disconnecting palettes

Palettes and GDI functions

Palette Animation

Animating the palette

Screen transitions


Chapter 6-Sprite Techniques

The maximum sion of Animation

Constructing the animation Frames

Producing the animation

The maximum sion of motion

Sprite attributes

The animation cycle

Transparency issues

Color keying

Pixel checking

Collision Detection

Bounding Boxes

Pixel overlap comparison

Animation issues




Chapter 7-input Techniques

Human/Computer Interaction

Input devices

Input considerations



Functional Overview

Initializing directinput

Retrieving input data

Keyboard Input

Mouse input

Game Controller Input


Chapter 8-Force Feedback


Functional Overview

Basic Concepts

Kinetic force





Sample Period





Force Feedback effects

Base effect Structure

Creating Effects

Create and acquire the directinput Device

Query for Force Feedback support

Initialize a tdieffect structure and the type-specific parameters Structure

Create the effect object

Download the effect

Start the effect

Stop the effect

Case Study

Additional effect considerations

Retrieving effect status

Retrieving the Force Feedback System State

Sending commands to the Force Feedback System

Modifying an effect at run time



Chapter 9-sound and music

Sound Effects

Simplistic sound effects





CD audio


Chapter 10-optimization techniques

Optimization Theory

Timing code

Examining the algorithm

Proactive Optimization

Delphi-specific optimization techniques

Automatic compiler Optimizations

Additional compiler Optimizations

Other Delphi-specific optimization techniques

General Optimization Techniques

Loop unrolling

Lookup tables

Binary bit shifting

Additional optimization considerations


Chapter 11-Special Effects

Bitmap manipulation

Bitmap Transformations



Lighting tricks

Transition Effects

Simple Texture Mapping

Dynamic Images

Star Fields



Chapter 12-Artificial Intelligence Techniques


Random Movement


Patterned Movement

Finite state machines

Probability machines

Path finding


Basic implementation

Back stepping

Case Study



Chapter 13-putting it all together

Delphi Blocks

General game architecture

Player advancement

Game states

User input

Sound and music



The case study code






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.