top of page

Controls: Esc - To quit game

Asset Build System Flow:

  1. In AssetBuildSystem.exe the initialize function creates a new lua state which then registers all the c functions in the lua state.

  2. It builds the absolute path for AssestBuildSystem.lua by using the scriptdir environment variable.

  3. It fetches the AuthoredAssetDir and BuiltAssetDir by calling the luaGetEnvironmentVariable in the AssetBuild.cpp.

  4. Then it passes the relative path of the first source to BuildAsset function in lua by calling the BuildAsset function in AssetBuildSystem. It does so from the command line argument array in AssetBuildSystem.

  5. The full path is concatenated in lua.

  6. Lua file then calls the luaDoesFileExist to check whether the source exists, if it does not an error is printed in the VS output.

  7. If it does exist, then the target is checked in the same way for if it exists, if it does not it should be built.

  8. If the target does exist, then it compares the time stamp on the source and the target and sets it to be built if the source timestamp is greater than the target timestamp.

  9. There is a check to create directory if necessary for target.

  10. Now the script calls luaCopyFile while copies the file from source path to target path.

Lua does not depend on anything. UserSettings, LuaExe, AssetBuildSystem depends on lua.

LuaExe depends on Lua. Nothing depends on LuaExe

AssetBuildSystem depends on Asserts, AssetBuildLibrary, Lua, Platform. BuildAllAssets depends on AssetBuildSystem.

UserSettings depends on Asserts, Logging, Lua, Platform. Application depends on UserSettings.

When we build the solution, change the settings.ini and rebuild the solution the settings.ini file stays the same.

It stays the same because we are comparing the output using this path $(GameDir)%(Filename)%(Extension). It is the same path, file, and extension to where we initially copied the file. So it does not copy the file as it knows it’s already there.

I think this is desirable as the user has set some settings as per his/her wish and we do not want to overwrite them each time as it would be inconvenient for the user to set it repeatedly.

This assignment was to implement the using of lua scripting language to build all the assets in the game. We had to fill some c functions to execute the lua script correctly.

In the assignment we also wrote logging messages for settings.ini Now the screen width and height are taken from the ini file.

The last requirement was to create another triangle to form a square in both OpenGL and Direct3D environment. For that we hard coded the values in the vertex buffer and increased the triangle count in the CreateVertexBuffer and the RenderFrame functions.

LUA INTEGRATION

bottom of page