• 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!

GML Fix Pixels Distortion??

K

KaiXtr

Guest
Well, Let's Contextualize... You are creating a game, when you see that the graphics are not like you want, because the option "Interpolate colors between pixels" are marked, So you dismarks, and now the game is like you painted, yep? No, some pixels are larger than other pixels, even if the pixels are with the same size, It's because this I'm calling for help here.

Capturar1.PNG

Capturar2.PNG

Capturar3.PNG

Should I rezize my View? :(
 

DesArts

Member
If you dont want some pixels larger than others, you need to scale up by an integer amount. Like 2x, 3x, 4x, 5x etc, and nothing inbetween.
 

Simon Gust

Member
Well, Let's Contextualize... You are creating a game, when you see that the graphics are not like you want, because the option "Interpolate colors between pixels" are marked, So you dismarks, and now the game is like you painted, yep? No, some pixels are larger than other pixels, even if the pixels are with the same size, It's because this I'm calling for help here.




Should I rezize my View? :(
Do you have scaling going on?
 

Nux

GameMaker Staff
GameMaker Dev.
you probably need to set your application surface to the same size as your view using: surface_resize(application_surface,view_wview,view_hview). To save on processing, only do this each time the view size/window size has changed.
 

TheouAegis

Member
Also make sure the position of the pixels relative to the view is an integer. If x-view_xview and y-view_yview are not integers, then GM will round off the pixels.
 

RangerX

Member
If you want to understand why distortion occurs, I explain it at the beginning of my tutorial here:
https://forum.yoyogames.com/index.php?threads/how-to-properly-scale-your-game.995/

Basically the first answer to this thread is the good one. You need to scale up your game by a integer factor or else there will logically be pixels added or removed by the engine because fractions of pixels don't exist.
In the global options you can set "keep aspect ratio" in the graphic tab wich will make GMS resize your game with no stretching. However if you want it pixel perfect at all time (no distortion on any monitor of this world), you need to set your game like the first method am giving in the tutorial. Basically setting the application surface size yourself and scaling it up only if it fits in the screen.
 
K

KaiXtr

Guest
If you want to understand why distortion occurs, I explain it at the beginning of my tutorial here:
https://forum.yoyogames.com/index.php?threads/how-to-properly-scale-your-game.995/

Basically the first answer to this thread is the good one. You need to scale up your game by a integer factor or else there will logically be pixels added or removed by the engine because fractions of pixels don't exist.
In the global options you can set "keep aspect ratio" in the graphic tab wich will make GMS resize your game with no stretching. However if you want it pixel perfect at all time (no distortion on any monitor of this world), you need to set your game like the first method am giving in the tutorial. Basically setting the application surface size yourself and scaling it up only if it fits in the screen.
I did the first option, the "Pixel Perfect" Example, But the game displays only a black screen of loneliness and sadness...

Check Out the code:
Code:
Create Event:

execute code:

application_surface_draw_enable(false)
window_set_fullscreen(true)
global.monitorw=display_get_width()
global.monitorh=display_get_height()
global.xoffset=(global.monitorw-400)/2
global.yoffset=(global.monitorh-300)/2

global.fade=false

set the mouse cursor to sprite Spr_mouse and don't show the system cursor
set Alarm 0 to 1
Alarm Event for alarm 0:

Go to next room
Step Event:

execute code:

if(global.monitorw>=1600 && global.monitorh>=900)
then
{
surface_resize(application_surface,800,600)
global.xoffset=(global.monitorw-800)/2;
global.yoffset=(global.monitorh-600)/2;
}

Draw Event:

execute code:

draw_surface_ext(application_surface,global.xoffset,global.yoffset,1,1,0,c_white,1);
surface_reset_target()
I made other object in other room, and after 1 frame, jumps to the real game. Maybe I'm doing this totally wrong...
(And wow, your tutorial is really useful!)
 

RangerX

Member
-Make sur all your objects are having a draw event with "draw self()" in it. (although it SHOULD work without it)
-Don't resize your application surface all the time (step event). Resize it ONCE when the game opens. (in some ini room before your titlescreen for instance)
-Also, if you draw with all your object in normal draw, you can be sure everything is on the app surface when you draw it on screen in a "post draw" because this event occurs after normal draw.

what's your view size? (or camera view size if you in GMS2)
 
K

KaiXtr

Guest
-Make sur all your objects are having a draw event with "draw self()" in it. (although it SHOULD work without it)
-Don't resize your application surface all the time (step event). Resize it ONCE when the game opens. (in some ini room before your titlescreen for instance)
-Also, if you draw with all your object in normal draw, you can be sure everything is on the app surface when you draw it on screen in a "post draw" because this event occurs after normal draw.

what's your view size? (or camera view size if you in GMS2)
All objects have a draw_sprite or draw_sprite_ext in them, I don't know if that can disturb. in addition, they also have another code to put the shadows (which is nothing more than to repeat the code, change the coordinates and the color) and the ball has a surface for the brightness. the size of my view is 400x300. The Black Screen Continues but the custom mouse appears.
 
K

KaiXtr

Guest
Well, now I resized to 396x286 to match my 22x22 grid but I made the appropriate changes
 
S

Swagbob5

Guest
Ok thanks, But the object is moving around the screen and during the game and only when it moves it creates the distortion so how do I use the surface_resize throughout the game and only for that particular object? Is there something that I'm missing?
Any help would be appreciated, Thanks in advance.
 
S

Swagbob5

Guest
Yes , I did. Is it possible that I may have made a mistake with the code?
 
Last edited by a moderator:
No, just the way you asked about "using it throughout the game". The code FuRvyok gave you DOES apply throughout the game. It resizes the application_surface until you manually resize it again.
 
S

Swagbob5

Guest
Thanks so much, I realised I had made a mistake within my own code and :
surface_resize(application_surface, view_wview, view_hview);
worked perfectly , Thank you:)
 
F

FuRyvok

Guest
If you don't play the game on fullscreen mode, and the game window's width or height is too small, than you can do the following:
Code:
surface_resize(application_surface, view_wview*2, view_hview*2);
You can multiply the width or the height.
 
Top