Fixed Frame Rates in Unity

<p>Many people will tell you to make your game frame rate independent. While there&rsquo;s certainly a lot of merit to this, a fixed frame rate is desirable for some games, most notably deterministic pixel art games.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*FwpUxXRSvmhowfIzcDbWvg.png" style="height:399px; width:700px" /></p> <h1>Why a fixed frame rate?</h1> <p>If you want your game to be deterministic, a fixed frame rate is probably the best option. If a jump can play out over a varying amount of frames, the jump could be slightly different for different frame rates, in part because of floating point precision, but also because the frame where you reached the peak could be skipped at lower frame rates.</p> <p>Another reason to have a fixed frame rate would be pixel art games. As an example, let&rsquo;s assume your character walks at a pace of 4 pixels per frame at 60fps. At 75fps, you&rsquo;d need to move at 3.2 frames per frame. In both cases, your character would walk 240 pixels per second.</p> <p>But in a pixel-perfect game, moving something 3.2 frames is problematic. If you snap everything to the pixel grid, this would result in visibly moving 3 pixels for the first 4 frames, and then 4 pixels on the next. So the movement wouldn&rsquo;t be constant or smooth.</p> <p><a href="https://gamesfromearth.medium.com/fixed-frame-rates-in-unity-e5fcfe014f35"><strong>Learn More</strong></a></p>
Tags: Frame Rates