Introduction
Ever read/heard of the "Tricks of the Windows game programming gurus", a book by Andre Lamothe?
Well, having that book in my hands (or in my computer) allowed me to dive into the secrets and tricks of Windows game development. The author of this book decided to share his 20-year experience as a Windows game developer and a programmer.
In this book, he covers Windows GDI and DirectX (DirectDraw, DirectPlay, and DirectSound) fundamentals, and shows to the readers how to build fast and simple 2D game engines under DirectX.
Piece by piece, according to the book, I have built a DirectX wrapper library as a base part of a future full-featured 2D game engine.
Background
The background for my search for the ultimate game book I took some time ago can be found in the secret wish of any "real programmer" - we all want to build the game at last. And we want it to be good...
You will find a lot more information in the book regarding the following:
- Win32 applications basics
- COM and DirectX basics
- Vector rasterization and 2D transformations
- Force Feedback joysticks
- Sounds and music
- Algorithms, data structures, memory management, and multithreading
- Computer AI basics
- Physics basics
And this is just a part of the contents of the book! It covers a lot of ground, and it may take months to be understood, but still it must be used as a reminder of how something can be (and is being) done in the "world of game developers".
Using the code (if you can call it this way)
There are the DXEngine.h and DXEngine.cpp files that should be added to the Win32 project (not the MFC project). Also, the latest DirectX SDK does not support MS Visual Studio 6.0 any longer, so you must use the MS Visual Studio .NET environment.
Basically, it goes like this (but, don't laugh please):
DXEngine_Init();
DXEngine_Render();
DXEngine_Deinit();
There is a number of DXEngine
functions that you can use for:
- Image loading (bitmaps)
- Pixel drawing
- Vector graphics drawing (lines, polygons)
- Filling vector shapes (filled polygons)
- Text drawing
- 2D transformations (translation, rotation, scaling)
However, there is no sound support implemented yet! Why? I don't know... I didn't want it for now.
There is a lot of code you must write down yourself, but it is your game, right? Please, download the sample project and go through the source, it is the only way to understand the game development issue. I'm not kidding at all. There is no way to write an article that will teach you to be a game programmer.
And get the book as soon as possible (if you don't like my game), and write your own! It will be a good one for sure, I know.
Points of Interest
I have learned many interesting/fun/annoying things while I was writing the code, and I have seen clever/wild/zany things for the rest of my life. Kidding... I have just started to have fun!!!
Happy New Year, my friend...
History
In this release of the Space Warrior game I have added UFO enemies and another asteroid type.