• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

SOLVED 1 ) Background sprite gets corrupted when height is >1536 2) when using certain display resolutions, window_set_fullscreen doesn't fill up the screen

Owly

Member
Hey all, it's happened twice with 2 different images, but with the others it doesn't happen. I use an image whose size is 1024x2304 as the background for a room whose size is 1024x768 and it scrolls vertically to show the entirety of it over time. The image itself (made in game maker) is crisp, but when shown in game it is smudgy. Cropped bits of both images are attached (one is called proper -- how it should look, and one corrupted -- how it does look in game). Why does it happen and how do I fix this?

To make sure the scrolling doesn't cause this, I set the speed to 0, but it still happens.

EDIT: when I lower the height to 1536 (so dimensions are 1024x1536) it shows great. All images whose height is a maximum of 1536 pixels show crisply then, and bigger images (height>1536) get corrupted, it seems. Is there a fix for it?

Second problem: when choosing in windows display resolution 1680x1050 and then running the game in fullscreen -- the game window doesn't fill up the screen, only some of it. When I play using the normal 1920x1080 resolution -- then it works fine. Any idea why this happens?

Thanks!
 

Attachments

Last edited:

flyinian

Member
Do you have any other images(sprites) in the game that display poorly?

It could be due to one of your resolution settings not being set up correctly for what you want.

Also, is the other images that display nicely, are they the same size as the ones that don't display correctly?
 

Owly

Member
Do you have any other images(sprites) in the game that display poorly?

It could be due to one of your resolution settings not being set up correctly for what you want.

Also, is the other images that display nicely, are they the same size as the ones that don't display correctly?
There is one other image that displays a bit smudgy and its dimensions are 1024x3072. All the others though show great.

"It could be due to one of your resolution settings not being set up correctly for what you want."
Hmm, how do I fix that? And why do only 2 images show poorly while all the others - of various dimensions - show ok?

Edit: I've just experimented with the height a bit and found out this: when I lower the height to 1536 (so dimensions are 1024x1536) it shows great. All images whose height is a maximum of 1536 pixels show crisply then, and bigger images (height>1536) get corrupted, it seems. Is there a fix for it?
 
Last edited:

flyinian

Member
There is one other image that displays a bit smudgy and its dimensions are 1024x3072. All the others though show great.

"It could be due to one of your resolution settings not being set up correctly for what you want."
Hmm, how do I fix that? And why do only 2 images show poorly while all the others - of various dimensions - show ok?
Take a look at:


If you haven't done your resolution yet, then gms2 does what it wants.

Also, it's better to keep your sprites as small as possible and then scale them up.
Example:

Make your background a size of, 64 x 64 or 64 x 128(it can be anything you want). Also, Keep them divisible by 2. Can't cut pixels in half.

The smaller the sprite, the easier to design them, the less effort the software has to process the graphics and your game may start faster.

I'd start with setting your resolution for now.
 

Owly

Member
My resolution is already set properly, I don't think that's the problem, and even if it were the problem -- the 'corruption' would be different, it would either stretch or squeeze the image, not cause those 'artifacts' which you can sometimes find in a jpeg (I think).
 

Owly

Member
Take a look at:


If you haven't done your resolution yet, then gms2 does what it wants.

Also, it's better to keep your sprites as small as possible and then scale them up.
Example:

Make your background a size of, 64 x 64 or 64 x 128(it can be anything you want). Also, Keep them divisible by 2. Can't cut pixels in half.

The smaller the sprite, the easier to design them, the less effort the software has to process the graphics and your game may start faster.

I'd start with setting your resolution for now.
Hey, so I followed that guide, but when I use this line "application_surface_draw_enable(false);" as suggested, it turns my screen black. If I don't use that line, then I get all sort of unwanted textures on my screen. Frustrating :/
 

flyinian

Member
Hey, so I followed that guide, but when I use this line "application_surface_draw_enable(false);" as suggested, it turns my screen black. If I don't use that line, then I get all sort of unwanted textures on my screen. Frustrating :/
unwanted textures?


Do you have your resolution control object set to persistent in a initialization room?

resolution control object: The object that houses your resolution code, the code from the link I posted.

initialization room: The first room of your game that creates the object.
 

Owly

Member
unwanted textures?


Do you have your resolution control object set to persistent in a initialization room?

resolution control object: The object that houses your resolution code, the code from the link I posted.

initialization room: The first room of your game that creates the object.
Yeah, my object is persistent, the one handling resolution, and it appears in the first room. When I use in Draw the line "draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1);" -- then I get unwanted textures, textures that should not appear in that room, alongside the one that should.

In more depth: the reason I turned to your linked guide is because when I experiment with certain display resolutions in windows (particularly these ones: 1680x1050, 1400x1050, 1280x1024), and start in fullscreen mode, then only some of the screen fills, not all of it, and I need to click on the taskbar and then the game icon for the game to truly become fullscreen. The game works perfectly in windowed mode. It also works perfectly in fullscreen mode in other display resolutions, such as 1920x1080. That's why I turned to the guide, but now I'm experiencing that black screen problem when using the line "application_surface_draw_enable(false)" or unwanted textures when using "draw_surface_ext" -- and the main problem still persists: in 1680x1050 display resolution and running on fullscreen mode, the program doesn't fill the entire screen for some reason, unless as I said I click the taskbar and then the game icon.)

I should also state that in 'End Step' I have this line: camera_set_view_size(view_camera[0],1024,768); however the problems mentioned above persist even when I remove it.

What should I do? :/

EDIT: I get problems when choosing display resolution 1680x1050 only when running the program through Game Maker, not through the version I've uploaded to Steam (beta version).... what gives?
 
Last edited:

flyinian

Member
Yeah, my object is persistent, the one handling resolution, and it appears in the first room. When I use in Draw the line "draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1);" -- then I get unwanted textures, textures that should not appear in that room, alongside the one that should.

In more depth: the reason I turned to your linked guide is because when I experiment with certain display resolutions in windows (particularly these ones: 1680x1050, 1400x1050, 1280x1024), and start in fullscreen mode, then only some of the screen fills, not all of it, and I need to click on the taskbar and then the game icon for the game to truly become fullscreen. The game works perfectly in windowed mode. It also works perfectly in fullscreen mode in other display resolutions, such as 1920x1080. That's why I turned to the guide, but now I'm experiencing that black screen problem when using the line "application_surface_draw_enable(false)" or unwanted textures when using "draw_surface_ext" -- and the main problem still persists: in 1680x1050 display resolution and running on fullscreen mode, the program doesn't fill the entire screen for some reason, unless as I said I click the taskbar and then the game icon.)

I should also state that in 'End Step' I have this line: camera_set_view_size(view_camera[0],1024,768); however the problems mentioned above persist even when I remove it.

What should I do? :/


Provide your resolution code along with where they're located.

*seeing code makes it easier to problem solve and increases your chance on getting better help and more people involved.
 

Owly

Member
Provide your resolution code along with where they're located.

*seeing code makes it easier to problem solve and increases your chance on getting better help and more people involved.
I've just noticed I get problems when choosing display resolution 1680x1050 only when running the program through Game Maker, not through the version I've uploaded to Steam (beta version).... why is that? I've uploaded two screenshots, one called through Steam, the other through game maker (showing the problem). My usual display resolution is 1920x1080 and everything works fine then.

As for the code.


//these following lines were taken from your guide
global.MonitorW=display_get_width();
global.MonitorH=display_get_height();
global.Xoffset=(global.MonitorW-1024)/2;
global.Yoffset=(global.MonitorH-768)/2;



In Create:

if (!file_exists(_file))
{
// irrelevant for here cause ini exists
}
else
{
ini_open(_file);
// some irrelevant ini lines
var _a = ini_read_string("general","fullscreen","0");
if (_a==0)
{
window_set_fullscreen(false);
window_set_size(ideal_w,ideal_h);
alarm[0]=1
surface_resize(application_surface,ideal_w,ideal_h);
// this windowed stuff works great
}
else
{
application_surface_draw_enable(false); //using this line turns the screen black
window_set_fullscreen(true)

}

ini_close();

In Draw Event I have:


if (window_get_fullscreen()){
draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1); //using this creates unwanted textures;
}

In End Step:
camera_set_view_size(view_camera[0],1024,768);

in Room Start:
view_enabled=true;
view_visible[0]=true;

So as said, I'm doing all this to make sure the game runs in fullscreen properly when using strange display resolutions such as 1680x1050. But when I follow the guide there are 2 problems on top of the issue that it doesn't solve the original problem (as mentioned): 1) using "application_surface_draw_enable(false);" turns the screen black, and 2) using " draw_surface_ext" creates unwanted textures.

So how do I fix my problems? :x Thanks again!
 

Attachments

flyinian

Member
I've just noticed I get problems when choosing display resolution 1680x1050 only when running the program through Game Maker, not through the version I've uploaded to Steam (beta version).... why is that? I've uploaded two screenshots, one called through Steam, the other through game maker (showing the problem). My usual display resolution is 1920x1080 and everything works fine then.

As for the code.


//these following lines were taken from your guide
global.MonitorW=display_get_width();
global.MonitorH=display_get_height();
global.Xoffset=(global.MonitorW-1024)/2;
global.Yoffset=(global.MonitorH-768)/2;



In Create:

if (!file_exists(_file))
{
// irrelevant for here cause ini exists
}
else
{
ini_open(_file);
// some irrelevant ini lines
var _a = ini_read_string("general","fullscreen","0");
if (_a==0)
{
window_set_fullscreen(false);
window_set_size(ideal_w,ideal_h);
alarm[0]=1
surface_resize(application_surface,ideal_w,ideal_h);
// this windowed stuff works great
}
else
{
application_surface_draw_enable(false); //using this line turns the screen black
window_set_fullscreen(true)

}

ini_close();

In Draw Event I have:


if (window_get_fullscreen()){
draw_surface_ext(application_surface,global.Xoffset,global.Yoffset,1,1,0,c_white,1); //using this creates unwanted textures;
}

In End Step:
camera_set_view_size(view_camera[0],1024,768);

in Room Start:
view_enabled=true;
view_visible[0]=true;

So as said, I'm doing all this to make sure the game runs in fullscreen properly when using strange display resolutions such as 1680x1050. But when I follow the guide there are 2 problems on top of the issue that it doesn't solve the original problem (as mentioned): 1) using "application_surface_draw_enable(false);" turns the screen black, and 2) using " draw_surface_ext" creates unwanted textures.

So how do I fix my problems? :x Thanks again!
I'm not experienced enough to instantly tell you your solution but, I can suggest things to try in hopes it'll give you solutions to your problems until someone else comes by.

I suggest trying the following:

Try this first before the following: as HalRiyami mentioned, try a larger texture page size.

1. Make sure your viewport is the same size as your camera and the viewport is checked visible.

2. Go to game options> windows > graphics, try the two different options. "keep aspect ratio" is better but, it'll leave black bars around your game. "full scale", I believe, will fit the game to the screen and may cause artifacts.

3. Here is my resolution code that I have for my project.

disable your current resolution code, don't delete it but simply note it out for safe keeping.

The below code goes into your object that is responsible for your game's resolution and that is also initialized at the start of your game. Ensure its persistent.

Place this into the create event:

GML:
#region    //SETS GAME RESOLUTION

application_surface_draw_enable(true);    //Forces the draw application
window_set_fullscreen(false);    //Disables automatic fullscreen

global._MonitorW = display_get_width();
global._MonitorH = display_get_height();

//---BASE RESOLUTION---//
global._Xoffset = (global._MonitorW - 1024) /2;
global._Yoffset = (global._MonitorH - 768) /2;


//---SETS THE RESOLUTION TO 2048 x 1536---//
if(global._MonitorW >= 2048 && global._MonitorH >= 1536)
then
{
    surface_resize(application_surface, 2048 , 1536);
    global._Xoffset = (global._MonitorW - 2048 ) /2;
    global._Yoffset = (global._MonitorH - 1536) /2;
};
};

display_set_gui_size(view_wport[0],view_hport[0]);


#endregion

Place this into your object's post-draw event:

GML:
draw_surface_ext(application_surface, global._Xoffset, global._Yoffset, 1, 1, 0, c_white, 1);
 

Owly

Member
I'm not experienced enough to instantly tell you your solution but, I can suggest things to try in hopes it'll give you solutions to your problems until someone else comes by.

I suggest trying the following:

Try this first before the following: as HalRiyami mentioned, try a larger texture page size.

1. Make sure your viewport is the same size as your camera and the viewport is checked visible.

2. Go to game options> windows > graphics, try the two different options. "keep aspect ratio" is better but, it'll leave black bars around your game. "full scale", I believe, will fit the game to the screen and may cause artifacts.

3. Here is my resolution code that I have for my project.

disable your current resolution code, don't delete it but simply note it out for safe keeping.

The below code goes into your object that is responsible for your game's resolution and that is also initialized at the start of your game. Ensure its persistent.

Place this into the create event:

GML:
#region    //SETS GAME RESOLUTION

application_surface_draw_enable(true);    //Forces the draw application
window_set_fullscreen(false);    //Disables automatic fullscreen

global._MonitorW = display_get_width();
global._MonitorH = display_get_height();

//---BASE RESOLUTION---//
global._Xoffset = (global._MonitorW - 1024) /2;
global._Yoffset = (global._MonitorH - 768) /2;


//---SETS THE RESOLUTION TO 2048 x 1536---//
if(global._MonitorW >= 2048 && global._MonitorH >= 1536)
then
{
    surface_resize(application_surface, 2048 , 1536);
    global._Xoffset = (global._MonitorW - 2048 ) /2;
    global._Yoffset = (global._MonitorH - 1536) /2;
};
};

display_set_gui_size(view_wport[0],view_hport[0]);


#endregion

Place this into your object's post-draw event:

GML:
draw_surface_ext(application_surface, global._Xoffset, global._Yoffset, 1, 1, 0, c_white, 1);
Okay, so I've tried the code, ran it under the peculiar 1680x1050 display.... and here are the results:

1) using the draw_surface_ext command in Post Draw didn't create any unwanted textures.

2) I was able to run the game in fullscreen mode using the aforementioned display properly... sometimes. Sometimes it ran fine, sometimes it didn't. Then I thought maybe that problem had nothing to do with the code. So I shut down my Norton antivirus and things then ran correctly... for a while.

3) When I turned my Norton antivirus on and tried to run the file again... it shut it down for 'strange heuristics behavior'. I mean, wth? Is it possible using 'post draw' caused this? I doubt it, but what...? So I had to exclude my .exe file from Norton, then ran it again, and thankfully it ran without a hitch.

4) Is it possible I had a problem running the game in fullscreen in that display because of antivirus interference? Even so, why would Norton deem my file's behavior strange? Is it because I ran the .exe file many times... or?

5) Luckily I'm not experiencing any display problems at the moment, so many thanks :) It's still a bit of black magic to me... all this business regarding port views etc.

6) Also thank you and HalRiyami for the tips regarding the texture page size, I will experiment with it.
 

Owly

Member
Update to the above:

Running the game now in fullscreen mode from an executable, it always runs perfectly no matter the windows display;
however running the game in fullscreen mode using the 1680x1050 display from within Game Maker (using the F5 Run command) does sometimes create that problem in fullscreen mode -- the game window does not fill the screen sometimes (in other times, magically, it does).

I have to assume it's not a bug in the code, but a bug in either Game Maker itself or an interference of my antivirus, because running it from an executable or Steam does not create any problems, no matter the display, and either in fullscreen or window mode.
 

flyinian

Member
I'm glad I could help, I'm new to all this and it's black magic to me as well.

I'd suggest marking this thread "solved" and creating a new one with your new issue and see what you get in help.

As for the anti virus, I have no idea. My original anti virus killed my pc performance so, I uninstalled it and now my pc ran like it did 6 years ago(good).


Okay, so I've tried the code, ran it under the peculiar 1680x1050 display.... and here are the results:

1) using the draw_surface_ext command in Post Draw didn't create any unwanted textures.

2) I was able to run the game in fullscreen mode using the aforementioned display properly... sometimes. Sometimes it ran fine, sometimes it didn't. Then I thought maybe that problem had nothing to do with the code. So I shut down my Norton antivirus and things then ran correctly... for a while.

3) When I turned my Norton antivirus on and tried to run the file again... it shut it down for 'strange heuristics behavior'. I mean, wth? Is it possible using 'post draw' caused this? I doubt it, but what...? So I had to exclude my .exe file from Norton, then ran it again, and thankfully it ran without a hitch.

4) Is it possible I had a problem running the game in fullscreen in that display because of antivirus interference? Even so, why would Norton deem my file's behavior strange? Is it because I ran the .exe file many times... or?

5) Luckily I'm not experiencing any display problems at the moment, so many thanks :) It's still a bit of black magic to me... all this business regarding port views etc.

6) Also thank you and HalRiyami for the tips regarding the texture page size, I will experiment with it.
Update to the above:

Running the game now in fullscreen mode from an executable, it always runs perfectly no matter the windows display;
however running the game in fullscreen mode using the 1680x1050 display from within Game Maker (using the F5 Run command) does sometimes create that problem in fullscreen mode -- the game window does not fill the screen sometimes (in other times, magically, it does).

I have to assume it's not a bug in the code, but a bug in either Game Maker itself or an interference of my antivirus, because running it from an executable or Steam does not create any problems, no matter the display, and either in fullscreen or window mode.
 
Top