EAE6320_Assignment4_WriteUP

Add to
My games
Add to
Wishlist
Save to
Collection
No reviews
Exceptional
Meh
Skip

About

Details of Assignment:

  • The main part of the assignment was to pass data from game to graphics using threads and reference count the data so that it is not override by new data

Running Part of Assignment:

  • There are 4 different changes that occurs in the game
  • 2 of them are based on user Inputs and other 2 are based on time
  • Space-bar is used to remove the bottom triangle object
  • Tab is used to use a different effect on the top square Based on time a third object will be visible, while the object is visible the bottom triangle will have 1 effect and, the bottom triangle will have different effect when the third object is not visible

Fig 1. Default state of background

Fig 2. Lower object not visible when space is pressed

Fig 3. Square has different effect when tab is pressed

How I reach at this Point:

  • The biggest challenge I faced doing the assignment is know where the data need to be initialized in the game code
  • After words I had to try many ways to make the data pass because of a silly mistake I did to create my new object effect pair structure
  • I also faced few difficulties while cleaning my data, as I was not cleaning the thread cache data on graphics cleanup Finally, to reduce my size of object I did few changes to my cache data
  • Also, for passing my object-effect pair I have create a new struct with pointers to object and effect, I am creating an object array and a graphics array through which I create different pairs of object and effect and pass their reference to object-effect pair  

Fig 4. Submitting my back-buffer color to graphics for caching

Fig 5. Passing reference to the object-effect pair’s object 

Fig 6. Passing the object-effect pair structure array to graphics for caching it

  • Threads are used for doing multiple tasks at the same time, there by utilizing both application and engine to maximum potential.
  • But, both engine and application share the same data between them there by each have to wait for other to do their work.
  • By caching we are actually making the application to make data for current frame cache it and start working on the next frame, while at the engine side it will start using the cache data without waiting for application to pass the data.
  • Doing do actually leads to latency so having more cache data will increase the amount of latency in the game.

 

  • My effect class object takes 20 bytes of data in OpenGL and 16 bytes of data in Direct 3D.
  • For both Direct 3D and Open GL there are 4 common variables which holds the shader data (vertex shader, fragment shader, rendering state and reference count), each being 4 Byte, while Open GL has extra 4 bytes for program ID which hold data for your program and links your shaders to it.
  • My Graphics class object takes 20 bytes of data in OpenGL and 32 bytes of data in Direct 3D.
  • My Geometry class has 4 variables for both Direct 3D and Open GL, 2 common and 3 separates.
  • The common variable is the length for index buffer and reference count which are 4 Bytes each.
  • The need for index count is because we need to know how many objects are created which can be easily know by length of index buffer as that many vertices needs to be drawn on the screen. 
  • Open GL has 3, 4 Byte variable, each for storing ID for index buffer, vertex buffer and vertex array.
  • On the other hand, Direct 3D have 2 pointers to the buffers (index and vertex buffers) which are 8 Bytes each and a 4 Bytes vertex format and 4 bytes are wasted extra because the buffer size becomes a block of 8 Bytes each there by 28 bytes used and 4 bytes wasted.
  • My cache data was originally 360(180*2) bytes for Open GL and 416(208*2) Bytes for Direct 3D, but I reduce them to 320(160*2) and 356(176*2) bytes respectively.
  • My cache data was storing 3 float variables which were 4 bytes each, and separate pointer arrays for graphics and effects which were 8 (for Direct 3D) or 4 (for Open GL) X size of array, in my case 24 bytes and 12 bytes respectively, and a 144 bytes frame data
  • To reduce them I change the 3 color float variables to a color class pointer which reduced the size by 8 bytes in Open GL and 4 Bytes in direct 3D
  • Then, I change separate effects and object pointer arrays to a single object-effect pair pointer array which reduce 12 Bytes in Open GL and 24 Bytes in Direct 3D.
  • Also, these values don’t include the actually memory used by pointers as the as the object will store only the 8/4 bytes data as that much memory is needed for object to get all the data.

 

Optional Challenge:

  • For animating the background, I am actually using the GetElapsedSecondCount_Simulation function from cbApplication and using sin functions I am creating new values for color each frame.
  • For changing the object or effect based on time, I am getting the simulation time and making the object render for 1 second and then make it not render for another second
Platforms
Release date
Developer
M17D05
Age rating
Not rated
EAE6320_Assignment4_WriteUP screenshot, image №2178704 - RAWG
Edit the game info
Last Modified: Sep 20, 2019

Where to buy

itch.io