![](https://static.wixstatic.com/media/edafc906071647ad940aad43e3fdbe07.jpg/v1/fill/w_1920,h_1272,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/edafc906071647ad940aad43e3fdbe07.jpg)
ROHAN PATEL
My views on Assignment 8
Game Screenshot
Credits:
Geometry in the screenshot by my fellow classmate
Danny Diaz
![SS.PNG](https://static.wixstatic.com/media/dfb871_7ef878d5cdb749eaa5366e877ee61f39~mv2.png/v1/fill/w_455,h_477,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/SS_PNG.png)
Binary Geometry file
![BitsCapture.PNG](https://static.wixstatic.com/media/dfb871_112fa85171854e9b9e482aea4dab29ab~mv2.png/v1/fill/w_429,h_526,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/BitsCapture_PNG.png)
I chose the following order while writing them.
1) Vertex size (uint32_t)
2) Index size (uint32_t)
3) vertex array
4) Index array (uint32_t)
-
In the picture you can see the first four bytes with blue color, They represent vertex size. The next four green bytes represent the index size.
-
The yellow bits are the vertex array. next to that, the red-brownish bytes are index array.
Advantages of using Binary Geometry file over human-readable
-
First, as we will see next in the article and very obvious reason is that the size is smaller for binary files which are a plus point for us.
-
Second, I think it is a good way of storing them while shipping the product on different platforms as most of the platforms have a pretty easy way of reading binary files rather than installing other human-readable files external libraries.
-
We use human-readable files to store in source control because it is easy to change for a non-engineer guy, but we use binary format to read the file in order to optimize the performance and make the reading operation faster.
-
Also, both platforms (64 and 32) will have it's own different built binary files as we use different winding order for the geometry index data.
Extracting Geometry data from a Binary file
I use the LoadBinaryFile() to load the data as a chunk of memory and then traverse using the offset.
![extractData.PNG](https://static.wixstatic.com/media/dfb871_8d1608acf25041b898f79164d272d649~mv2.png/v1/crop/x_0,y_2,w_888,h_691/fill/w_888,h_691,al_c,q_90,enc_avif,quality_auto/extractData_PNG.png)
Comparing the sizes between Lua vs Binary file
At this point, I already converted my geometry to use uint32_t type, so the following comparison is based on that.
Total vertices in the Geometry: 116,336
Lua vs Binary
Size (MegaBytes)
7.42
2.10
Loading Time
(Seconds)
3.95914
0.04499
0.00018
0.000815
0.000132
0.000048
Clearly there's a significant amount of difference that can be decisive for sure in terms of larger-scale projects
Instructions to install and play
-
Unzip and run the exe file
-
Arrows to move the object
-
W S A D for camera movement and G H for zoom
-
Control and shift to switch player controller and shape of an object