Android Camera screwing up graphic

Discussion in 'GameMaker Studio 2 Community Tech Support' started by I'm lost, Aug 12, 2019 at 2:09 PM.

  1. I'm lost

    I'm lost Member

    Joined:
    Jul 11, 2018
    Posts:
    18
    Hello everyone,
    I'm so sick of this problem and 'Ive been trying to solve it for such a long time, that I've decided to look for help somewhere else.

    I'm talking about cameras. In all of my games I have one big problem with cameras. And that is smooth camera movement to player. I have this simple easing camera movement code:
    Code:
    camera.x = (target.x - camera.x)/20;
    camera.y = (target.y - camera.y)/20;
    
    At the first sight, it works really well, the camera is smoothly following player. But then I noticed when camera is just few pixels from it's target, and it's x and y position is gaining high amount of decimal places, it starts to deform every sprite and background, that room contains. I tried rounding this x and y position, this reduces the problem a bit, but i still can see little deformation.

    But it's not just with camera easing, it also happens with phones, which has much smaller display than PC.
    Let's have an example:

    I have my player figure sprite
    This is PC outcome
    upload_2019-8-12_12-31-45.png


    And this is Android's
    upload_2019-8-12_12-32-22.png



    It's really demoralizing when I test something on computer and it looks pretty, then I try it on phone and it looks like pile of sh*t.

    It has to do something with display size and device responsivity, when I had this problem with other games, I just scaled every sprite and room up to 4 times!! It looked good, but then my tiny 8 bit arcade game had almost 100MB, mobile game just can't be that big.
    My another nooby solution was to turn on pixel-interpolation, but that makes everything blurry.

    This problem makes me so desperate that I'm starting to consider about abadoning Gamemaker, because it's just ruining all of my games.

    I want some more advanced solution. Please, help me, I would really appreciate it!!
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,301
    Best practices for emulating pixel graphics on modern systems:
    • Draw everything at integer positions, not just the camera. Otherwise their offsets relative to the camera would still be a fractional value. That causes pixels to clip off with interpolation off or blur up with interpolation on.
    • Keep pixel interpolation off. The blurring is what interpolation is supposed to do between pixels.
    • Scale using the view instead of manually resizing graphical resources, and even then only by integer amounts (e.g. 256x144 view with a port of 1024x576, 480x270 view with a port of 1920x1080, etc.).
    • Always respect the aspect ratio and never just use full scale.
    It's not GM's fault that you get poor results by failing to treat pixel graphics as a discrete-value environment. And if you think just changing engines is enough without adapting your technique, the grass isn't any greener on the other side.
     
    I'm lost likes this.
  3. I'm lost

    I'm lost Member

    Joined:
    Jul 11, 2018
    Posts:
    18

    Thanks for your advice, now it's a bit more clear to me

    Just one question:
    How am I supposed to scale, if I want to make something just a bit bigger, like these menu buttons I made
    https://giphy.com/gifs/KFtXzYpvJDqT...um=landing&utm_campaign=Media Links&utm_term=

    You can see that every time I click on that button, it gets dark and scales up a bit (1.1), is that the right solution? Because I have the same problem as with the player sprite, that it has deformed text on phone:
    MOBILE.png



    And by the way,
    I never said it's GM's fault, I blame myself, not the engine. It was just one of the options to move on, if I wouldn't find ANY solution.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice