My views on Assignment 4 (Game Engineering)
A downloadable game
- Game screenshot
(Figure 1.0 Default Game screenshot with two objects using different effect)
- A frame with just one object while pressing a button
(Figure 1.1 Game screenshot showing one object while a button is held down)
- Rendering two objects with similar effect (In other words using similar effect for both objects.)
(Figure 1.2 Game screenshot with two objects using similar effect)
- How to submit the background color to Graphics from MyGame
- Passing an array of 4 floats (R,G,B,A)
(Figure 1.3 Code snippet sowing the interface to submit color)
- How to submit data to Graphics each frame
- Create an Array of struct “RenderinData” (keep the size 2 because it is the maximum size for now. If you pass more than two, it won’t get rendered)
(Figure 1.4 code snippet displaying the process of declaring an object for rendering data)
2. Fill in data as per your preference about the object you want to draw with particular effect (make sure you set the bool variable to true if you want it to render. Set it to false if you want some particular behavior on inputs or other events. )
3. Submit data to graphics by calling the function mentioned in figure(1.5) and pass in the array object as argument.
(Figure 1.5 code snippet displaying the process of filling and submitting data to render)
- The Factory Release Interface
- I thought it makes more clear for user to use simple factory release(delete) function rather than actually decrementing the reference count and setting the pointer to null. I am handling that on my end in factory function while user just make a call to release that object by passing it to the function.
- User should assume that the pointer is destroyed(ie. it's not usable anymore.)
- I am not very confident on this decision but I tried to make a simple interface for users (game developers).
- Following is the interface for that.
(Figure 1.6 code snippet displaying factory function to release objects)
- The reasons why we have to submit things to be drawn and cache it before drawing them.
- We want to start calculating the data for the next frame and don’t want to wait until the current data gets rendered.
- We have two variables of data for a frame and we want to use them for two different tasks at the same time ie. one for rendering and the other for submitting. This prevents frame delay on the screen if one of the tasks takes too much time.
- Let's talk about size and memory now.
Following is the table displaying the amount of memory each object takes in different platforms
Platform | Geometry | Effects |
x32 | 20 Bytes | 20 Bytes |
x64 | 32 Bytes | 16 Bytes |
- In Geometry object, I am storing the required 3 buffers data and an unsigned int variables for storing index count which takes. I don't see any further way to decrease the size however we can add other variables like number of triangles which can result increasing the memory consumption.
- In Effect object, I am storing the minimal data (not storing any information that requires one time use like shader path variables). I can't seem to find any way to decrease the consummations here as well.
- Total memory required in Graphics to render the frame
Platform | Total Data require to render Single frame | Total Data held by Graphics (twice because we have two objects) |
x32 | 172 Bytes | 344 Bytes |
x64 | 200 Bytes | 400 Bytes |
- Calculation
x64:
s_frame (144) + color (8) + (2 * renderingPair(24) )
=> 200 * 2 (two var) = 400 Bytes
x32:
s_frame (144) + color (4) + (2 * renderingPair(12) )
=> 172 * 2 (two var) = 344 Bytes
- I am not counting the memory for the data that is pointed by because I think it is held by the objects that created it. We only hold a reference to them.
- Took me around 12 hours to finish everything.
Download
Install instructions
- Unzip the folder
- Run the exe file
Leave a comment
Log in with itch.io to leave a comment.