Game optimization Intro "Game optimization means improving the game application so it runs at the smooth framerate across a wide range of hardware specs, including low-end configurations. In this discussion we will discuss about some common Game optimization techniques irrespective of what Game engine you are using. Why do we care about game optimization Answer should be - To serve the Users with better gameplay experience and to avoid user complaints like this There are tons of devices out there in market and it becomes responsibility of the developer to take care about every possible hardware configs for maximum reach and positive user experience. What is happening under the hood CPU processes the Player inputs and doing mathematical and physics related tasks. CPU send instructions to the GPU to render or draw the frame on the screen. So the CPU and GPU working together to bring the game on the screen with optimal frames per second (30 fps on mobile and 60 fps or more on gaming console). CPU vs GPU A CPU with 4 (6 or 10) Cores. A GPU with Thousands of Cores. Different Game Optimization techniques ● Reduce and Combine Textures ● Use Occlusion Culling ● Batching Draw Calls ● Using LOD (Levels of Details) ● Lightmapping ● Tweaking Quality Settings ● Code Optimization These techniques applicable and common to all Game engines. Reduce and combine Texture Low number of Textures will put low pressure on GPU. To use New Texture GPU has to change the Render State to load New Texture before drawing them on screen. Render Texture Change Request Happening for each Separated Textures which needs to drawn on screen Separate Images -> Solution : We can merge multiple seperated images into Single Large image known as Sprite-Sheet. Render Texture Change Request Happening only once at start and now it can extract the required images from the Loaded Texture Single Merged Image -> Use Occlusion Culling Draw only what Camera can see. Occlusion Culling is a feature that disables drawing of objects when they are not currently seen by the camera because they are obscured (occluded) by other objects. This way we can Avoid - ● Drawing Objects unnecessarily ● Loading Textures for Them ● Calculating effects of lights for them ● Calculating effect of shadows because of them ● etc. Batching draw calls Control on number of Draw calls. Draw Call: Draw calls are simple plain command from CPU to GPU to draw something on Screen with Specific Set of Draw properties(visual information).Like Draw a Chair. SET pass: SetPass is the process of loading material data like Textures, Normal Maps and Shader properties. Like to Draw the chair it needs to load the Material data and Textures. Before Batching <- After Batching -> Using lods (levels of detail) Show Level of quality depending on distance from camera. What is LOD: LODS are basically different levels of the same 3d model which we can enable based on the distance from the rendering camera. When some objects are far from the camera view there is no need to draw that object in high detail as it does not make sense. We can use low quality version of the same model to draw at that moment and as the camera comes close we can promote the quality higher level. Lightmapping Baking light to avoid calculating lights in every frame. What is lightmapping: Lightmapping is the process of pre-calculating the brightness of surfaces in the Scene. ... Lightmaps allow you to add global illumination, shadows, and ambient lighting at a relatively low computational cost. Advantage of lightmaps: As Lightmaps are precalculated the GPU does not need to recalculate effects of lights on the scene ever frame and it can use the Precalculated lightmaps for this purpose which makes the over all performance more smooth. Tweaking Quality Settings Set quality based on the Target device.