Is this aspect ratio bad? (solved)

Evanski

Raccoon Lord
Forum Staff
Moderator
is an aspect of 40:23 bad? i mean i have no pixels that scale bad. fullscreen doesnt give me half pixels. so? is it bad?

I discussed this in a status update.
https://forum.yoyogames.com/index.php?members/evanski.28930/#profile-post-30603

Where my room size is 1280x736 and my fullscreen is 1920x1080
and theres no visual half-pixels or stretching and in full screen theirs no bars around the edges
NOTE: the black is the background, the whole thing is a room not just the colored square

NOTE: the white is the background, the whole thing is a room not just the colored square

Heres some code I use to switch it to fullscreen I got if from pixelated pope's video
Code:
if keyboard_check_pressed(vk_f11)
{
    if window_get_fullscreen()
    {
        window_set_fullscreen(false);
        room_set_viewport(room,view_current,true,0,0,room_width,room_height);
        room_set_view_enabled(room,true);
        surface_resize(application_surface,room_width,room_height);
        window_set_size(room_width,room_height);
    }
    else
    {
        window_set_fullscreen(true);
  
        ideal_width = display_get_width();
        ideal_height = display_get_height();

        //chucker for odd number
        if (ideal_width & 1)
        {
            ideal_width++; 
        }
  
        room_set_viewport(room,view_current,true,0,0,ideal_width,ideal_height);
        room_set_view_enabled(room,true);
        surface_resize(application_surface,ideal_width,ideal_height);
        window_set_size(ideal_width,ideal_height);
    }
}
The general question im asking is, is this okay to do or do I have a problem?
 
Last edited:
T

trentallain

Guest
is an aspect of 40:23 bad? i mean i have no pixels that scale bad. fullscreen doesnt give me half pixels. so? is it bad?

I discussed this in a status update.
https://forum.yoyogames.com/index.php?members/evanski.28930/#profile-post-30603

Where my room size is 1280x720 and my fullscreen is 1920x1080
and theres no visual half-pixels or stretching and in full screen theirs no bars around the edges
NOTE: the black is the background, the whole thing is a room not just the colored square

NOTE: the white is the background, the whole thing is a room not just the colored square

Heres some code I use to switch it to fullscreen
Code:
if keyboard_check_pressed(vk_f11)
{
    if window_get_fullscreen()
    {
        window_set_fullscreen(false);
        room_set_viewport(room,view_current,true,0,0,room_width,room_height);
        room_set_view_enabled(room,true);
        surface_resize(application_surface,room_width,room_height);
        window_set_size(room_width,room_height);
    }
    else
    {
        window_set_fullscreen(true);
   
        ideal_width = display_get_width();
        ideal_height = display_get_height();

        //chucker for odd number
        if (ideal_width & 1)
        {
            ideal_width++;  
        }
   
        room_set_viewport(room,view_current,true,0,0,ideal_width,ideal_height);
        room_set_view_enabled(room,true);
        surface_resize(application_surface,ideal_width,ideal_height);
        window_set_size(ideal_width,ideal_height);
    }
}
The general question im asking is, is this okay to do or do I have a problem?
What's preventing you from just making it 16:9?
 
is an aspect of 40:23 bad? i mean i have no pixels that scale bad. fullscreen doesnt give me half pixels. so? is it bad?

I discussed this in a status update.
https://forum.yoyogames.com/index.php?members/evanski.28930/#profile-post-30603

Where my room size is 1280x720 and my fullscreen is 1920x1080
and theres no visual half-pixels or stretching and in full screen theirs no bars around the edges

The general question im asking is, is this okay to do or do I have a problem?
What's 40:23? The game window? Because your room size of 1280x720 is 16:9.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Both don't scale perfectly to 1080p. 720 would scale infinitely better than 736, though.

The first image/video (gif) shows only a part of the game window (so I can't be sure if that's from windowed or full screen mode) and you seem to be more concerned about the blue checkerboard-patterned thingy, and applying scaling to that, than the window. Since you're scaling that by an integer factor, it will scale properly within the game window. This is entirely unrelated to aspect ratios, though, as that refers to the size of the game window, and the main concern is how it will scale in full screen. For it to scale perfectly, the source resolution must be an even divisor of the screen resolution.

Basic example: Screen resolution is 2000x1000.
Source resolutions that will scale well:
  • 1000x500 (x2)
  • 500x250 (x4)
  • 400x200 (x5)
  • 250x125 (x8)
... as the widths of all of these are even divisors of 2000 and the heights are even divisors of 1000, and they have the same aspect ratio as the screen resolution.
Source resolutions that will not scale well:
  • 1024x500 (500 is an even divisor of 1000 but 1024 is not an even divisor of 2000)
  • 640x480 (no even divisors)
  • 1000x250 (1000 is an even divisor of 2000, 250 is an even divisor of 1000, but this aspect ratio is 4:1 while the screen resolution has an aspect ratio of 2:1)

Accordingly, if your screen is 1920x1080:
1920 / 1280 = 1.5
1080 / 736 = ... 1.4673913043478260869565217391304??
(1080 / 720 = 1.5)

The results of the first two divisions don't match (width by width and height by height), so if your game window is 1280x736, the aspect ratio doesn't match (it would if it was 720). It won't scale up well, either way, though, as you would need to project 1 pixel of the game window onto 1.5 pixels on the screen. Or to 1.4673913043478260869565217391304 pixels on the screen, for that matter. Stretching or black bars are unavoidable at this point - not necessarily both, but at least one of them.


As a general guideline:
Mismatching aspect ratios will lead to either black bars around the game in one dimension, or stretching if you choose to stretch the projection to avoid black bars, which may look unpleasant. Or, in the worst case, when not a single source resolution dimension evenly divides the matching screen dimension, both.
Non-even-divisor source resolutions will invariably lead to stretching.

As the second video was taken with a camera rather than via screen capture or screenshots, I'm unable to pinpoint the effects of this.


With a target aspect ratio of 16:9 and resolution of 1920x1080, ideal source resolutions would be:
  • 960x540 (/2)
  • 640x360 (/3)
  • 480x270 (/4)
... and so on. These have the same aspect ratio and evenly divide the screen resolution and will therefore scale up pixel-perfectly with no black borders.


Edit: Rather than trying to find a "one size fits all" resolution, I'd opt to dynamically adjust the source resolution based on the device's screen resolution. This requires careful planning and execution regarding the game's interface and stage design, but when executed well, pretty much guarantees perfect scaling unless people use super exotic resolutions that can't realistically be displayed properly due to some room or interface layouts.
 

Evanski

Raccoon Lord
Forum Staff
Moderator
Both don't scale perfectly to 1080p. 720 would scale infinitely better than 736, though.

The first image/video (gif) shows only a part of the game window (so I can't be sure if that's from windowed or full screen mode) and you seem to be more concerned about the blue checkerboard-patterned thingy, and applying scaling to that, than the window. Since you're scaling that by an integer factor, it will scale properly within the game window. This is entirely unrelated to aspect ratios, though, as that refers to the size of the game window, and the main concern is how it will scale in full screen. For it to scale perfectly, the source resolution must be an even divisor of the screen resolution.

Basic example: Screen resolution is 2000x1000.
Source resolutions that will scale well:
  • 1000x500 (x2)
  • 500x250 (x4)
  • 400x200 (x5)
  • 250x125 (x8)
... as the widths of all of these are even divisors of 2000 and the heights are even divisors of 1000, and they have the same aspect ratio as the screen resolution.
Source resolutions that will not scale well:
  • 1024x500 (500 is an even divisor of 1000 but 1024 is not an even divisor of 2000)
  • 640x480 (no even divisors)
  • 1000x250 (1000 is an even divisor of 2000, 250 is an even divisor of 1000, but this aspect ratio is 4:1 while the screen resolution has an aspect ratio of 2:1)

Accordingly, if your screen is 1920x1080:
1920 / 1280 = 1.5
1080 / 736 = ... 1.4673913043478260869565217391304??
(1080 / 720 = 1.5)

The results of the first two divisions don't match (width by width and height by height), so if your game window is 1280x736, the aspect ratio doesn't match (it would if it was 720). It won't scale up well, either way, though, as you would need to project 1 pixel of the game window onto 1.5 pixels on the screen. Or to 1.4673913043478260869565217391304 pixels on the screen, for that matter. Stretching or black bars are unavoidable at this point - not necessarily both, but at least one of them.


As a general guideline:
Mismatching aspect ratios will lead to either black bars around the game in one dimension, or stretching if you choose to stretch the projection to avoid black bars, which may look unpleasant. Or, in the worst case, when not a single source resolution dimension evenly divides the matching screen dimension, both.
Non-even-divisor source resolutions will invariably lead to stretching.

As the second video was taken with a camera rather than via screen capture or screenshots, I'm unable to pinpoint the effects of this.


With a target aspect ratio of 16:9 and resolution of 1920x1080, ideal source resolutions would be:
  • 960x540 (/2)
  • 640x360 (/3)
  • 480x270 (/4)
... and so on. These have the same aspect ratio and evenly divide the screen resolution and will therefore scale up pixel-perfectly with no black borders.


Edit: Rather than trying to find a "one size fits all" resolution, I'd opt to dynamically adjust the source resolution based on the device's screen resolution. This requires careful planning and execution regarding the game's interface and stage design, but when executed well, pretty much guarantees perfect scaling unless people use super exotic resolutions that can't realistically be displayed properly due to some room or interface layouts.
So what I'll do is just set my aspect to 1280x720 and find a way to make it dynamically scale to fit the device's screen resolution. Thanks everyone for your input!
 
Top