Game Engineering || – EAE 6320 – Assignment_05

The main objective of this assignment is to add the Assets as well as the Shaders from the lua file called AssetsToBuild.lua rather than adding them in the custom build step.

So instead of adding the individual shader files and the mesh files in the custom build step of the BuildAssets.lua and adding it in the command line  we just add “$(BinDir)AssetBuilder.exe”.
The “AssetsToBuild.lua” file basically contains information like the building tool , the source and the destination path that will be used. The main advantage of this process is that it makes it simpler and sleek to add new mesh files. So we only need to worry about editing the mesh files and we do not need to be concerned about adding it in the custom build step properties.

Screenshot for assignment_05

The following is the picture shows me debugging the MeshBuilder .

Debug Pic

So my new BuildAssets and AssetsToBuild lua files reside in the Scripts in the Solution . I have decided to keep all them in Scripts so next if I have to change the source or target or add shader and mesh files it is convenient for me to change and remember where to change it which is in the scripts.

lua file 05 pic

So the following picture shows my Custom Build Step . As you can see there is more clarity in the Command Line than before since we do not need the individual shaders and assets like before.

custom build pic

Here are the pic of the project dependencies that I have set .

AssetsBuilder pics

The following shows the project dependency for BuildAssets.



The AssetBuilder depends on the BuilderHelper,Lua,Generic Builder,MeshBuilder and Windows. The AssetBuilder depends on the BuilderHelper for all the utility functions .  I have made the BuildAssets to depend on all the builders since it is using the builders to build the assets which are in the AssetsToBuild.lua file.

Overall this assignment was better than the last one . It took me 10 hours to finish it . Since I spent more time on the last assignment to structure the code it was easier to integrate the Builders on this assignment.

You can download the Zip File of Assignment_05 from the following link to get the square output.


After downloading the link run Game.exe.


Game Engineering || – EAE 6320 – Assignment_04

The main goal of Assignment_04 was to combine the 4 shader’s which were the 2 for hlsl and 2 for glsl and make them into two shader’s  by using the the platform specific preprocessors and also to structure and read the vertex/index data from the lua file.

I decided to name the two new shaders as vertex.shader and fragment.shader. This is because the names are clear and easy to understand and identify making it easily readible. So basically instead of writing two separate hlsl and glsl shaders for Direct3d and OpenGl, we combine both the vertex shaders into one shader file called vertex.shader and we combine both the fragment shaders into one shader file called fragment.shader. We separate the platform specific code by using the platform specific preprocessor macros for Direct3D and OpenGL.

We also had to make the corresponding changes in the BuildAsset properties in the custom build step.  We also had to make the appropriate changes in the and Graphics.d3d.cpp.

bandicam 2015-09-22 15-23-37-923
My mesh file picture is shown as follows:
The name of my mesh file is rectangle.mesh . I am choosing this name as it suggests that it a mesh which contains the shape of a rectangle. I will mostly be naming my mesh files based on the shape.

It starts off with the return statement. I am creating an array of vertices vertices and indices. For each vertex there is a position and a color. This is indicated by “pos” and “color” in the lua file which is quite clear and human readable. For the position we have the x and the y co-ordinates which is why you can see two values for each pos. For the color of each vertex I have 4 values which indicate red,blue,green and alpha . The reason I passed 4 values including the alpha is so it gives me an extra option to adjust the opacity. I think this format was like the one we discussed in class and its easy for me for understand and  integrate with C++.



As far as the winding order goes I chose to use the order which Maya uses. As far as the discussion in class I was convinced and find the OpenGL(anti-clockwise) winding order a better option since Maya also uses the same format, so it will be easier to visualize it if I need to debug it.

As I already mentioned I chose to use 4 values for the colors which represent red,blue,green and alpha. I think every artist and engineer is familiar with RGBA values and it also allows me to tweak the opacity in the lua file which I why I am choosing

The extension I chose is a .mesh file because it represents a mesh and the convention that I am planning to stick to is to name the mesh depending on the shape. Since our mesh represents a rectangle shape I am choosing to give it a name rectangle.mesh.

I never though that names used in the mesh file was so important and I was convinced by the discussion in the class that it is important to make it human readable. I think the simplicity is the ultimate form of sophistication. Any mesh file which is easily readable and clear will look as though the person has given a good thought process behind the design. It is also important to consider what you feel is comfortable and readable for yourself. Also in future I feel that for the vertex we only need to use x,y or x,y,z  position and the color but this thought may change. There are other things like normals which we might need to calculate for lighting but it is mostly used for computations and may not be required to be passed to the lua file. So its better to keep it as simple as possible.

Overall this assignment took me around 20 hours to complete. Making changes to the shader and making the lua File were relatively simple and took me around 3 hours. But integrating the lua file with C++ took a lot of time for me. OpenGL part was relatively easier for me. But Direct3D was challenging which required a lot of debugging for me and watching the values on which I had to spend a couple of hours. This assignment was pretty challenging but I learnt a lot.

You can download the Zip File of Assignment_04 from the following link to get the square output.


After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_03

The main objective of this assignment is to create a vertex buffer to store the unique vertices of any shape and create an index buffer which depicts how the vertices are connected to each other thereby reusing the vertices . The reason we separate the vertex and theindex data is for efficiency reasons. The vertex is basically a struct of two floats and we use uint8_t to store the color. So it is a lot heavier than an index. An index is a GLUint for OpenGl which is quite light. And so we we are ultimately passing smaller data to the GPU thereby improving the efficiency. We are also storing only the unique vertices and passing only 4 vertices in the draw call rather than passing 6 vertices as we did in the last assignment.


Since we are only storing the unique vertices the total number of vertices that were used to make the square were 4 and the the total number of indices used in this square were 6. So basically we store the vertices in the vertex buffer and the indices in the index buffer . These indices in the index buffer refer to the vertices in the vertex buffer in the the order (clockwise for Direct3d / anti-clockwise for OpenGL) they would be used to draw the triangle.

So as I mentioned above the advantage of splitting the vertex into vertex buffer and index buffer is that we need to store only the unique vertices for each shape and we can use the index buffer which is much lighter than the vertex structure to depict how the vertices are connecting to each other. Due to this we can reuse the vertices and we do not need to include again them for a particular shape like we did in the earlier assignment. Hence we are passing smaller data to the GPU for the draw call and so it is better optimized.

So for the Mesh system I decided to create a struct and I decided to make it a part of the Graphics class . The reason I decided to put it in Graphics is because my Mesh contains Graphics specific data for OpenGl and Direct3d which is appropriately selected using the preprocessor  macros depending on the configuration selected. Also I have my sVertex struct in Mesh which contains two floats for x and y and a uint8_ts for the color hence it only makes sense to place the mesh in the Graphics Engine because it contains the Graphics specific data.

The reason why it is better to have a shared interface for different platforms which have a different style of implementation is that you can write common code for both the platforms and you don’t have to worry about difference between the different platform specific code. Hence it allows you to write common code for both the platforms .

So I made two parameterized constructors for Mesh which are platform specific . I am passing the 3 pointers for Direct3D in the parameterized  constructor and one for OpenGL .

The declaration of my DrawMesh function looks like
void DrawMesh().
It is called on both both the platforms as s_Mesh->DrawMesh();

The way I create pointer “s_Mesh” for Direct3D and OpenGL is as follows and give it NULL reference :
eae6320::Graphics::Mesh *s_Mesh = NULL;
Then I use s_Mesh to call the parameterized constructors for both the platforms and also get the device for the case of Direct3D. And ultimately I call the DrawMesh() function.

So as we discussed a couple of methods in class like globals, parameterized constructor and context, I was currently using the method of the parameterized constructor.

So it took me 12 hours to work on the assignment . Going through the reading material took me 2 hours . Implementing the colored square via Vertex and Index Buffer took me around 2 hours. I took the remaining time to finish the single interface for drawing Mesh.

You can download the Zip File of Assignment_03 from the following link to get the square output.

After downloading the link run Game.exe.


Semester 3 Thesis – 1

This is the first blog of the semester and we had a team discussion about making our game a co-op game between the bling and the deaf person. So since the summer we have discussing about the narrative and where to take the current mechanic that we have which involves the cooperation between two players.

So the idea now is the blind player cannot see or have any visual feedback but has audio feedback and the other player is deaf who has only visual but no audio feedback.

We also discussed about the weapon system that the players would have and decided that the blind would have a magic wand. I have taken the task of creating the magic wand weapon system.

Some wand concepts are as follows:Staff_concept_art

So I need to code the behavior for a magic effect. I am yet looking into the ideas right now. Seems like the rigid body is buggy for unity so will try and only translate the effect. Some game like Witcher and Dragon Age seem to have cool magic wand ideas as follows:



Currently I am really digging this electricity/ current effect of dragon age. So I have decided to try and code the behavior like an intense electric beam effect.

Game Engineering || – EAE 6320 – Assignment_02


The goal of this Assignment_02 is to integrate Lua into the solution as well as adding the vertex buffer data to draw a square in the output instead of triangle which was done in the previous assignment.

The part of this Assignment which was fun to work on was creating another triangle and updating the Vertex Data for OpenGl and Direct3D. The important part was taking into account that the orientation in which you write the vertices are in clockwise direction for Direct3D and counter-clockwise direction for OpenGL. But since we discussed about these details in great depth in the class this task was easier . This was so interesting that I created different patterns and also made color changes in the fragment shaders just to whet my appetite in Graphics. I have shown examples in the end of this post.

First of all talking about the structure of the code we add Lua,LuaC and Lua.exe projects in the External folder. We also updated the previous AssetBuilder.cpp by writing functions to integrate it with Lua Scripting Language and add BuildAssets.lua file in the AssetBuilder project which does the actual building process.

Placing the BuildAsset.lua in the AssetBuilder project is a good idea because the AssetBuilder.cpp has communicate with the BuildAssets.lua to call functions from it . So I think that its is probably is good idea to just put the BuildAssets.lua in the AssetBuilder project for a smooth communication .

It is fascinating to know how BuildAssets.lua file can call upon C++ functions to deal with copying files which are modified and how the directories are created. Passing arguments and pushing it onto the stack and returning the values between the lua file and C++ is quite interesting.

The authored assets are basically contained in the assets folder.
. When the AssetBuilder project is build it checks whether those assets are present in the BuildAssets folder. If they are not, or they have been modified, it will basically copy those assets there.

When you build the AssetBuilder it calls the AssetBuilder.exe .The AssetBuilder.exe is used to call the lua script which is actually doing the building process. The lua file checks whether all the required authored assets exist in the Build Assets folder. If they are not, or have been modified or updated, it will copy those assets to the Build Assets folder.

Some of the strengths of lua is the ease of integration and the speed of execution. Lua integration was quite easy with C++ . However debugging Lua can be a problem . I had to check for syntax errors by running it on command prompt .

We are learning Lua in class because it is easy to integrate and learn. It is also used as the scripting language in many industries so it is probably beneficial to learn it . Probably the main advantage of lua and why it would be used in the game industry is that it allows us to make minor changes in the code without having to build the game everytime, thereby saving a lot of time especially when the game is really big . Another advantage that can thought of in our solution is that since the AssetBuilder has been modified to use the lua script file the asset building process can be tweaked from outside the C++ code to make quick changes to the asset building process.

bandicam 2015-09-07 01-31-01-265
The output of the Assigment_02 looks like the above picture  . Instead of having a triangle in the last assignment, we add another triangle to form a square . The white color is passed in the fragment shader.

As per the graphics part it would be amazing to update the sVertex struct to add a z-axis which currently only contains x and y to draw 3D primitive shapes like cube and pyramids . Also if have a D3DCOLOR in the sVertex struct we can add separate color for different vertices and interpolate them across the face of the triangle to get some multicolored effects rather than having a single color in the fragment shader.

Just to whet my appetite for graphics I also created the following house looking structure by adding another triangle on top of the rectangle thereby having a total of 3 triangles .  (2 triangles for the rectangle structure and one triangle on top of it).

bandicam 2015-09-07 02-37-13-867

I also experimented with the fragment shader and manipulated the RGBA color values to see how that would affect the output.

bandicam 2015-09-07 02-51-10-778bandicam 2015-09-07 02-52-19-871

Overall it took me around 12 hours to finish this assignment. Going through the reading material and lua integration took most of the time which was around 10 hours and it took 2 hours for drawing the square which is one more triangle to the previous assignment and understanding the graphics for Direct3D and OpenGL.

You can download the Zip File of Assignment_02 from the following link to get the square output.

After downloading the link run Game.exe.



Game Engineering || – EAE 6320 – Assignment_01

The goal of this assignment is to create an efficient and a highly organized solution in Visual Studio for our Game.

Firstly we went through the highly comprehensive series of steps and solutions which were well laid out by John Paul on the canvas.
We spend the major amount of time trying to understand the code architecture and how the various projects are structured in the solution. Here is a screenshot of the how the solution is organized.

Solution Structure

Getting accustomed to the GitHib version control was a crucial part of the assignment. It was good that we thoroughly went through it as the GitHub version control is used in majority of Game Industries. Understanding the .gitignore which excludes certain files like the temp folder was very beneficial to us. The .gitignore would save us a lot of time in the future as we could basically ignore the files that we do not need to commit. The temp folder basically contains the temporary files, intermediate files and executable files which gets created once we build the solution. So if we wanted to delete all the intermediates and temporary files its better to have it organized in a separate folder so we can delete them at once, thereby keeping the solution highly organised and clean.

We have a separate asset build system in our solution which is created in the Tools folder . This is basically done so that the artists can put their artwork assets in a separate and dedicated folder called assets instead of having them all over the place. This is done to keep the solution organized and clean. Another important reason to have a separate asset build system is to convert the assets from Maya into a more optimized form by Visual Studio. The asset builder basically transfers the asset into the appropriate format. The good part of the asset builder system is that once the assets are built, we will not need to rebuild them if we have to make a small change in the code.

One of the most important things that we are learning in this class and what we learned in Game Engineering 1 is to keep the Game Code separate from the Engine Code. This is basically done because the game code will be different for different games but the Engine which is the backbone of every game must be more or less the same.
Also the Game code should not alter the Engine code but just use the Engine code as a tool . This is why we need to separate the Game and Engine code.

Overall it took me about 14 hours to complete this assignment . It took me about 10 hours to go through the reading instructions and setup the project. It took me about 2 hours to fix the problems and it took about 2 hours to finish the write up.

Understanding how to architect and structure the code to create an efficient graphics pipeline is one of the things that I am excited to learn in this class as Game Graphics are my primary field of interest.

The Game.exe output for the Assignment_01 shows a white triangle in a black background as shown in the picture below :

bandicam 2015-09-01 14-04-59-287


Here is the link to download the zip file for the output :
Assignment_01 Output

After downloading the zip file run Game.exe and you will see the same triangle in the above picture.