Thursday, March 15, 2018

mathematics - building a game for different resolution phones


I am starting some tests for building a game on the Android program. So far everything is working and seems nice.


However I do not understand how to make sure my game looks correct on all phones as they all will have slightly different screen ratios (and even very different on some odd phones)


What I am doing right now is making a view frustum (could also be ortho) which I set to go from -ratio to +ratio (as I have seen on many examples) however this causes my test shape to be stretched and sometimes cut off by the edge of the screen.



I am tilting my phone to landscape to do my tests (a bit extreme) but it should still render correctly if I have done things right.


Should I be scaling by some ratio before drawing or something?


An example would be greatly appreciated.


PS. I am doing a 2D game .



Answer



From a high-level perspective there's only a handful of options, depending on which is more important, maintaining a consistent aspect ratio, or ensuring that no one to see more than someone else just because they have a wider or taller screen.


Your options are:



  1. Cropping the parts that don't fit.

  2. Stretching the screen to fit, which has the issue you're seeing of stretched images.


  3. "Letterboxing" which maintains both aspect ratio and ensures that no player sees more than any other player because of their screen size,


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...