EAE6320_Assignment8
A downloadable game
About the Assignment
This assignment is about writing and reading binary data. Know the advantages of using Binary files at run time.
Controls for movement
WASD – Move the Camera in respective direction
Q – Zoom in camera
E – Zoom out camera
Arrow Keys – Move the sphere in corresponding arrow direction
Screenshots
Screenshot of my game showing the plane, a sphere and the pokemon Mew😉
Code showing how I read data from the binary file
How I finished the assignment
This assignment is a lot simpler compared to others. For the first part there is only migrating code from Graphics project to GeometryBuilder project. Then writing and reading binary data was easier once I read the corresponding docs. I did the optional challenge to load a recognizable object. I loaded the Mew pokemon from a free to use website. I also added colors to my vertex data (which I should have done earlier).
Order of writing the data to binary file
My binary file for the plane object.
I followed the order vertex count, vertex array, index count and index array. The reason I followed this is because in order to access my vertex array I needed vertex count first. This thing is true with the index data too. So I read the count values first and then the array data. In the above image,
Vertex count – Black rectangle
Vertex array – Red rectangle
Index count – Blue rectangle
Index array – Purple rectangle
Uses of binary data
It’s a lot faster to read or load. It’s compiler friendly, it doesn’t need to convert the data back to binary when compiling when it is already in binary. The human readable files aren’t necessary at runtime because we don’t want to read that (humans don’t or need not want to read that) if they want to, they can always look at the source control file. And as I said, it becomes a lot faster to read the file in runtime.
Different Geometry Files for different formats
Yes, we need to have different files for different formats. Since, we are building our game into a platform specific folder, it is optimal to have different files for different formats, that way we do not need to process the indices data at run time because it is already built in the correct winding order. The changes I needed to do for this is add platform specific code for Direct3D to convert the winding order in the GeometryBuilder project and removed that code from the actual cGeometry3D class.
Maya object with too many vertices
I created a helix object with 43,110 vertices.
Size on disk
Lua – 4496KB
Binary – 800KB
Time for loading the file and reading it
Lua – 0.133522 seconds
Binary – 0.000637 seconds
That is a significant difference of time.
Leave a comment
Log in with itch.io to leave a comment.