Developing with DirectX Part 2
This is part two of my post, summarising my experiences of working with Microsoft DirectX. I worked with it during a University module geared towards developing applications using 3D APIs. In the first post I talked about the module in general, the game that I developed, the structure of the program code and the idea of performance vs good practice. This follow up will be looking at the starting point for development, evaluation of the product and some screenshots of the final game.
Starting Point and Created Content
The main starting point for this project was the work that I had done for the previous coursework of this module. From the first coursework I borrowed the basic concepts for the game and the main code logic for certain areas of the game: controls, sound, rendering etc. This allowed me to push on quite quickly with improving the game and adding new features to the code. The other resource that I utilised to start the project was the Thing3D class that has been apparent in a lot of the tutorial applications. It is worth noting that I did not just copy the class and use it straight away, I actually borrowed certain concepts from it to create my own class. Thing3D was developed using the older DirectX framework methods for loading meshes, sounds etc, my class however has borrowed the concepts but updated them to utilise the new DXUT classes. This has made the class a lot more efficient in my opinion as the difficult work of loading meshes etc is handled by the DXUT classes written by Microsoft. I also borrowed some other code concepts from Thing3D for the moveForward(), setupMatrices() and general movement methods but again updated them to work with my new class structure.
The remainder of the code in the game has been written by me, with a little help from some game development websites. The more complex areas such as collision detection and shadow rendering did require some research. I found some articles on websites such as gamedev.net that explained the concepts for these areas; this helped me to develop them massively.
All of the models (meshes) in the game havebeen created by me using Google Sketchup along with a plugin that exports them to a Direct X mesh file. Some of the textures have been downloaded from the free texture library website cgtextures.com. Otherwise the only other resources in the game are the sound files which have been downloaded from sound libraries and ripped from youtube videos.
I am very happy with the outcome of this assignment and I believe that I have better utilised my knowledge of DirectX and furthered it through research. Some of the features of this new game were not possible to implement with my existing knowledge and what was taught in the module. This meant that I had to conduct research and further my own knowledge; I believe that this has been very beneficial and has not only increased my knowledge but solidified my current expertise. This was particularly apparent when implementing the collision detection and the implementation of the car shadows.
The collision detection is the part of the project that I am the most proud of as it took a lot of time to implement but was actually quite simple and efficient when completed. The creation of a bounding box for the car and each of the track buildings is carried out when the meshes are loaded. The car box however is updated to be lined up with the car upon every frame; the same would have to be done for any other moving objects. The collisions are then simply detected by comparing the coordinates of each of the bounding box vertices. Otherwise I am proud of the improved car models which took substantial time to create and the new menu system which has been created using DXUT controls.
At the end of this project I have some knowledge now that would prompt me to do certain things differently:
- I would have researched how to do collision detection before I started the development process. That way I could have created a prototype to perfect the technique instead of trying to do it on the fly within the final application
- Finally I would have put this saved time into improving the car handling as it basically unchanged since the first version of the game.
Screenshots of the Game