• 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] Weird sprites and tiles stuttering / jiggling

D

Dwojityv

Guest
[SOLVED]

THANKS GUYS!!
I AM WRITING IN CAPS, BECAUSE I AM SO EXCITED!

The problem really was my wrong zooming in.. To make it more clear : my base resolution of game is 640x360 . When zoomed, it was 448x252.. Somehow I thought that if I keep the same aspect ratio, nothing bad could happen. Oh was I wrong.
I basically changed values and now I zoom to 320x180. This means I have to change how my camera works now, but I rather code camera again than dealing with that pesky stuttering!

Again, thank you very much!
------------------------------------------------------THE PROBLEM-----------------------------------------------------------------
Hello,

In my game (platformer), instead of moving player, I move all tiles and objects. However, everything that moves is stuttering / jiggling, almost blinking. It's so distracting!

I tried to figure out what's going on, so I recorded my game, zoomed in and this is the result as GIF:

http://imgur.com/a/w4JSq
This is zoomed in frame by frame recording of grass in my game - that's where the stuttering is visible most.
If you pay attention to single piece of grass - in one frame it's thick and in other it's thin.

I move all the tiles using this code: (global.moveSpeed = 5)
Code:
/// Moving Tiles
tile_layer_shift(1000000,-round(global.moveSpeed),0);
And I move object with this code (I use parent for most)
Code:
/// Moving all objects
x-=round(global.moveSpeed);
I handle the global.moveSpeed in collision-detecting code and it's working properly - by using debug I figured out the variable stays at 5 (it's not switching between 5 and 0 or something)
I also tried to turn on/off Interpolate pixels in settings and using round() or without round() it's still the same.

This is GIF of game in progress - Yes, I zoom in my game using views, but the problems persists even if I keep the game in original size, so that's not the problem.
http://imgur.com/a/LiRT4
Again, look at the grass, that's where it is visible most.

I should also mention, that this happens on Windows and Android - I didn't test anything else, but I think that problem isn't because of platform.


I am being desperate now. I can't seem to find fix to my problem. I think that I browsed google for few days straight now.
If you guys have any idea, I would be so happy if you help me out. I put so many hours into this game and I feel like I can't release game with this choppy blinking graphics.
btw sorry for my bad english, it's not my native language and longer texts aren't on my bright side! :)

Thanks!
 
Last edited by a moderator:
G

gold_maker

Guest
Hi, well that it maybe a bug but if a were u i will keep it like this it is nice effect. and the game look awesome keep it up!
 
M

McWolke

Guest
It looks like you are scaling wrong. You probably have some decimal scaling value (1.5?). Look into some scaling/view tutorials and you will understand why this happens. I'd explain here but i am on my phone right now.
 

DukeSoft

Member
Yep, zooming of your views is what causes this. I'd replace your assets with vector images. Then it will look good no matter what scale :)
 
D

Dwojityv

Guest
Hey thanks for your replies.
Problem is, this happens even when I dont zoom in, only it's not that visible.

About the zooms, i always keep 16:9 aspect ratio.

Changing to vector at this point would be pretty hardcore, because I have so many assets in my game
 

Roderick

Member
Hey thanks for your replies.
Problem is, this happens even when I dont zoom in, only it's not that visible.

About the zooms, i always keep 16:9 aspect ratio.

Changing to vector at this point would be pretty hardcore, because I have so many assets in my game
Aspect ratio isn't what they're talking about.

If you have a sprite that's 2x2 pixels, and zoom in 50%, you end up with it being 3x3. That means that each pixel is 1.5x1.5, which isn't possible, so some become 2x2, others become 1x2, still others become 2x1, and the rest atay 1x1, which is the cause of the distortion.

Similarly, if you're moving tiled objects by fractions of pixels, some will round up while others round down, resulting in gaps or overlaps. For this reason , you should always use floor() or ceil() - pick one and use only that one throughout all your code - to round the x and y positions to whole numbers.
 
D

Dwojityv

Guest
Aspect ratio isn't what they're talking about.

If you have a sprite that's 2x2 pixels, and zoom in 50%, you end up with it being 3x3. That means that each pixel is 1.5x1.5, which isn't possible, so some become 2x2, others become 1x2, still others become 2x1, and the rest atay 1x1, which is the cause of the distortion.

Similarly, if you're moving tiled objects by fractions of pixels, some will round up while others round down, resulting in gaps or overlaps. For this reason , you should always use floor() or ceil() - pick one and use only that one throughout all your code - to round the x and y positions to whole numbers.
OH! That didn't really come to my mind. I Will try to think of way to make viewsize where that doesnt happen. My sprites are mostly 32x32 so that shouldnt be such a big deal! (I Hope hehe)

Thanks!
 

DukeSoft

Member
You *can* also try to disable texture interpolition (or disable interpolition between pixels, in the game settings).

I feel like disabling this makes the half pixels less visible (they are still there, but pixels are rounded up / down, instead of being "smeared (interpolated)") and in general this makes it look better, to me.
 
D

Dwojityv

Guest
THANKS GUYS!!
I AM WRITING IN CAPS, BECAUSE I AM SO EXCITED!

The problem really was my wrong zooming in.. To make it more clear : my base resolution of game is 640x360 . When zoomed, it was 448x252.. Somehow I thought that if I keep the same aspect ratio, nothing bad could happen. Oh was I wrong.
I basically changed values and now I zoom to 320x180. This means I have to change how my camera works now, but I rather code camera again than dealing with that pesky stuttering!

Again, thank you very much!
 
Top