This week assignment was the introduction of Lua for this semester. Instead of passing the vertex and index buffer data in game, we had to read it from a Lua file. The goal was to create a human readable lua-based mesh file and parse it in our program to create a mesh. Lua File Format Human readable data files are very useful, especially in game development. It makes the debugging easier as the user knows what could be expected form the output. These files are also useful for people with limited coding background, like game designers where they can try out different values for the program without needing to do or change anything with the code. I used the below file format for lua: As we can see, I have two tables for vertex array; one main table (vertexArray) and nested tables (position) inside that. Initially, I used 3 tables instead of two; vertexArray à vertices à position. This was adding undue complexity while parsing the data without making much difference to the readability. Thus I decided to go with two table approach. With complex table, we can use comments to further improve readability. [Note: How this project is setup is it treats all the warnings as errors. When I was finally testing this assignment (cleaning and rebuilding), even though everything worked in Direct3d, I got a linker error in OpenGL. The reason was I was getting a warning of possible loss of data while converting lua length to int in OpenGl, which was treated as warning, which cause the static manager in mesh class to not load and which caused the linker error. It took me some time to realize this, but it was an interesting error.] Mesh Builder We added another project in this assignment to build the mesh file. The responsibility of this project was to copy our human readable file from a source to destination. Since a new project was added, important thing here was to properly setup the dependencies (as told to us countless times by JP!). Our AssetBuilder project uses this MeshBuilder to build the mesh file (like it uses shader builder file). So, an explicit dependency was setup there to avoid any linker errors. Game Screenshot Playable EXE Download Controls: W S A D to move game object Up Down Left Right to move camera Ctrl to switch the mesh of game object
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |