DirectX
Game Programming Introduction
What
is DirectX?
DirectX
is a software development kit (SDK) for the Windows operating system
that allows programmers to directly access a computer's hardware without
going through the win32 GDI, which is slow. This translates into faster
games. Microsoft created this SDK to allow game developers to use Windows
instead of DOS as a platform. Previously, all games were developed for
DOS because the win32 GDI was too slow. Microsoft didn't want to risk
losing gamers to alternate operating systems, so they introduced a SDK
to encourage developers to target the windows platform. Microsoft's
first attempt was a failure. However, after a few revisions, Microsoft
had got it right and had pleased game developers. Currently all major
retail computer games are targeted for the Windows platform.
How
does it benefit a Game Programmer?
Let's face it. DOS is dead. People are not willing to go though the
hassle to get a DOS game working anymore (remember extended memory
and load high commands?). If you want to do professional programming
nowadays, you only have one option: DirectX. Sure, Linux and Macintosh
are other possibilities, but currently they don't have anywhere near
the user base that Windows has.
The switch from DOS to DirectX is a BIG change. You need to change
the way you design and write code. In addition, games need to be made
event driven as opposed to a procedural C program. At first, DirectX
seems difficult to most people. Even the experts complain about it
now and then. But after a little practice and learning the ropes,
it isn't too bad and the advantages far outweigh the investment in
learning it.
Let's look at the positive and negative aspects of DirectX:
Positive
- 1. No Drivers
to Develop
-
-
Programmers
don't have to write drivers for each different type of hardware
there is! Windows does this for us. DirectX just provides us with
a standard way to access the hardware and Windows takes care of
the rest. We just write our game using DirectX (which is machine
independent) and theoretically that same game should be able to
run on all Windows 95, Windows 98, and Windows NT computers in existence.
Windows NT DirectX support is still under development, though.
-
-
2. Larger
User Base
-
-
Microsoft Windows
95/98/NT in running on approximately 90% of desktop computers. This
means that you will have a huge user base of potential customers
that are able to run your game. Porting a game to additional operating
systems is a possibility, especially with the emerging Linux market.
Cross platform games gain a deeper respect from end users than a
game that is "Windows only."
- 3. Easier for
End User
-
-
Microsoft has
standardized game setup and the graphical user interface to some
extent. This makes it easier for end users to setup and run your
games. This hopefully will cut down on technical support calls from
people who don't know what they are doing (and you'll have to tell
them to rtfm); if they've installed one windows products, they know
how to do them all.
Negative
- 1. Changes
Game Program Structure
- Writing a game
for Windows is a lot different from a DOS game. You need to get used
to Windows messages and how Windows programming works. You also need
to change how you structure a game. In DOS, everything was structured
and you knew exactly what was going to happen and when it was going
to happen. Now with Windows, you get "windows messages" that tell
you what is happening. You need to structure your program to respond
to these messages that Windows sends you. Simply put, your game is
now a slave!
- 2. Supports
a Monopoly
- DirectX is developed
by Microsoft and Bill Gates. This can be a negative or positive, depending
on how you look at it. Some people are all wacko and naive and refuse
to buy a product from Microsoft because they are a monopoly. People
like that need to open up and understand that Microsoft does make
some good products. In my opinion, DirectX is one of those good products.
However, I put this in the negative category because Microsoft is
a monopoly. Being a monopoly, Microsoft forces all us developers to
develop for whatever they throw at us. A lot of other companies out
there could be a lot more innovative if Microsoft did not have control
of the entire software side of game development. Well, that's just
my two cents.
Analysis
Programming games using the DirectX API directly can be tedious and
a source of bugs to many new programmers. In today's fast paced gaming
environment, most people would rather spend their limited time developing
their ideas as opposed to reinventing the wheel. For this, we recommend
using the Allegro Game Programming Library. This library provides
a cleaner and easier way to access the same functions as coding directly
to the DirectX API. Development time is greatly shortened, thereby
allowing more time to write a creative, innovative game with better
game play. For more information, visit our Allegro
page.
Questions? Comments? Share your thoughts on the Discussion Forums...
if ($google) {
echo $googlerectangle;
}
else {
echo $yahoorectangle;
}
?>
|
if ($google) {
echo $googleskyscraper;
}
else {
echo $yahooskyscraper;
}
?>
|