• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker SOLVED: Infuriating Scaling Issue

A

Advokitt

Guest
I am struggling with the oddest thing. I NEVER had this issue until GMS2. I have absolutely no idea how to fix it and it is very disheartening. Any help would be appreciated.

Anyway, my tiles are 32x32.
My camera is set to 416x256.
My viewport is set to 416x256.
This effectively creates a view that is 13 tiles wide by 8 tiles tall.
Unfortunately when I run the application under these conditions my colors become distorted as if interpolation were on. I have indeed disabled it, both through the configuration settings and in code using gpu functions.

Here is an example of one of the tiles and the terrible scaling it undergoes to the far right. The middle image is what I was expecting and the image to the left is the 32x32 original. Am I missing something?

 
S

Silver_Mantis

Guest
You aren't getting this after you apply full screen or adjust the window at all right? As soon as you do that and it's size isn't meeting (For instance a 16:9) ratio, it will distort.
 
A

Advokitt

Guest
I'm not totally sure what you are asking by I'll show you my code for the application surface. The issue occurs in both fullscreen and windowed modes.

gpu_set_texfilter(false);

application_surface_draw_enable(false);
window_set_fullscreen(true);
global.ScreenWidth=display_get_width();
global.ScreenHeight=display_get_height();
global.Xoffset=(global.ScreenWidth-512)/2;
global.Yoffset=(global.ScreenHeight-256)/2;

surface_resize(application_surface,1920,1080)
global.Xoffset=(global.ScreenWidth-1920)/2;
global.Yoffset=(global.ScreenHeight-1080)/2;

I removed the above code and relied on GMS2's built in settings and leaving the project in windowed mode only to find the problem exists even their I havwe even created a buffer around every tile. This is the second project this has occurred on.
 
Last edited by a moderator:

RangerX

Member
So what are the built in settings you have?
I don't have GMS2 but it should be similar to GMS1 in that regard.

You probably aren't setting your game to "full scale" and your monitor is probably 1920x1080. So if I assume this and the fact you are with the "keep aspect ratio" setting...

Your game is 416x256 (which is an odd size that isn't even 16:9 of screen ratio like pretty much all monitors of this world = not good).
When the game starts fullscreen, GMS2 resizes your application surface by 4,615 times. (1920 div by 416 = 4,615) and its the reason why you see artifacts/deformation. Your game should be scaled up by a integer amount. Its the only way to have no artifacts/deformation at all. The only way. If you would scale the game yourself (like my tutorial following the "pixel perfect" logic), your game would be scaled up by 4 times (1664x1024) and would look perfectly clean. And if you don't want it letterboxed, get your game resolution to the closest 16:9 resolution that is also a divider of 1920x1080. In your case here, 480x270.
 
A

Advokitt

Guest
I very much appreciate the quick and accurate response. Your assumptions were very much correct in regards to full scale and aspect as well as monitor resolution. I have been trying to follow your tutorials to be perfectly honest . It's as if a celebrity responded . Anyway, I will attempt to follow your recommendations tomorrow evening.

The odd dimensions I had were calculated based on a wrong understanding of application surfaces.

EDIT:
I couldn't sleep without trying. This did not correct the issue.
All objects with sprites scale pixel perfectly but all tiles have distortions.
I cannot afford to use objects in this scenario, I must use tiles.

My tileset is composed of roughly 2,400 32x32 tiles give or take 10%.

The room I am working with is 8192px by 8192px.
This cannot be changed by very nature of the application.

The viewport and the camera are set to 480 by 270.
 
Last edited by a moderator:
S

Silver_Mantis

Guest
I very much appreciate the quick and accurate response. Your assumptions were very much correct in regards to full scale and aspect as well as monitor resolution. I have been trying to follow your tutorials to be perfectly honest . It's as if a celebrity responded . Anyway, I will attempt to follow your recommendations tomorrow evening.

The odd dimensions I had were calculated based on a wrong understanding of application surfaces.

EDIT:
I couldn't sleep without trying. This did not correct the issue.
All objects with sprites scale pixel perfectly but all tiles have distortions.
I cannot afford to use objects in this scenario, I must use tiles.

My tileset is composed of roughly 2,400 32x32 tiles give or take 10%.

The room I am working with is 8192px by 8192px.
This cannot be changed by very nature of the application.

The viewport and the camera are set to 480 by 270.
I'm trying to figure out the issue here. It's strange because all of my artwork is 32x32 and I don't have this issue at all.
I don't set up or change any surface properties.
Here is a screenshot of the game I'm working on:


Now I do have different view setups.
My camera is set to 480 x 270, but my viewport is set to 960 x 540 so it scales properly with 32 x 32 textures.
Maybe try that?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Unfortunately when I run the application under these conditions my colors become distorted as if interpolation were on. I have indeed disabled it, both through the configuration settings and in code using gpu functions.
Use surface_resize to resize the application surface to the same size as your camera view in the create event of some object at room start. This should resolve the issues you're seeing.
 
A

Advokitt

Guest
I'm beginning to suspect a glitch with GMS2. It has been a terrible experience ever since YoYo forced me to upgrade to studio 2.

Silver_Mantis, I tried exactly what you said last night to no avail. I did it again this morning as a double check. The issue did not resolve.

Nocturne, I am currently using surface_resize to no avail.

RangerX, unfortunately your described methods did not help in my situation.

The tiles do appear to be sized correctly when scaled but tiles are showing serious color distortions around their edges.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
A

Advokitt

Guest
Yes I have set the border size in texture group settings to various amounts as well as increasing the border size in the tileset itself.

Additionally, I have utilized tileset champion to try and remove the strange seams.

Nothing is helping.
 

rIKmAN

Member
Yes I have set the border size in texture group settings to various amounts as well as increasing the border size in the tileset itself.

Additionally, I have utilized tileset champion to try and remove the strange seams.

Nothing is helping.
This is gonna sound stupid, but are you sure you haven't fat fingered the keyboard by accident when typing in your tile sizes and they are actually 32x33 or 33x32 etc?
 

RangerX

Member
Well, there's Something wrong regardless.
Would you care about giving me those info again:

- view size
- port size
- your test monitor's resolution
- your scaling related code (all of it) (tell me where it is, in which object and in which event)
- your application surface drawing code (tell me where it is, in which object and in which event)
 
A

Advokitt

Guest
!~!~!~!~!~! SOLUTION BELOW !~!~!~!~!~!
Okay... I'm back to it again. I appreciate everyone's assistance.
To start I ensured that my tiles were each 32x32 as rIKmAN suggested just out of redundancy. They are indeed 32x32.

Now for what RangerX has requested.

In the Room Properties I have Viewports enabled and I have Viewport 0 set to visible.
Camera properties are set to 480x270
Viewport Properties are set to 960x540
The test monitor's resolution is set to 1920x1080
I have removed all scaling related code.
I have removed all application surface drawing code.

Based on the above, the tiles should scale crisply.

:: SOLUTION ::
Okay, now on to the good stuff. The issue I was experiencing is related to the Texture Page Size which can be adjusted under Game Options - "In this case Windows".
My tileset was roughly 2000px by 2000px and my Texture Page Size was set to 2048x2048.
Because my Output Border on the Tileset was set to 2, it created a 2 pixel buffer around each tile overflowing the 2048 cap.
Simply increasing the texture page size by the next available option, 4096x4096, the scaling and smudgey-ness cleared right up.
My goodness that was terrible, thanks to everyone who lent their help!
 
Top