GMS 2 Support 720p and 1080p in GMS2

Discussion in 'Programming' started by JeanSwamp, Sep 8, 2019.

  1. JeanSwamp

    JeanSwamp Member

    Joined:
    Jan 11, 2018
    Posts:
    131
    Hello Game Makers!

    I've been reading a lot and found a few methods and tutorials on how to support multiple resolutions in GameMaker. Sadly most of them are aimed to GMS1.

    With the new cameras in GMS2 most of the stuff is outdated and I wonder how do you guys give support to 720p for a pixel art game with a native resolution that scales to 1080p

    My native resolution is 480x270 which scales perfect to 1080 but 720p is a whole mess.

    Currently what I do to scale up my game is just set the window size to the desired resolutions I want to support. I set the viewport on the GM IDE and I set the camera position with camera_set_view_pos.

    I know Pixelated Pope has a great serious that covers that, but is mainly aimed for GMS1.

    Also, any idea how does the Nintendo Switch change the resolution from docked to undocked?

    Any help is greatly appreciated it.
     
  2. JeanSwamp

    JeanSwamp Member

    Joined:
    Jan 11, 2018
    Posts:
    131
    Shameless bump, hopefully someone can throw some light in?

    Thanks
     
  3. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,452
    Popes videos were aimed at 1.4, but the last video in the series updates the previous ones for use with GMS2, including a camera video (although this may be contained in the same video - can't remember off hand).

    With regards to the Switch changing from 720p to 1080p and pixel art games not ending up with artifacts / screen crawling, I would assume that the base resolution of the pixel art games that would be affected are one which scale 1:1 to both resolutions in whole factors.

    640x360 for example will scale perfectly to 720p, 1080p and 4k (1280x720, 1920x1080 and 3840x2160 respectively).

    If that isn't the case then it's possible they scale perfectly to 1080p and when downscaled to 720p undocked it isn't as noticeable on the smaller high density screen of the Switch as it would be on a regular large PC screen - though without testing how badly scaled pixel art looks on a Switch it's just an educated guess.
     
  4. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,394
    A good trick is to have a border around your game that you can crop as needed to fit any screen and keep an integer scaling factor.
     
    SnotWaffle Studios likes this.
  5. JeanSwamp

    JeanSwamp Member

    Joined:
    Jan 11, 2018
    Posts:
    131
    I've seen the videos but I haven't seen the one you mention about GMS2, just the Camera ones, which doesn't cover it.

    Hyper Light Drifer, Axion Verge, both runs at a native of 270p and they have ports to the Switch. Funny, the Steam version doesn't even have a window size scaling, just a one-size window.
     
  6. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,452
    Hmm maybe there was only the camera one and I misremembered then, although merging the concepts from both videos should allow you to use the 1.4 tutorials in GMS2 as other than the camera system (which is in that extra video) it should largely be the same process.
    I haven't researched any of the other pixel art games, it just seems logical that if the game is scaling between 720p and 1080p perfectly that the base res would be one which allows this scaling to be done in whole integer factors.

    If you know different then anything I say would just be speculating on methods that may have been used to achieve it.
    Maybe get in touch with Juju on here / Twitter / Discord and see if he would be kind enough to possibly fill in the blanks regarding how HLD did it?
     
    Last edited: Sep 10, 2019
  7. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,923
    Hearing how HLD does it would be interesting. By what I've gathered looking at it (PC version), I'm pretty sure it draws everything upscaled to an app surface sized by integer multiple of the base resolution. I also seem to recall it enforces 16:9 through black bars if necessary. Both of these most likely happen because the hidden stuff all around has been measured to that aspect ratio and base resolution, and because maps haven't been drawn beyond that base sight distance.
     
  8. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    338
    Hyper Light Drifter runs at 480x270. It gets scaled up to 720p/1080p, likely via Application Surface or some other kind of surface. Here is a screenshot of native res HLD:
    hld_native.png
     
  9. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,923
    However if it was just a direct upscale from a 270p, there would be no partial pixels. Looking at this image, we can see the screenshot is 1080p and pixels are 4x4, but the left and right edge pixels are only 2 wide because they are only partially visible.
     
  10. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    338
    Yep. I assume that is why the creator decided to place a 1x1 black border around the entire screen. It masks the partial pixels. Very smart move.

    EDIT: Sorry, misread your comment. I think you're right, HLD does something really weird with upscaling. All the screenshots I'm seeing of the game are 1912x1072. I think the main thing that shows is you really don't need 100% perfect scaling when you're upscaling from such a low res. My games have been 320x180 or 640x360 for a while, just so I don't have to deal with this mess.
     
    Last edited: Sep 11, 2019
  11. JeanSwamp

    JeanSwamp Member

    Joined:
    Jan 11, 2018
    Posts:
    131
    Like I mention, is very weird because the PC version does not even support window resize/scaling, neither does Axion Verge that runs the same native resolution.

    I did ask Juju and he does not know, also asked Alex and Tom but sadly got no answer. I'm kinda stressed about this issue
     
  12. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,452
    Could they be scaling to a surface larger than the screen size (to retain 1:1 scaling) and then manually drawing the surface centred so that the outside edges aren't shown and some of it is cutoff?

    You could do a quick test by looking at the "visible" play area at the edges before and after scaling up and seeing if anything is cutoff.
     
  13. JeanSwamp

    JeanSwamp Member

    Joined:
    Jan 11, 2018
    Posts:
    131
    I believe they show the same amount of screen on both versions
     

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