Boulder crash is a game written in a custom, self made engine using C++ and DirectX. It is based on the boulder run levels featured in Crash Bandicoot.
This project uses an extended verions of a basic C++ engine, I added shadowmapping to the engine in about four days. API's used in this engine are DirectX, PhysX and Fmod. All technologies and languages used in this project are:
It includes a main menu, a controls menu, the main level, a pause menu with reset, resume and exit options and an end game screen that displays your final score upon death or victory. It has full controller support and has basic ambient sounds and music. The player controls a fox character that can run, jump and attack. The goal is to get to the end of the level without dying to the boulder that is chasing you down. Not only do you have to get to the end of the level, you also have to get as many points as you can by breaking crates and collecting apples while you are being chased by the boulder. The level features a lot of obstacles the player has to avoid or jump over. This makes it so you sometimes have to choose between getting crates or safely jumping over the pits. As the engine does not include any level editor, the whole level was first modeled in 3DS max and then exported to the Overlord Engine. This was done using a combination of MaxScript to write the position, rotation and the scale for all items in the scene to a csv file. This csv file is then used to load the correct models in the engine and automatically have them in the right position. How this is done in code is outlined in the next section. The main level model and the gate model were both modeled and textured by me, the other models (character, trees, plants, apples...) were found online. The animations for the character are from Mixamo, imported to the engine's own animation format.
The following code snippet contains the code that loads static objects into the game. It uses a .csv file - generated from 3DS Max scene using MaxScript - that contains the position, rotation and scale of the items and some extra information to know which item has to be loaded into the game. Using this technique I was able to create a sizeable level with ease, not having to hard code anything into the level. The loader is a templated header only class and uses a csv reader header include to parse the data. The constructor requires the file path to the csv file that has to be loaded, as well as a pointer to the scene the item has to be added to. This information is used in the actual load function, which reads the raw data from the csv file and uses it to construct items from the templated class and position and scale them correctly. Once the object is loaded and positioned, it is added to the scene specified in the constructor of the loader. From this point on the scene is responsible of managing the loaded items.
The following snippet is an example of how interactive objects work. The initialize and post initialize functions set all the basic parameters for the object like the material, collision boxes, collision groups, trigger and more. It is also an indication of the workflow used in the engine as well as the general setup.
This final code example shows how shadow mapping is done in the engine. The most important functions are the Begin, Draw and End functions. These are the hearth of the shadowmapping process. In the begin stage, the main render targets and shader resources get unbound and the shadowmap render target gets bound. The Draw function gets called for every object in the scene, here the scene gets rendered from the POV of the light. In the End function, the render targets get unbound again so the produced shadow map can be used in the final scene draw.