Blogger Templates

Wednesday, November 29, 2017


Graphics (13 of ∞) Smarter build process

Posted in ,
EAE 6320-001

So far I always had to wait a lot of time building all the textures, meshes, shaders that I am using in the game. This had severely impacted the time I spend in completing a project. In this write-up, I will walk you through the experience of building an efficient build process to speed up my development pipeline.

Isolating Asset Inclusions

It’s always a good practise to have all our asset references to be in one place so a gameplay programmer/designer can easily modify them. One idea here is to assume all content inside a specific folder could be built altogether. This approach could be very handful for a designer but in our case, we will use a separate lua file like AssetsToBuild.lua to list all the required files that have to be built. For meshes and textures, I can go with an array like lua tables and for shaders, I will be using a dictionary like lua tables. This would allow me to define all textures, meshes and vertex with their exact pathnames and without have do much scrolling on the same file.

I also had to set the custom build tool params to allow my BuildExampleGameAssets to build the required assets using AssetBuildExe.exe

NewAssetType References
Then I had to link the appropriate builders for the asset types. This include MeshBuilder.exe, TextureBuilder.exe, ShaderBuilder.exe. Based on asset type info, we would pull the builder relative path for our build process.Since we had the source path here, we have to come up with a regular expression to extract the individual file name, relative directory and reuse the same to construct the target path. Since in my project, the source and destination can vary in many ways like extension or file name, I need to rely only on the source path to get the relative path for the output files.

No builder files in the build process
We do have some files like the settings.ini and license which gets copied directly without the need for having a builder. When we copy those files, we need to ensure we copy only when there is no existing file or even if the file exists, we should perform copy if and only if the source is more recent than the target. The way I do this is by comparing the timestamp of file modified from the target with the timestamp of the source file modification.

Layout Shaders
After having the layout shaders referenced in the AssetsToBuild, I don't have an option to control certain paths to build for a specific platform in AssetsToBuild.lua. To solve this, I will continue to build the assets across all platforms but I will make that macro specific check inside the shader file directly. For instance, my mesh and vertex layout geometry will encapsulate all of its content in a flag like #if defined( EAE6320_PLATFORM_D3D )

Asset Build System
After completing this whole asset build system, I saw a significant difference in the time it would take for me to make a complete build. Earlier, I use to build every file whenever I make a build but now I would build the files which are modified. I will also build every possible asset only when there is a change in the builder itself. This saves a ton of time for me whenever I work on a new module for this project. I would definitely recommend the readers to keep the asset build system as part of an early milestone in a project so developers can be more productive later.

Game Screenshot
Cube Movement
Right Arrow - Move the 3D game object to the right.
Left Arrow - Move the 3D game object to the left.
Up Arrow - Move the 3D game object upwards.
Down Arrow - Move the 3D game object downwards.

Camera Movement
W - Forward Acceleration
S - Backward Acceleration
A - Rotate towards the left side
D - Rotate towards the right side
Q - Rotate Upwards
E - Rotate Downwards