Building Direct3D Application from C++ Builder

This article just remind me to my final college comprehensive exam on year 2002 (tugas akhir/skripsi, see it in my personal biodata page). I was picked up a rarely caption titled DirectX game programming which never exists yet before on my campus in that time. Majority, many of final exams submited had titled around of databases applications and I was challanged to create something differents.

Basically, I was inspired from a popular game called Quake III Arena releases by Id software. So, I was purposed to create a 3rd person shooting game just like that one. I used the Borland C++ Builder 4 (BCB4) compiler since its powered by open wide library such as DirectX header files which was supported by microsoft.

What you need to create this kind of application is just more than BCB familiarly used up. But, there are lots of extras thing you should know, such:
1. Some knowledges about physics and science like matrix operations, vectors and cartezian triple point coordinates. See this explanation.
2. Skills about how to create meshes with 3DStudioMax (or others similar tools which could create a 3DS file format)
3. Skills about how to create plain pictures (skin textures) with image editor (or others similar tools which could create a BMP file format - I usually used Adobe Photoshop)
4. A converter tools named conv3ds.exe used to re-convert 3DS files into a standard Direct3D .x extension.
5. Direct3D C++ headers file named d3dapi.h. Just make a search on google.

Okay, first of all, you have to create a 3D object from tools (such 3DStudioMax) that can export the files into 3DS format (eg: from 3DStudioMax, save the file with name my_object.max then export it into name my_object.3ds). Convert the my_object.3ds file by conv3ds.exe until a new file created with name my_object.x.

Create a 256x256 pixel pictures from image editor and save it with name my_pic.bmp. This picture made to texturizing the my_object.x file later from the BCB4 editor so that the 3D object in application will looked wearing a "clothes".

Continued to the BCB4 compiler. There are lots of procedures to define the Direct3D application. But, I'll give you a short resume step by step how to make it done.
1. Include the d3dapi.h from the cpp unit file.
2. Create a Direct3D initialization to recognize the inherited objects from the header file.
// scene initialization
if (!scene)
scene=new TScene;

// camera initialization
if (!camera)
camera=new TCamera;

// lighting effect initialization
if (!light)
light=new TLight;

// load the my_object.x file
if (!map)
map=new T3DObject;
// and give it clothes
if (scene) scene->Add(map);

3. Finally, add this syntax to show it on the form
void __fastcall TForm::OnIdle(TObject *Sender, bool &Done)

4. That's all.

Okay, what you will see below is just the screenshoot about my application named "Electraglide Zone".

The application packaged with bundled CD installation approximately sized about 250Mb. Perhaps you would like to try out and make a reviews?


Eko Wahyudiharto
PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address:

Delivered by FeedBurner

Post a Comment Bookmark and Share


Post a Comment

Leave comments here...