title: How to design a game for multiple resolutions?
body: <p>Trying to figure out a good solution for handling different resolutions and resizing in a 2D side-scrolling shooter game build with OpenTK (OpenGL).</p>
  
  <p>Ortho is setup as follows.</p>
  
  <pre><code>    private void Setup2DGraphics()
      {
          const double halfWidth = 1920 / 2;
          const double halfHeight = 1080 / 2;
          GL.MatrixMode(MatrixMode.Projection);
          GL.LoadIdentity();
          GL.Ortho(-halfWidth, halfWidth, -halfHeight, halfHeight, -1.0, 1.0);
          GL.MatrixMode(MatrixMode.Modelview);
          GL.LoadIdentity();
      }
  </code></pre>
  
  <p>Ortho fixes to 1920*1080 to keep the ortho fixed size. Changing size would change game behaviour. Objects movement is set to pixels/sec etc.</p>
  
  <pre><code>    public void ResizeWindow(int width, int height)
      {
          var screenSize = GetOptimalResolution(width, height);
  
          var offsetHeight = screenSize.Y &lt; height ? (height - screenSize.Y) / 2 : 0;
          var offsetWidth = screenSize.X &lt; width ? (width - screenSize.X) / 2 : 0;
  
          // Set the viewport
          GL.Viewport((int)offsetWidth, (int)offsetHeight, (int)screenSize.X, (int)screenSize.Y);
      }
  </code></pre>
  
  <p>GetOptimalResolution returns the viewport size in order to maintain a 16:9 aspect ratio. Example: If screensize is 1024*768, it resturns 1024*576 (shrinking height). It then places the ortho higher in the viewport using half of the height difference as offset. This results in black bars above and below the windows.</p>
  
  <p>This setup works. It prevents aspect ratio issues on all resolutions. However I'm questioning myself if this is the right way to do it? The issues I can think of with this design:
  - On resolutions lower then 1920*1080, the view is scaled down. This has an effect of how sprites look. For example, text starts to look horrible when scaled down.
  - If turning down resolution for performance, will this have an effect if the ortho stays the same size?</p>
  
  <p>Did a lot of searching on this topic but so far the only things I can find is plain instructions on how to perform actions, rather then to build solutions. I also found out that using Mipmap's might solve my scaling issue. However the question remains, am I on the right track? Should I look at the aspect ratio problem from a different angle?</p>