Page 1 of 1

Graphics "jitter"?

Posted: Mon Jul 22, 2013 11:32 pm
by laserdollars
I am having an issue where the objects I draw seem to "jitter" (I don't know of a better way to describe it) as the screen scrolls. I have a feeling this is due to the way the draw functions handle float coordinates, but haven't been able to figure it out.

I generate a static field of stars based on world coordinates and then a set of dynamic stars that scroll past as the ship moves. I have this part working, as well as ship movement. The problem occurs when the camera moves with the ship and scrolls the screen...the stars themselves do not scroll smoothly and seem to snap around; same with the ship. I tried math.floor to try and keep everything integers but it didn't seem to help.

Anyway, I've attached my .love so you can hopefully see what I'm trying to describe. Use WASD to control the ship (it can fly out of bounds; I haven't got to that yet). Everything is in main.lua; you can ignore the console stuff as I'm just using it to help with debugging.

I appreciate any help that may be offered; thanks!

Re: Graphics "jitter"?

Posted: Tue Jul 23, 2013 4:32 pm
by DaedalusYoung
It seems to me if you set the pointstyle to smooth instead of rough, the stars move more smoothly.

Re: Graphics "jitter"?

Posted: Tue Jul 23, 2013 6:21 pm
by Davidobot
Try setting the image filter to nearest.

Re: Graphics "jitter"?

Posted: Tue Jul 23, 2013 8:40 pm
by laserdollars
Thank you for the suggestions, but I was able to figure out the issue.

Turns out the problem was with the way I handled dt in love.update() and thanks to this thread I was able to fix it. Running it with vsync off helped me figure out how the physics for the stars/ship were flawed. The dt became so small that eventually the ship wouldn't move because of the incredibly small increases to velocity based on the dt. When I tried it with the JIT version the ship wouldn't move at all :(. But now, I have a target dt that update aims for and my ship flies super smooth. Cheers.