top of page

DirectX Car Game

This work was my game project in the second year which was worth 45% percent of my programming module that was worth 60 credits for the year out of 120. I got 90% on this piece. It is built on the foundation of an asset-loading project written in C++ using DirectX 11.

You race in a car against an AI which follows the track while attending checkpoints to win the level.


The models are loaded into a vector containing the models and set up during the loading phase of the game achieved with multi-threading used to present a dynamic loading screen.


Car position is calculated by checking which car has reached more checkpoints. If both cars have reached the same number of checkpoints, the position is determined by the closest distance to the next checkpoint. While this works most of the time, at certain checkpoints on the third level, near the quad loops this can miscalculate the position for brief moments.


The player has free rotation of the camera around the car which stays at a fixed distance. If the cursor stays stationary for 5 seconds, the camera rotation snaps to the rotation of the car, following it around.


There are 100 buildings in the level randomised each run of the map. This is achieved by sending the one building model to the input assembler 100 times with different scales, rotations, positions, and texture coordinates.


The car movement is based on a physics simulation outlined in this paper by Marco Monster.


The track information is read in from csv files which determine where the start/end, checkpoints and trackpoints (used by the AI car to keep on the track) are located.


The sound engine was written by me based on the Windows documentation.


The enemy AI always moves forward. The rotation is determined by the angle between the car's forward vector and a vector from the car's location to the next road point on the track. If the angle is greater than 2 degrees, the car rotates to face the road point and stay on the track.




7 views

Recent Posts

See All
bottom of page