<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" >

<channel><title><![CDATA[Shantanu Pandey - Game Engineering - Week 5]]></title><link><![CDATA[https://www.codenamepandey.com/engineeringweek5]]></link><description><![CDATA[Game Engineering - Week 5]]></description><pubDate>Fri, 11 Oct 2024 08:00:42 -0600</pubDate><generator>Weebly</generator><item><title><![CDATA[Week 5 - 09/19/2018]]></title><link><![CDATA[https://www.codenamepandey.com/engineeringweek5/week-5-09192018]]></link><comments><![CDATA[https://www.codenamepandey.com/engineeringweek5/week-5-09192018#comments]]></comments><pubDate>Thu, 27 Sep 2018 05:58:18 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">https://www.codenamepandey.com/engineeringweek5/week-5-09192018</guid><description><![CDATA[This week&rsquo;s assignment required us to add a camera to our existing. Game can usually have more than one camera, so it was up to the game programmer to submit the camera the graphics should use to render the objects. Another part of the assignment was to add a representation of Game Object. Instead of sending mesh and effects, the game programmer will now submit the game object to graphics for rendering.Game ScreenshotsPlayable EXE DownloadControls: W S A D to move game object&nbsp; &nbsp;  [...] ]]></description><content:encoded><![CDATA[<div class="paragraph"><font color="#2a2a2a">This week&rsquo;s assignment required us to add a camera to our existing. Game can usually have more than one camera, so it was up to the game programmer to submit the camera the graphics should use to render the objects. Another part of the assignment was to add a representation of Game Object. Instead of sending mesh and effects, the game programmer will now submit the game object to graphics for rendering.<br /><br /><strong>Game Screenshots</strong><br /><a href="https://drive.google.com/uc?export=download&amp;id=19kYv8aAB_vuBOCwXP1p31UB84rizuwlu" target="_blank">Playable EXE Download</a><br /><strong>Controls: </strong>W S A D to move game object<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Up Down Left Right to move camera<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ctrl to switch the mesh of game object</font></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0px;margin-right:0px;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/combine-1_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%">Image of Game object with rectangle mesh and when the mesh is changed to other mesh (triangle) on Ctrl press</div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0px;margin-right:0px;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/combine-2_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%">Same Game object with two different meshes (Ctrl Press) but the position is changed by W S A D movement keys</div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0px;margin-right:0px;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/camera-moved_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%">Image when Camer is moved with Up Down Left and Right. Note that center triangle white mesh is a different location since camera is moved.</div> </div></div>  <div class="paragraph"><font color="#2a2a2a"><strong>Game Object</strong><br />I have added my GameObject class to the Graphics project. I felt this might not be the right place to add this class as Game Object is not technically a part of Graphics, but because of the complexity of the project (and I was avoiding creating a new project), I decided it was OK to add it to the Graphics project.<br /><br />[Edit: We had a discussion about this in class, and it was OK to add it to the Graphics project. Only thing to make sure here is not to add GameObject class to MyGame project.]<br /><br />Below is my Game Object class. It store a point to mesh and effect (which make ups its renderable component), and a rigidbody for movement.</font></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/game-object_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><font color="#2a2a2a"><strong>&#8203;Graphics Changes</strong><br />Since we will be using the extrapolation of game object transform for rendering, I am using the below interface to submit data to graphics</font></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/submit-game-object_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div class="paragraph"><font color="#2a2a2a">Along with passing the mesh and effect as usual, we will now pass the predicted transform of game object as well. This predicted transform is used in per draw call and now we will store this data as well in our data required to render frame struct.&nbsp;<br />Below is the data required to be stored for a draw call (mesh effect pointer and transform matrix)</font></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0px;margin-right:0px;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/data-req-x64_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%">Data required by graphics to draw a mesh - DIrect3D(x64) - The values are high as I have defined an array of length 5 for both.</div> </div></div>  <div><div class="wsite-image wsite-image-border-none " style="padding-top:10px;padding-bottom:10px;margin-left:0px;margin-right:0px;text-align:center"> <a> <img src="https://www.codenamepandey.com/uploads/1/1/0/8/110865341/data-req-x86_orig.png" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%">Data required by graphics to draw a mesh - OpenGL(x86) - The values are high as I have defined an array of length 5 for both.</div> </div></div>  <div class="paragraph"><font color="#2a2a2a"><strong>Need for Prediction/Extrapolation</strong><br /><br />The game update and graphics update run at different speed. The game update happens based on the game frame rate we set (15 in our case), and it is where we actually update our game objects. We have the function UpdateSimulationBasedOnTime() function in our game class for updating the objects. However graphics thread runs at a much faster rate. As the graphics thread is faster and game simulation is slower, we would get a jerky movement of objects without extrapolation.<br />We will pass the extrapolated transforms of the object to the graphics thread to tell it where to render in the next frame. One thing I initially did wrong here was while passing these extrapolated transforms, I was also updating the actual transform of the object. The jerky movement was gone, but the object was moving way too fast because of two updates happening to object&rsquo;s position (extrapolation and normal game object update).&nbsp;</font></div>]]></content:encoded></item></channel></rss>