Category Archives: Game Engineering ||

Game Engineering || – Final Project

For the final project we had to make our game using the engine that we have we developed over the course and use most of the methodologies and techniques that we have been taught over this course.

Our engine contains both OpenGL and Direct3D configurations and so your can build and render your game on any of the two platforms. We have a cool Maya Mesh Exporter where you can export the model directly from Maya into your Game Assets and use those models for your game. We have Materials where you can adjust alpha transparency, RGB values as well as add textures. The engine also contains different builders like MeshBuilder, AssetBuilder, ShaderBuilder, MaterialBuilder and more whose work is to convert the assets to binary formats. Binary formats have great advantages of reduced size over the original mesh files.

So the game I decided to create is an Exploration Game where you control a character and you can basically interact with the objects on the island as shown in the picture below:

bandicam 2015-12-18 17-54-58-352

The main mechanic of the game is that when you come in contact with an object, its color gets affected. As you see in this picture below, when the main character comes in contact with house the color changes to a deep blue.

bandicam 2015-12-18 17-55-17-756

After interacting with all the objects their final colors will look like shown in the picture below. So basically I am comparing the position of the character with the objects on the island and checking whether the character is withing the same x-z plane as the object. The way I am switching the color is that when the character is within the same x-z plane as the object, I am swapping the current material of the object with a new Material which is already loaded. The reason I decided to go with the swap is because at the time I did not know if I wanted to change the effect (transparent or opaque), or color (RGB) or whether I wanted to change the texture. So when the new material allowed me to change the things and see which one looked better. So ultimately for objects on the island I am just changing RGB values and for the sky I am changing the texture.

So one of the mistakes I was initially making was adjusting the positions in Maya and getting them in the game. So checking whether the character was touching other objects in the island did not work correctly. So later I exported the model without adjusting their positions and centered in Maya to the Assets and adjusted their position in the Engine Graphics. This made the character object interaction work correctly. So looks like even if you move around objects in Maya and export them their centers do not move .

bandicam 2015-12-18 17-55-27-767

There are other ways in which you can influence the environment. Basically if you press left shift the sky at the back turns to a sunset texture.

bandicam 2015-12-18 17-55-35-465

Finally, if you keep “0” pressed on the NumPad on your right, a fish will popup and go back as you keep the button pressed. The fish moves up and down in a sin wave which is done by taking the sin of the total seconds elapsed and multiplying that with a height to adjust the amplitude of the wave. The same principle applies to moving the water up and down in a wavering sinusoidal fashion.

bandicam 2015-12-18 17-55-47-789

The things I have learned is firstly how to make code platform independent and writing and reading binary files. I did not have much clue about what a binary file does in a game. So reading it was totally cryptic for me. But John Paul really explained the concepts about it really well and how to read and interpret the binary files, which will be very useful for my future projects.

Other things that I have learnt is how to design and architect code. I never payed much attention to designing code and organizing code but through this course I have learnt that it is very important. You can learn Graphics, Gameplay or AI but learning how to integrate them and read between the lines is important and is something that I have learned in the class and need to work on it more. I learnt about decoupling the code, abstraction , platform independence and most importantly the simplicity of lua files, so that you can understand it and there is a good amount of clarity.

My biggest take away from this class is the Asset Build  pipeline system specially using the Maya Mesh Exporter. On a whole this class has been a enjoyable experience where we focused our attention to the asset build system and also on the basics of Graphics. Many graphics books will explain you tricks but the things we have learned in this class is barely found in books. Such courses are really rare to find, and I will definately look back to the things I have learned in this class for future projects.

The Gameplay Video of my Game is as follows:

Gameplay Controls –

Use arrow keys to control character
1) Left And Right Arrow Key for moving in x axis.
2) Up And Down Arrow Key for moving in z axis.
3) Press X to rotate clockwise.
4) Press C to rotate anticlockwise.

Press Left Shift to Change to Cloudy Sky to Sunset.

Press “0” on the right NumPad and keep it pressed to see the Fish move up and Down.

Click the following link to download the game.

FinalProject

Estimated Time for completion – 20 hours.

Game Engineering || – EAE 6320 – Assignment_13

The main objective of this assignment is to add Textures to our models from Maya. Basically our material file will contain the path for the texture file which will be either in png or jpeg format.

Every texture will have their own texture coordinates which are called u,v coordinates. We need to add a uniform variable called sampler which will basically sample the texture coordinates which are exported from Maya.

In the Maya Exporter earlier we only had a pos and a color, but now we need to update the Maya Exporter so that it can include the textures. Basically we need update the Maya Exporter to add the u,v texture coordinates so that they can be exported to the Mesh files from Maya . We will also need to add the Texture Builder tool to process the texture files in the asset folder.

So the textures need to be associated with the Material Files so that we can add the textures to the material files and the material files itself would allow us to basically set the textures, effects etc. So basically the material file would allow us to make the game objects opaque or transparent, change the rgb color values and now add textures.

The following picture basically shows the blue transparent material lua file. Basically as discussed above the texure_data is addition to the file which contains the “sampler” and the path of the texture file.

texture

After adding the textures the binary file looks like as follows:

bandicam 2015-12-17 21-51-21-814

Basically after the null terminator of the uniform name, we see a “01” which basically indicates the count. So the material file is using only one texture and so the texture count is 1. Followed by the texture count is the texture path . It was easier to append the texture data after the  effect path and  uniform data since I didn’t need to change the existing effect path and uniform data information. I thought about adding the textures in materials rather than creating new struct for Textures but it was cluttering my materials so I basically added a new struct for the texture to prevent the cluttering of code .

Direct 3D Output

Direct3D

OPEN GL OUTPUT

OpenGL

If you basically notice the two outputs you will see that the Direct3D output is a but more sharper around the edges than the OpenGL output. This is because of the difference in the sampling rates of both the platforms.

Estimated Completion Time – 16 hours

The controls for camera are First Person Shooter controls as follows:
A –     to strafe left
D –    to strafe right
W –   to move forward
S –     to move backward
Space – To fly upward
Z –    to Dive Downward
E –    rotate Camera ClockWise
Q –   rotate Camera AntiClockwise

C-    rotate the man around the house in clockwise direction to guard          the house
X-   rotate the man around the house in anti-clockwise direction to             guard  the house

Use arrow keys to control the mans movement

Link To download :

Direct3D_Release_13

After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_12

Overall this assignment was really long and I found it pretty challenging since the instructions were not as straightforward as the other assignments. The order of the requirements were not given sequentially so it wasn’t clear whether to start from the top or the bottom. However, it was worth it to figure it out and learnt a lot.

The main objective of this assignment is create the material system in the game. So earlier the color of the mesh was based on the vertex colors that were in the mesh files. So if we had to add a different color to mesh we would have to create a new mesh file with different colors. Now in this assignment we can use the same meshes and use different colors with our materials that we have created.

Capture

The screenshot of my human readable file looks like as shown above.
The pathEffect is the relative path of the effect file. The UniformData holds different uniform information.
UniformName indicates the uniform name.
The ShaderType indicates the type of shader whether it is vertex or fragment shader . The values indicate the values of uniform .

Hex

The above picture shows the binary version of the effect_transparent.lua file which is the blue transparent material’s binary file.

The red highlight shows the path of the effect file. The yellow highlight shows 02 which indicates the number of uniforms which is 2. The pink highlight shows the uniform names . Since this is a transparent material it will the colorRGB as well as the alpha modifier. The green highlights are the null terminators. The blue highlight is basically the struct of the uniform data.

If this were a opaque shader then it would not have the alpha modifier . The picture below shows the binary file for an opaque shader which does not contain the alpha modifier. So you can only see the colorRGB for the case of opaque material.

hes opaque

The output is shown below.

It contains 4 box meshes which is using 4 different materials. The first two which is the red and the green are opaque and hence have no transparency in them. The last two are yellow and blue which are transparent materials. The yellow has the transparency of 0.3 while the blue has the transparency of 0.7 . Hence yellow box looks more clearer than the blue. The way you affect the transparency is by making the alpha modifier value for yellow box to be 0.3 and for the blue box to be 0.7.

bandicam 2015-12-07 00-00-33-977

I was getting a weird bug while doing this assignment. The bug was like a cracked screen and looked as follow :

bandicam 2015-12-08 16-56-59-875

Initially I though that I was not writing or reading the lua file properly but after looking at the binary files and then debugging the values that was not the problem. The problem turned out to be a simple one . I was not setting the path of the effect file due to which I was getting this weird pattern. But it took me quite a while to figure out this problem. Another problem that I faced was that my s_direct3dDevice was becoming null. The solution for that turned out to be that I was creating the material before CreateDevice() . So after moving that code for creating material , after the CreateDevice() was called, the device was not longer null. This again took me a long time to fix.

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

The controls for camera are First Person Shooter controls as follows:
A –     to strafe left
D –    to strafe right
W –   to move forward
S –     to move backward
Space – To fly upward
Z –    to Dive Downward
E –    rotate Camera ClockWise
Q –   rotate Camera AntiClockwise

C-    rotate the man around the house in clockwise direction to guard          the house
X-   rotate the man around the house in anti-clockwise direction to             guard  the house

Use arrow keys to control the mans movement

Direct3D_Release_12

After downloading the link run Game.exe.

 

 

Game Engineering || – EAE 6320 – Assignment_11

The main objective of this assignments is to create a Maya Exporter which is used to export a maya model in the human readable format. We can then use this human readable format and load it into the game. We also create a transparency effect for which we create render states for opaque and transparency effect.

So the work of the MayaMeshExporter is to convert the model in Maya to the human readable format. For that we have to write a function called WriteToMeshFile() according to our human readable format and this will convert the Maya model into our format.

As far as the dependency goes, the MayaMeshExporter is independent i.e. it does not depend on any other project in the solution. This is because its sole purpose is to convert the Maya model into the human readable format. You can pretty much just export the Maya model and build this MayaMeshExporter alone and independently and it will generate the human readable format for that particular model which is a great feature to have.

The following image shows the Plug-in Manager in Maya 2016. You can also see the two custom names. For my Release version the name is “eae6320_mankoo_hardit.mll” and for my DEBUG version the name is “eae6320_mankoo_hardit_DEBUG.mll”.

bandicam 2015-11-16 22-13-23-117

My scene below contains 4 meshes:

  1. House Mesh
  2. Man Mesh
  3. Floor Mesh
  4. Sphere Mesh

bandicam 2015-11-16 22-28-18-887

My output is as shown in the image above. You can see the transparency effect on the sphere which is between the man and house. Earlier I had given the same color for the triangle faces of the house and the man but it was looking like a flat a plane. So to give the model some depth I varied the color on the faces with the lightest colors on the left and darker colors on the right to give an effect as if there is a point light on the left of the scene. This process would be much simpler when we learn texture coordinates.

So basically the man, the house and the floor are opaque that is they have an opaque effect . This means that their alpha_transparency is disabled. Their settings are as follows:
alpha_transparency = false;
depth_testing = true;
depth_writing = true;
face_culling = true;

The sphere on the other hand which lies between the man and the house has the alpha transparency and the depth writing enabled. Due to this the sphere looks semi transparent and every object that lies behind it would be visible but would have the semi transparent effect for the objects that lie behind it and are covered by the radius of the sphere. And the objects that are in front of it will not have the semi transparent effect . They transparency settings are as follows:
alpha_transparency = true;
depth_testing = true;
depth_writing = false;
face_culling = true;

My effect.lua file looks like as follows . As you can see I have chosen to add all the render states in one table under “render_states” because it makes sense to club those 4 boolean values which represent the render states under one table. It makes it easier for me to understand.

bandicam 2015-11-16 22-42-55-605

Basically we store the the render states in a uint8_t variable. The uint8_t is a 8 bit data type. Even from those 8 bits we only use 4 rightmost bits which correspond to alpha_transparency, depth_testing, depth_writing and face_culling. Hence uin8_t is actually big enough and dont need to consider uint16_t so and so on.
So earlier I had harcoded the values but from the discussions in class it makes sense not to hardcode them and associate a name for each. The advantage of associating a name is that we done need to remember which bit represents which render state.
For this I just defined 4 names as follows:
bandicam 2015-11-16 23-09-38-943

I just used the same order that was given in the assignment page, i.e. alpha_transparency represents 0, depth_testing represents 1, depth_testing represents 2 and face_culling represents 3. Our render state is basically a combination of 4 values which are
Alpha Transparency, Depth Testing, Depth Writing and Face Culling. All of these are boolean which allows us to enable of disable them.
To enable or disable these values we use bitwise operations. So say we have our render_state_value and we want to enable the alpha transparency and we want to enable the depth testing . For this we need to do a bitwise OR operation so that we can set or enable the rightmost two bits as follow:

render_state_value|= 1<<0 . This enables alpha transparency.
render_state_value|= 1<<1 . This enables  depth testing.
So now our render_state_variable looks like 0011.

My opaque effect looks as follows:
bandicam 2015-11-16 23-45-30-165
My transparency effect looks as follow:
bandicam 2015-11-16 23-44-58-120

This is how my binary files look for the opaque and transparency effect.
If you look at the highlighted value for opaque effects it shows “0E” which is 0xE which is 1110 . The information we get from this is that alpha transparency which is the rightmost bit is disabled, depth testing which is the next one is enabled, depth writing is enabled and face culling is enabled. So the information is correct as the opaque objects have no transparency and matches the values in our human readable effect file.
Similarly if you look at the transparent effect, the highlighted value shows “OB” which is 0xB which is 1011. This means that the alpha transparency , the depth testing and face culling are enabled but the depth writing is disabled. This again matches our human readable file.

For debugging the meshes in Maya I created a primitive test model called BigBox.mesh .  So if you see the screenshot of the debugging below you can see in the i_fileName the name of the asset which is being debugged which is BigBox.mesh . It also provides the vertex buffer and the index buffer information for the model which is a very cool feature .

Debug Maya 11

Overall this assignment took me 17 hours to finish .

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

The controls for camera are First Person Shooter controls as follows:
A –     to strafe left
D –    to strafe right
W –   to move forward
S –     to move backward
Space – To fly upward
Z –    to Dive Downward
E –    rotate Camera ClockWise
Q –   rotate Camera AntiClockwise

C-    rotate the man around the house in clockwise direction to guard          the house
X-   rotate the man around the house in anti-clockwise direction to             guard  the house

Use arrow keys to control the mans movement

Direct3D_Release_11

After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_10

The main objective of this assignment was to draw a 3D cube to the screen. We basically converted our previous 2D looking square to a cube by making a couple of changes. Along with cube we also made a camera through which we can maneuver in the game.

The 3D cube looks like the picture below:

bandicam 2015-11-09 21-50-30-599

The first important thing we do to convert 2D to 3D is to add the third dimension z-axis to the sVertex struct. We start by adding a z coordinate to our lua mesh file and update the MeshBuilder to read the z value.

We are also creating a frustum with several features like the Field Of View which describes the angle within which we can see the world. We have a near and far clipping plane. Any object outside this range is not visible.

Now the other important thing is that instead of we need to perform a MVP matrix transformation which is model view projection. Initially all out meshes exists in a Local Coordinate System.
Now a local coordinate system is a system where the object has its own local center and its orientation and coordinates will be relative to it own center or pivot.

To know where this object exists in global space or the world we have to perform a Local To World matrix transformation. By doing the objects orientation and coordinates now become relative to the world.

Now that the object exists in the world, we need to bring the object in view of the camera. We need to know whether the camera view covers the object or not . So we need to orient and transform its coordinates relative to the camera and this is called World To View
transformation. We do this because if the object exists behind the camera in the world then it will not be within the camera view and hence will not be visible.

Like a painter draws 3D objects on a 2D plane, we now need to find the projection of the objects visible to the camera, on the 2D screen . For this we do the View to Screen transformation.

bandicam 2015-11-09 21-50-30-599

We also need to do an important thing i.e. enable the depth buffer. Earlier our depth buffer was false and did not store any depth information. Essentially what was happening before was that the order in which we were drawing objects, we were just stacking them on top of each other. So the last object drawn would be the most visible. So we use the Painter’s algorithm approach before which was inconvenient.

But now we do the the depth test. The depth value ranges from +1.0 to -1.0 where 1.0 is the deepest depth. The depth buffer basically stores the depth of the pixels. So the depth of the pixels are compared to ones in the depth buffer and the lower the value that pixel gets drawn. Hence lower the depth value the closer that pixel will be to our near plane, and higher the value(1.0 being the maximum) the further away that pixel will be from the screen. So we are basically clearing the depth buffer to 1.0 because 1 is the max value for the depth and we use a less than operator because we want to draw those pixels which are closer to the camera.

My floor mesh looks like as follows:
bandicam 2015-11-10 00-44-11-410
So from the picture there is now a z axis in the mesh file. Due to that the size of each vertex is now 16 bytes because of 4 bytes for each axis plus the color.

bandicam 2015-11-10 00-43-28-972
So my Camera exists in the Graphics because i felt it had more graphics related stuff than gameplay. My camera has several movement functions. I also have a camSpeed which can be adjusted to move the camera faster or slower.I have given several controls to the camera . The list of controls are mentioned near the download section. I figured the rotation part for the Camera. Took me some time to figure out. Actually I was not multiplying with the ElapsedTime due to which it was rotating very fast at Computer speeds and not it real time seconds. But it works properly now. I also added the rotations to the Cube. The cube rotation seems to be a bit orbital for now.The key bindings are given at the download section.

In the picture below I was just trying to draw some basic primitive 3D shapes in order to understand the winding order properly.

bandicam 2015-11-08 01-04-00-822

Time Taken – 18 hours.

Here’s a recording of the Camera and Cube Controls.

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

The controls for camera are First Person Shooter controls as follows:
A – to strafe left
D – to strafe right
W – to move forward
S – To move backward
Space – To fly upward
Z – To Dive Down
E – Rotate Camera ClockWise
Q – Rotate Camera AntiClockwise

C-Rotate Cube Clockwise
X-Rotate Cube AntiClockwise
Use arrow keys to control the cube movement

Direct3D_Release_10

After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_09

The main objective of this assignment was to make the Render() platform independent. So as you can see the picture  below I have split the Render in for Direct3D and OpenGL into Clear(), BeginDraw(), EndDraw() an ShowBuffer().

So there is basically no platform specific code within this Render function . It is platform independent. The implementation or the details would obviously differ depending on the platform. So the Clear() function basically clears the screen to black. We have the BeginDraw() and EndDraw() for the D3D implementation . For OpenGL I am just returning true for both the functions.

bandicam 2015-11-03 17-14-16-108

Below is the screen shot of my vertex shader . Had to take two screenshots so its half and half because it didnt fit the screen.

bandicam 2015-11-03 17-18-48-408

bandicam 2015-11-03 17-18-18-464

The vertex shader includes the shaders.inc which makes things more platform independent. I have also made the output position calculation platform independent. For calculating the output positions , I am however using the #if defined for OpenGL and Direct3D . The g_offset position is again common for both the OpenGL and Direct3D platforms.

My AssetsToBuild.lua screenshot is as shown in the image below where I have added the dependencies.

bandicam 2015-11-03 17-35-58-712

It took me around 6 hours to finish this assignment.

You can download the Zip File of Assignment_09 from the following link to get the square output. Use the arrow keys to move the red square.

Direct3D_Release_09

After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_08

The main objective of this assignment is to create builders for loading the binary shaders and effects during runtime. So to achieve this we had to create Effect Builder and Shader Builders .

The Effect Builder basically generates a binary format of an asset file . I have named the asset file effect.lua . The effect.lua basically contains the path of the shader file which is the for the vertex and the fragment shader.

For the Shader Builder I have created two shader builders which is VertexShaderBuilder and FragmentShaderBuilder. So I went with the option of creating two shader builders because it was less time consuming option at the time . The job of the shader builder is to generate the binary format of the compiled shader depending on the OpenGl or Direct3D platform.

My effect file format looks like the picture below and contains the path of the shaders.

bandicam 2015-11-02 12-50-55-728

So basically we just add a NULL character at the end of the fragment shader path and vertex shader path when we write to the binary file . I find this better than counting the characters everytime the path gets updated. You can spot the two null characters which look like “00” in the image below which show the Null characters at the end of both the shaders . On the right hand side you can see the path which is readable.

bandicam 2015-11-02 12-54-50-320

My updated AssetsToBuild.lua now contains the Effect Builder, VertexShaderBuilder and the FragmentShaderBuilder. The AssetToBuild.lua picture is as follows:

bandicam 2015-11-02 13-35-48-601

The release and debug version of the vertex shader for Direct 3D are shown below. You can see that the Debug Version of the Vertex Shader is a lot bigger than the Release version . This is because it contains some unnecessary information such a o_color, o_position etc . The release version is a lot shorter as it contains only the important necessary information for running the game.

Release Version of Vertex Shader (Direct 3D)

bandicam 2015-11-02 13-11-21-821

Debug Version of Vertex Shader (Direct 3D)

bandicam 2015-11-02 13-11-33-580

As you see in the picture below the Release Version of Vertex Shader for OpenGL basically has the Direct 3D part stripped off from the Vertex Shader and the comments are removed. Again the reason for comments to be removed is to reduce the file size.

Release Version of Vertex Shader (OpenGL)

bandicam 2015-11-02 13-20-57-053

In this assignment I ran up with a weird bug which was causing some
random patterns for the Direct 3D Release Output. I was not able to figure out what was causing the problem. But after debugging the problem with John Paul we figured that I had made some rookie mistakes and we found some hardcoded values for Direct3D platform which were causing the problem, that I had forgotten to update after reading the binary mesh file . But it was good that we fixed those problems, otherwise they would lead to more problems when doing 3D in the future assignments . So I was able to get those bugs sorted out. The bug looked like the image below:
bandicam 2015-11-02 15-56-06-406

Time taken for assignment was 15 hours. The assignment was not hard but it took some solving the weird bug .

You can download the Zip File of Assignment_08 from the following link to get the square output. Use the arrow keys to move the red square.

Direct3D_Release_08

After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_07

The main focus of this assignment is to move the red square or rectangle game object on the screen through the keyboard input. For the Input movement I used John Pauls code for Input Controls

bool UpdateEntities_vector()

This particular function uses the cVector from the Math library which was provided . So I just added the Time and Math as existing project.

So the red square gameobject moves on the screen using the arrow keys. The following images show the red square movement by using arrow keys.
bandicam 2015-10-20 16-08-46-774
bandicam 2015-10-20 16-08-56-874 bandicam 2015-10-20 16-08-58-600

 

To move the rectangle on the screen we can either update the vertex data or we can update the uniforms. The first method is not favorable as discussed in class because we have to update the vertex data every frame. So locking updating and unlocking the buffer is not an optimized way and so we use the method of updating the uniforms. Uniforms remain constant through one frame so it is more optimized.So we are simply modifying vertex shader to take a variable and modify the offset of the mesh.

Basically the triangle 1 on the left and triangle 2 on the right share the same mesh . So if you modify the mesh file it should be reflected on both.We also need to render a rectangle. So I now have a total of three game objects. Probably using a list in the future would be better.

It took me around 17 hours to finish this assignment because I made a couple of structural changes which added unnecessary complexity and so it took longer to complete. Its probably better to have a list of GameObjects in the future as we will have more of them,

You can download the Zip File of Assignment_07 from the following link to get the square output. Use the arrow keys to move the red square.

Direct3D_Release_07

After downloading the link run Game.exe.

Game Engineering || – EAE 6320 – Assignment_06

The main objective of this assignment is to create a binary version of our human readable mesh file. The reason we are doing this because this reduces the file size and significantly improves the runtime loading.

We have to make a couple of changes to the Mesh file . We basically have to move the code which reads the Lua file and migrate it from the Graphics project to the MeshBuilder. The reason we do this is so that the builder can covert the lua mesh file to the binary file.

bandicam 2015-10-06 11-07-31-514

The above image shows the binary file in a hex reader. The structure is the same as we discussed in the lecture. The first 4 bytes have the number of vertices. The next 4 bytes have the vertices. The next 12 bytes are the vertex struct and after that is the indices array.
The size of the binary is only 80 bytes which is significantly lower than the file of the mesh file which is 346 bytes .

The important thing to note and take care of is that the number of vertices needs to come before the vertices or in the other words the number of elements in an array must come before the array. The is because we need to know the number of elements to read before we actually start reading the elements. This is done so that there is clarity in the type of data that we are reading and also the number of elements that we are reading.

The following image shows the way I extract the information from the Binary File :-

bandicam 2015-10-06 12-00-18-570

The 3 advantages of the binary file format are:
1) Like I mentioned in the start , the reason we are converting the lua to binary file to reduce the file size which improves the runtime loading since no parsing is needed after loading the data from the file.

2)The file size of the binary is significantly lower than the lua file which is only 80 bytes as compared to 356 bytes of the lua file.

3) Another advantage is that we only need to order the data correctly in the corresponding memory blocks and read them in the read them in that correct order.

The binary have significant advantages as discussed above but they are hard to decipher and the lua mesh file are undoubtedly the better human readable formats. So it is better to keep them especially during debugging situations.

The next part of the assignment was to encapsulate the shader’s into the GraphicEffects class like we did for the case of Mesh in order to make it platform independent. I made the structure similar to the Mesh file structure.

Overall the assignment took me around 10 hours to complete . I learnt a lot about binary files and their purpose while working on this assignment. It was fun to finally understand and decipher the binary files which were a complete mystery to me before. I also read the email regarding the project dependencies and I have made changes to the project dependencies.

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

Direct3D_Release_06

After downloading the link run Game.exe.

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.

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.

Direct3d_Release_05

After downloading the link run Game.exe.