Screen "tearing" on mobile low-res game

0 favourites
  • 5 posts
From the Asset Store
High Low is a casino game using luck and points accumulation.
  • Hi there, I'm working on a mobile, low-res game that uses Sprite Font objects, Low "Fullscreen quality", and the Scale inner "Fullscreen mode". The dimensions of the viewport are very tall, so it can cover any device with any display aspect ratio. The viewport starts at 180 x 540, and on my device for example (Google Pixel 3XL, 1440 x 2960) it resizes to fit the phone at a resolution of 180 x 369.61165...

    The problem I'm running into is that this decimal number height seems to cause the images to tear near the bottom, assuming because it has to do some rounding to keep the pixels crisp. Please see the following video and screenshot where I move a Sprite Font object over the tear, you can see the problem happening near the bottom of the debug text window, it's a pretty dramatic and unwanted effect:

    Video: https://1drv.ms/v/s!AnfGCnwpFF_Yg6sUxYNhIoaERPB0-Q?e=epLfkX

    Screenshot: https://1drv.ms/u/s!AnfGCnwpFF_Yg6sWWVxdQ5v2DXSsEA?e=CZaQ8V

    My question is, what can I do about this? Has anyone else experienced this problem?

    Thanks for your help :)

  • I just tried converting to Scale Outer instead, but this did not help the problem. I also tried manually setting the canvas/viewport size to integers but when using the Scale Inner/Outer modes it appears the engine overrides any manual changes.

    I'd really rather avoid turning off automatic scaling and doing it myself, but if I have to I guess that's what I'll do :/

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Okay so to work around this issue I had to do the following:

    1) Set the original canvas size to a square, 180 x 180. This allows me to adjust the height manually to fit screen size.

    2) Set Fullscreen mode to "Letterbox scale". This centers the square canvas on the screen with black bars on the top and bottom.

    3)On Start of layout -> Set canvas size:

    - Width = OriginalViewportWidth

    - Height = floor(PlatformInfo.ScreenHeight/(PlatformInfo.ScreenWidth/OriginalViewportWidth))

    This sets the height of the canvas to the size of the screen, but to an integer value. I use Floor instead of Ceil or Int because if the height ended up larger than the screen height then we'd get tiny black bars on the right and left sides of the screen.

    ADDITIONAL NOTES:

    In my tests this only works on Mobile, not in preview mode in my browser on PC. So when setting the size you'll want to use PlatformInfo to check "Is on mobile". If so, use this scaling technique. If not, you must figure something else out. In my case, when not on mobile I decided to force the canvas size to [OriginalViewportWidth] x [floor(OriginalViewportWidth*(16/9))].

    Code to copy in to C3 if you want to use this method:

    {"is-c3-clipboard-data":true,"type":"actions","items":[{"id":"set-canvas-size","objectClass":"System","parameters":{"width":"OriginalViewportWidth","height":"floor(PlatformInfo.ScreenHeight/(PlatformInfo.ScreenWidth/OriginalViewportWidth))"}}]}

  • "Scale inner", "Scale outer" and "Letterbox scale" can all use fractional zoom levels to fit the size of the display. Fractional zoom levels mean pixel art doesn't fit exactly to display pixels, and so aliasing (the kind of ripple artefacts you were showing) can occur. The only fullscreen mode that exactly preserves pixel art is "Letterbox integer scale", which was designed specifically for the purpose. You also need the other settings to optimize for pixel art as described in the manual.

    There are probably other techniques and approaches - for example I expect using high quality fullscreen mode and nearest sampling with any fullscreen mode would look OK, because any aliasing will only happen at the level of a display pixel rather than a game pixel, and that may well be small enough to not notice it. But the problem is still happening, it's just much reduced - and it will have other consequences for things like the resolution of text objects. I guess you could also try to hack it like you described, but the "optimize for pixel art" settings are the ones that are known to work in all circumstances, as far as I know.

  • Thank you for the response! I'll look into this guide. I might also try High Quality full screen, and apply a (relative) 1px Mosaic effect on any scaled images.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)