top of page

Assignment 5

1. Show a screenshot of your game running.

2. Show us your representation of a game object/thing/entity (it's ok to show the actual class/struct/whatever definition for this). Explain what data you store and why that is helpful for the game.

The game object struct stores pointers to the mesh and effect which are necessary for rendering, and a rigid body state struct which includes the transform.

Screenshot 2024-09-27 133044.png

3. Show us your interface being used for submitting your game objects to be rendered.

​In cMyGame, the interface SubmitGameObjectsRenderData is implemented, which takes the camera, background color, the count of submitted game objects, a list of game objects, and also the elapsed time since last simulation. The function then gets the mesh, effect, predicted transform for each game object, and submit them to the Graphics.

Screenshot 2024-09-27 135051.png

4. Tell us how the size (in bytes) of the data that you need to store now for each draw call (how much memory does the graphics system need to cache in order to draw a mesh)?​

For the Graphics project, there are following static variables

  a. 1 pointer of cView(sView) 

  b. 2 constant buffer(s_ConstantBuffer_frame, s_ConstantBuffer_drawCall) 

  c. 2 sDataRequiredToRenderAFrame(s_dataBeingSubmittedByApplicationThread, 
s_dataBeingRenderedByRenderThread)

  d. 2 cEvent(s_whenAllDataHasBeenSubmittedFromApplicationThread, 

s_whenDataForANewFrameCanBeSubmittedFromApplicationThread)

​

Within the static variables, following are used to draw a mesh:

  a. 1 draw call constant buffer(s_ConstantBuffer_drawCall) 

     -> 12 bytes for 32 bits, 24 bytes for 64bit

  b. 2 sDataRequiredToRenderAFrame(s_dataBeingSubmittedByApplicationThread, 
s_dataBeingRenderedByRenderThread)

     -> 172 * 2 = 344 bytes for 32 bits, 184 * 2 = 368 bytes for 64bit

​

Inside the sDataRequiredToRenderAFrame struct, following are used to draw the mesh:

  a. pointer to meshArr(m_meshArr) -> 4 bytes for 32bit, 8 bytes for 64bit

  b. pointer to effectArr(m_effectArr) -> 4 bytes for 32bit, 8 bytes for 64bit

  c. pointer to localToWorldTransformMatrixArr(m_localToWorldMatrixArr) -> 4 bytes for 32bit, 8 bytes for 64bit

Screenshot 2024-09-27 140230.png

5. Explain why extrapolation/prediction is necessary when rendering with our engine? (How does the simulation update relate to rendering?)

​The frequency of simulation is less than the frequency of render. If only updating the transform at simulation, the object can stay in one place for several frames, and thus leading to jerky movement. Therefore, it's necessary to predict the position when rendering. The object then moves every frame.

©2024 by Junxuan Hu, a gameplay programmer and technical designer.

Proudly created with Wix.com

bottom of page