In March 2001, I wanted to learn more about DirectX 7 and DirectDraw so I created my own First Person Shooter "FPS" with Quake 3's assets which is also my favorite of the franchise.
It took me close to one month, especially nightly coding if I recall, to build and create this demo and tools from scratch on my Pentium 266 Mhz MMX.
Above is a quick game play video I did last week.
The tiny engine I did was called: Z3D_Engine and below is the main file structure of this demo:
It's far compared to the Quake 3's version (id Tech 3) but it works and it's playable.
My mouse sensitivity is high by default and for this demo it may be too high!
The codebase is in C++ with C flavor... No goto but a lot of function pointers.
Here are some basic features I developed for this 3d engine/demo:
- 3D loader model: meshes, textures, materials
- Audio player for music and sounds (wav format only)
- Basic Finite State Machine (FSM) for AI (ennemies)
- Gibbing when enemy died (explode for this case)
- 3D Render: multitexturing, alpha blending, texture uv offset, dynamic meshes, 2d billboard
- Camera system (FPS view) and clipping
- User Interface (UI) in software rendering mode
Some parts that could be improved:
- Fix resolution (640 x 480)
- Use skybox instead of this indoor map with space textures (very claustrophobic style)
- Better animation. This version only uses one model and I xor the sign bit on one axis to flip and create a basic 2 frames animation...
- Camera View: it looks like we are Gimli in The Lord of the Rings when we play (dwarf view mode)
- More characters. Phobos and Doom use the same mesh but different textures so I only used one mesh for them
Also, DirectDraw was not fast enough to blend sprites on screen or apply some effects (e.g. quad damage in blue on character) so I added some assembly code in SIMD with MMX instructions to improve the performance.
Above is my in-house tool that I created during that time to convert asc files into my own format.
I can't load directly the Quake 3 model file format (md3) so I used an application called MilkShape 3D first that can
convert the .md3 file into other formats. The asc file format is a text file and it was easy to read this one.
"MilkShape 3D is a low-polygon modeler, which was initially designed for Half-Life. By and by many file formats and features have been added."
Direct-X 7 is a fixed TnL pipeline (Transform and Light) with defined render states and texture stage properties.
I included some configurable options inside this tool (e.g. Modulate4X, Alpha, ...) and it supported multitextures.
I also used another tool that I liked a lot at that time called Deluxe Paint Animation.
Mostly for loading text, UI elements and the credits at the end of the match.
For the code restoration, I was not able to use Visual Studio 2022 (VS2022) since it can't read .dsw and .dsp files (old visual studio "solution").
I first launched VS2019 for the conversion and after I went back to VS2022.
I fixed errors and warning issues, added some missing Direct3D files and it works!
I also modernized the project a little bit by adding a clang-format script to format C/C++ codes. It was a template script that I did a couple of times ago and I always use this one on my projects.
It was funny to revisit this code. Some parts are in a very old style which I don't really do these days.
Thanks for reading,
JS.