Legacy GM View Problems

I have been having problems with my view.
I have my game view set to 640x360(which is a 16:9 aspect ratio, so I'm pretty sure its not because its trying to deal with the resizing), but I always get these disfigured sprites. they look as if it were to stretch a pixel 1 and a half times. im not really sure what is going on.
any help would be greatly appreciated.
 

Attachments

C

CROmartin

Guest
Hi @thandwiches01, if your port on screen is different dimension then your view size in room, it will cause stretching or reduction of whole view and that is why every sprite and image will be distorted. So you should have same port on screen size and view size in room to fix this problem.
Edit: I also remembered that turning off interpolate colors between pixels in global game settings could also help if your problem is not in what I mentioned above.
 
Last edited:
Hi @thandwiches01, if your port on screen is different dimension then your view size in room, it will cause stretching or reduction of whole view and that is why every sprite and image will be distorted. So you should have same port on screen size and view size in room to fix this problem.
Edit: I also remembered that turning off interpolate colors between pixels in global game settings could also help if your problem is not in what I mentioned above.
Thanks for the quick response, CROmartin!
I'm not really sure if I can fix that, though.
I am making a multiplayer game where the camera zooms out, and in, to be able to have both players in the view at the same time.
I already had interpolation off, so thats no the problem.
If you could have a quick look, and see if theres any way I could fix this, I would be so grateful

Code:
x1 = obj_player.x;
y1 = obj_player.y;
x2 = obj_player_2.x;
y2 = obj_player_2.y
border = 64;
vscale =
max(1,
abs(x2 - x1) / (view_wport - border * 2),
abs(y2 - y1) / (view_hport - border * 2))

view_wview = vscale * view_wport
view_hview = vscale * view_hport

view_xview = (x1 + x2 - view_wview) / 2
view_yview = (y1 + y2 - view_hview) / 2
Edit:
I also tried using a much simpler view system; One that doesn't require view resizing. it just changes the x and y coordinates of the view, and its still doing the same thing. I also made sure my ports are the same as my view's size. heres my code:
Code:
x1 = obj_player.x;
y1 = obj_player.y;
x2 = obj_player_2.x;
y2 = obj_player_2.y

view_xview = mean(x1, x2) - (view_wview / 2)
view_yview = mean(y1, y2) - (view_hview / 2)
 
Last edited:

Vishnya

Member
Thanks for the quick response, CROmartin!
I'm not really sure if I can fix that, though.
I am making a multiplayer game where the camera zooms out, and in, to be able to have both players in the view at the same time.
I already had interpolation off, so thats no the problem.
If you could have a quick look, and see if theres any way I could fix this, I would be so grateful

Code:
x1 = obj_player.x;
y1 = obj_player.y;
x2 = obj_player_2.x;
y2 = obj_player_2.y
border = 64;
vscale =
max(1,
abs(x2 - x1) / (view_wport - border * 2),
abs(y2 - y1) / (view_hport - border * 2))

view_wview = vscale * view_wport
view_hview = vscale * view_hport

view_xview = (x1 + x2 - view_wview) / 2
view_yview = (y1 + y2 - view_hview) / 2
Try to add
Code:
surface_resize(application_surface, view_wview, view_hview)
in that code
 
C

CROmartin

Guest
@thandwiches01 while zooming out and in you should make sure that view sizes scales proportionaly. I will give you example here: so lets imagine we have room with w360 and h360 and same port and view size also there is 32x32 sprite in room. So setting view size to 180x180 it will actually show 32x32 sprite like 64x64. If we do not watch out on sprite scalling based on view size it will cause sprite scale on uneven dimesions like 47x47 in case of viev scale 263x263 and that will cause 1 more pixel on one side of sprite. Now you should adjust your view scalling code so it dosent cause uneven sprite scaling. I hope this helped.
 
Top