HTML5 Smooth sprite rotation in HTML5

Discussion in 'GameMaker Studio 2 Community Tech Support' started by JimPancakes, Jan 7, 2020.

  1. JimPancakes

    JimPancakes Member

    Joined:
    Nov 25, 2018
    Posts:
    11
    In order to get smooth sprite rotation for my pixelated game I increased the surface size using "surface_resize" and it worked well on Windows. On a browser though "surface_resize" doesn't seem to do anything. The animation ends up looking very choppy.

    Is there any solution to this?
     
  2. Ricardo

    Ricardo Member

    Joined:
    Jun 20, 2016
    Posts:
    201
    It seems like a bug. Next Beta release will probably contains the fix. In the meantime, you could try enabling views in your room (if they are disabled) and use view_set_hport/view_set_wport (to the same size of the application surface) to work around it.
     
    JimPancakes likes this.
  3. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,912
    It may be related, but that issue you linked is fixed in 2.2.5 as it was me who filed the bug.

    OP the fix is to update or you'll have to use the workaround Ricardo mentioned.
     
    JimPancakes likes this.
  4. JimPancakes

    JimPancakes Member

    Joined:
    Nov 25, 2018
    Posts:
    11
    That only seems to increase the size of the screen. I doesn't add any granularity to the pixels. Is there something I'm missing?
     
  5. Ricardo

    Ricardo Member

    Joined:
    Jun 20, 2016
    Posts:
    201
    Maybe we can offer better advice if you share more information? How does your game looks like in Windows and how does it looks like in HTML5? What's exactly your scaling code?
     
    JimPancakes likes this.
  6. JimPancakes

    JimPancakes Member

    Joined:
    Nov 25, 2018
    Posts:
    11
    Finally managed to wrap my head around the issue and made it work. Now my HTML5 game has granularity :).

    There is one BIG problem though and I think it's unsolvable at least at this point in time. I'm working on a 4k screen with Windows scaling at 300%. So what this means is that if I set the view port at 1280 x 720, which is the double of my camera giving me the minimum amount of smoothness, that will result in a 3840 x 2160 game window for me.

    I might have to make a custom configuration just for this case and leave 4k users in the dust when it comes to smoothness. Is there any other solution to this?
     
  7. Ricardo

    Ricardo Member

    Joined:
    Jun 20, 2016
    Posts:
    201
    You could edit the viewport meta tag in the index.html file and see what fits better for your project by adjusting initial-scale and maximum-scale.
    This is the code I once used to ship a Full HD HTML5 game which was causing me scaling issue, by the way:
    HTML:
    <meta name="viewport" content="user-scalable=0">
     
    JimPancakes likes this.

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