How to Simplify the Build Process
Prior to this week, in order to build our game assets using the appropriate build tools, this required the use of a lengthy .lua file that contained instructions on how, and when, to build each and every game asset. This file stretched to almost 500 lines of code! It was a direct offender of programming paradigm of being DRY or Don’t Repeat Yourself. It contained dozens of repeated routines that did similar tasks. These tasks included determining if a directory should be created to house our final compiled assets, and error reporting when appropriate.
To mitigate this, we now have our new Asset Build System! The only difference between our game assets are their names / paths and file type. We can contain this data in a more central location, formatted nicely within another .lua file, as shown below:
We contain our meshes into our “meshes” group, shaders into “shaders”, and so on. We can then pass these arguments to functions that determine what type they are, and can feed them to the appropriate executable. In the end, we now have a more versatile asset building system with minimal repeat routines. Also, it can be easily extended to include assets of different types that may be useful in the future if the engine is ever expanded upon.
Another thing to mention, is that the above .lua file containing assets relevant to the game is now contained directly within the game’s source directory. No longer having to be included as a real part of the game engine. This is a forward step in making the clear distinction between game and engine code.
The Camera: [Key : Action]
[W : Move Forwards]
[A : Move to the Left]
[S : Move to the Right]
[D: Move Backwards]
[Space: Move UP]
[Left / Right Ctrl: Move DOWN]
The Brain: [Key : Action]
[Arrow UP : Move Forwards]
[Arrow LEFT: Move to the Left]
[Arrow RIGHT : Move to the Right]
[Arrow DOWN: Move Backwards]
[Page UP: Move UP]
[Page DOWN: Move DOWN]
You can try out these games via the below links. The only difference is that Direct3D will be used in the x64 version, with OpenGL in the other. They have been built and verified to work on Windows.