1. Hey! Guest! The XXX GMC Jam will take place between August 24th, 12:00 UTC (Friday noon) and August 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Scaling, Resolution, and Aspect Ratio Management for GMS1 & GMS2

Discussion in 'Tutorials' started by Pixelated_Pope, Sep 12, 2016.

  1. Bence Monori

    Bence Monori Member

    Joined:
    Jul 2, 2018
    Posts:
    2
    .
     
    Last edited: Jul 25, 2018
  2. IndieRex

    IndieRex Member

    Joined:
    Aug 7, 2018
    Posts:
    6
    Great tutorial! I am having one issue though. For some reason it is drawing a black bar at the top of screen, but doesn't do it if I comment out the pixel perfect portion of the script.

    I'm using the GMS 2 version of the tutorial, have checked the code multiple times, but can't seem to figure out what might be causing it. My ideal height is set to 540 with my room sizes at 960x540.
     
  3. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    742
    @IndieRex
    I don't recommend using the pixel perfect scaling... but that said, it certainly shouldn't give you black bars. What's the resolution of your monitor?
     
  4. IndieRex

    IndieRex Member

    Joined:
    Aug 7, 2018
    Posts:
    6
    1920x1200. There is only one bar at the top of the screen (rather than one at bottom and top). Not sure why turning it off is fixing it either.

    I'll keep it turned off then!
     
  5. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    742
    @IndieRex

    Ah, because your room isn't tall enough! When you scale it to be pixel perfect, it will scale the height to be perfect. 540 doesn't go perfectly into 1200, so it resizes your view to be 600 tall. Your rooms are only 540 tall, so you see the outside of your room, which is black.
     
    IndieRex likes this.
  6. IndieRex

    IndieRex Member

    Joined:
    Aug 7, 2018
    Posts:
    6
    Ah that makes sense! Thanks again for your help. Great series - really appreciated the lead-up videos explaining the background of the topic and laying the groundwork for the system.
     
    Pixelated_Pope likes this.
  7. IndieRex

    IndieRex Member

    Joined:
    Aug 7, 2018
    Posts:
    6
    Sorry for another question so soon, but I'm now having an issue where the text I draw is getting distorted (I think only in fullscreen mode). I did a check and my camera width/height are running at 864x540.

    My rooms are 960x540, my ideal height is set to 540, and my computer resolution is 1920x1200.
     
  8. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    742
    Are you drawing your text in a gui event? When you are in full screen, do you have black bars at the top and bottom (you shouldn't)?
     
  9. IndieRex

    IndieRex Member

    Joined:
    Aug 7, 2018
    Posts:
    6
    No black bars. Seems to be an issue in both Draw and Draw GUI events.
     
  10. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    742
    @IndieRex
    So, the only time there should ever be distortion is when aspect ratios don't match. Specifically your view and your application surface. Here's a script I use to debug all this.

    https://www.dropbox.com/s/tupyzjlwk9fz7sr/display_write_specs_GMS2.gml?dl=0
    https://www.dropbox.com/s/wnvl0ok047w1d95/display_write_all_specs_GMS2.gml?dl=0

    Add those two scripts to your project, and then in your draw_gui event somewhere write:
    Code:
    display_write_all_specs_GMS2(5,5);
    The numbers in the parentheses is your aspect ratio for that element. All of those numbers should be the same. If not, there's a chance for distortion. So that should give you an idea where to look. If you still can't figure it out, send me a screenshot, and I'll be happy to help you.

    Also, just FYI, you can join my Discord server where hundreds of awesome GM developers hang out and help each other. It's a great way to get programming help without the waiting for forum post responses, and I'm there 5 days a week along with many very skilled and helpful developers. https://discord.gg/sehNsp
     
  11. IndieRex

    IndieRex Member

    Joined:
    Aug 7, 2018
    Posts:
    6
    @Pixelated_Pope

    Thank you for the scripts. I ran it, but it looks like they are all the same number. Here is a screenshot showing it. The issue is also definitely not the font either as when I run the game without the scaling system it looks great. I'm on the discord as well too!
     

    Attached Files:

  12. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    742
    @IndieRex That is indeed weird. The only thing I can really think of is that there is some sort of pixel interpolation going on. Do you have that setting turned on? Even then, it looks weird. If you'd be willing, you could PM me your project and I'll see if I can figure out what's going on.
     
  13. TylerMcDe

    TylerMcDe Member

    Joined:
    Jun 30, 2018
    Posts:
    11
    This tutorial is the gift that keeps on giving for years now lol.
     

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