Making a 2D game with responsive resolution

Posted by alexandervrs on Game Development See other posts from Game Development or by alexandervrs
Published on 2012-12-13T09:49:28Z Indexed on 2012/12/13 17:18 UTC
Read the original article Hit count: 375

Filed under:
|
|
|
|

I am making a 2D game, however I wish for it to be resolution agnostic.

My target resolution i.e. where things look as intended is 1600 x 900.

My ideas are:

Make the HUD stay fixed to the sides no matter what resolution, use different size for HUD graphics under a certain resolution and another under a certain large one.

Use large HD PNG sprites/backgrounds which are a power of 2, so they scale nicely. No vectors.

Use the player's native resolution. Scale the game area (not the HUD) to fit (resulting zooming in some and cropping the game area sides if necessary for widescreen, no stretch), but always fill the screen.

Have a min and max resolution limit for small and very large displays where you will just change the resolution(?) or scale up/down to fit.

What I am a bit confused though is what math formula I would use to scale the game area correctly based on the resolution no matter the aspect ratio, fully fit in a square screen and with some clip to the sides for widescreen.

Pseudocode would help as well. :)

© Game Development or respective owner

Related posts about 2d

Related posts about graphics