GML I WANT black bars...

C

Chris S.

Guest
Hey guys.
I actually WANT black bars in my game's resolution, and not worry about automatic re-scaling with pixels and all that jazz. I'm pretty new at this and fiddling with that is a bit above me at the moment.

So how can I get the resolution of my game to be versatile on any PC screen without stretching or warping, just with black bars on the side?
 

RangerX

Member
There you go buddy: https://forum.yoyogames.com/index.php?threads/how-to-properly-scale-your-game.995/

In the tutorial I explain why graphical deformation occurs and therefore that its important to scale your game properly.
After that there's 4 methods described. You apparently want the "pixel perfect" one.
There's an extra 2 blogs from YOYO linked at the bottom (very interesting on the subject)
And an extra method by PixelPope also linked at the bottom.

:)
 
Z

zendraw

Guest
just check the keep aspect ratio in global game settings and thats that. i think most people use 16:9 aspect ratios so go with that.
 

RangerX

Member
Search "liste of true 16:9 resolutions" on Google.
You will a website with a list.

16:9 ratio means the width size divided by height size will give 1,7
16 / 9 = 1,7

Per example, "full HD" (1920x1080)
1920 / 1080 = 1,7
 
C

Chris S.

Guest
Search "liste of true 16:9 resolutions" on Google.
You will a website with a list.

16:9 ratio means the width size divided by height size will give 1,7
16 / 9 = 1,7

Per example, "full HD" (1920x1080)
1920 / 1080 = 1,7
But how do I actually change the aspect ratio settings? I'm using GMS2 btw. Also, to give some perspective, the game I'm designing is a point-and-click project. I just want the game to fit a monitor without warping the graphics; like I said, I actually don't care about black bars.
 

RangerX

Member
You don't change anything like that.
The size of the view and port IS the resolution of your game. So let's say you want something like 480x270, you put it in the view size and port on screen size.
That said, read and try to understand my tutorial.
If your game is 3D or with vector graphics, don't even bother all that Jazz and simply check "keep aspect ratio" in the global setting options of your target under the "graphic" tab.
 
C

Chris S.

Guest
If your game is 3D or with vector graphics, don't even bother all that Jazz and simply check "keep aspect ratio" in the global setting options of your target under the "graphic" tab.
So basically, if my game has pixel graphics, there isn't any way to just do "keep aspect ratio" and have black bars without the graphics warping? If so, what are some good ways/apps to make vector graphics? My project is point-and-click, so it's not absolutely necessary for the graphics to be pixel.
 

RangerX

Member
Here's what the option "keep aspect ratio" does.
Gamemaker will resize your game as much as possible on screen BUT without stretching. It will basically "keep the aspect ratio intact".
However, GameMaker doesn't care if there's graphical damage or not. Let me give you an example.

Let's say your game is 800x450. This is a 16:9 resolution so basically, GameMaker will display it fullscreen no black bar if your monitor is, per example, in 1920x1080.
1920 / 800 = 2,4
Basically, GameMaker will resize your game by 2,4. Fractions of pixels don't exist though so the engine will have to decide which pixel must go and which pixels to keep in order to reproduce the image.
Long story short, you would be fullscreen yes, but with graphical damage even if there's no stretching.

I explain this though at the very beginning of my tutorial. Can you do a little more research and trying before your next question?
(although am glad to help)
 
C

Chris S.

Guest
Can you do a little more research and trying before your next question?
Sorry about that, I just don't know very much about this aspect ratio resolution stuff. I tried to listen to PixelatedPope's tutorial a long time ago for a different project, but this new project is different, and I don't care about the bars.
 
C

Chris S.

Guest
I looked at your tutorial and did everything you said, to get this error message:

#######################################################
ERROR in
action number 1
of Step Event0
for object obj_logic:

Trying to use non-existing surface.
at gml_Object_obj_logic_Step_0 (line 15) - draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1);
########################################################
 

Electros

Member
If you want black bars, why not just setup your rooms / views to not fit a standard ratio, so the black bars are added?

-Create a new project (or modify existing), under graphics set to full screen and scaling to keep aspect ratio. Change the background colour of the room if a new project to see the output differences.
-Set the room, or camera and viewports if using them to a non standard ratio e.g. Width 1600 Height 700, black bars will appear top and bottom on a normal widescreen display
-Set the room, or camera and viewports if using them to e.g. Width 1600 Height 1200, black bars will appear left and right on a normal widescreen display

W1600H1200.png

W1600H700.png
 

RangerX

Member
Did you use "application_surface_enable" instead of "application_surface_draw_enable" ?
Because you error says the engine cannot find the application surface -- which is impossible unless you disabled it.
 
C

Chris S.

Guest
Did you use "application_surface_enable" instead of "application_surface_draw_enable" ?
Because you error says the engine cannot find the application surface -- which is impossible unless you disabled it.
Ah, ok, that must be it. Thanks @RangerX, you've been extremely helpful.
 
Z

zendraw

Guest
not to make another topic, why is it when i change the view width/height with
room_set_view, it keeps the aspect ratio of the settings in the room?
lets say i set it with room set to be 1600/900
but in the room its the default one 1024/768
if i dont draw the application surface manually it keeps the aspect ratio of the room with the new view sizes
so view width/height is 1600/900 but with 1.25 ratio. if that makes sense?

im not asking how to fix it, im just wondering why is this happening?
 

Electros

Member
not to make another topic, why is it when i change the view width/height with
room_set_view, it keeps the aspect ratio of the settings in the room?
lets say i set it with room set to be 1600/900
but in the room its the default one 1024/768
if i dont draw the application surface manually it keeps the aspect ratio of the room with the new view sizes
so view width/height is 1600/900 but with 1.25 ratio. if that makes sense?

im not asking how to fix it, im just wondering why is this happening?
Not sure I do understand, but perhaps it is to do with the creation flow?

http://docs2.yoyogames.com/source/_...drawing/surfaces/the application surface.html

My knowledge of surfaces is very basic, something I will need to work on when the time comes!
 
C

Chris S.

Guest
Did you use "application_surface_enable" instead of "application_surface_draw_enable" ?
Because you error says the engine cannot find the application surface -- which is impossible unless you disabled it.
Well, bad news and good news. Good news first: the game seems to run fine. Bad news: An error message still comes up, but I can click "Ignore" and it goes on to the game. If it's not a fatal error, I assume the game could still run if it was an executable file?
 
C

Chris S.

Guest
####################################

ERROR in
action number 1
of Step Event0
for object obj_logic:

Trying to use non-existing surface.
at gml_Object_obj_logic_Step_0 (line 15) - draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1);

####################################
 
Z

zendraw

Guest
you shuld ask before drawing the surface, it just may be that its created a bit later

if (surface_exists(app surface))
{
//draw the surface
}

also you shuld draw it in the Post Draw event, not the step event.

all functions with draw in front go in the draw event
except the draw_set ones, but you either use them in game start or room start or draw events.
 
C

Chris S.

Guest
you shuld ask before drawing the surface, it just may be that its created a bit later
Perfect, it works fine now. Thanks! @RangerX, will the example code you provided in the "pixel-perfect" segment of your tutorial...

Code:
if(global.MonitorW >= 1600 && global.MonitorH >= 900)
then
{
    surface_resize(application_surface,1600,900)
    global.Xoffset=(global.MonitorW-1600)/2;
    global.Yoffset=(global.MonitorH-900)/2;
}
...support multiple resolutions or will I have to tweak numbers? I'm still trying to grasp all of this stuff, but I think I'm getting it. :p
 
Last edited by a moderator:

RangerX

Member
What's your base resolution? You need to support as many multiple of your view/view port size as possible.
 
C

Chris S.

Guest
What's your base resolution? You need to support as many multiple of your view/view port size as possible.
1600 x 900 is my resolution. Also can you point out exactly how to support different resolutions? Like, which variables/numbers to tweak?
 

RangerX

Member
So your view size and port on screen size is 1600x900? Good Lord. That's too much.
A ton of people will play your game in a 1366x768 screen (most popular resolution in the world right now) and it will look like crappy
 

RangerX

Member
You do what a game usually do in that case. A smaller base resolution and you scale up.
What is your game? Is it 2D? Is it pixel art? If its all that your really should.
 

RangerX

Member
I'd try 640x360 for my base resolution in that case.
Its 16:9 of screen ratio (a must).
It fits pretty good in a 1366x768 screen (would end up 1280x720)
It fits perfectly in 1920x1080 (the most used resolution by gamers)
Also fits perfectly to 4k and most mobile resolutions.
 
C

Chris S.

Guest
Your view and viewport would be that size.
And you scale the game with the application surface.
Sorry for all the trouble you went through to help me... I'm not this bad with programming an actual game, trust me, but this resolution thing is very new to me (obviously). Heck, maybe if I ever get my game out, I'll send you a free copy for your assistance. ;)
 
Top