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!
Graphics "jitter"?
-
- Prole
- Posts: 2
- Joined: Mon Jul 22, 2013 10:56 pm
Graphics "jitter"?
- Attachments
-
- stars.love
- (82.74 KiB) Downloaded 199 times
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: Graphics "jitter"?
It seems to me if you set the pointstyle to smooth instead of rough, the stars move more smoothly.
Re: Graphics "jitter"?
Try setting the image filter to nearest.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
-
- Prole
- Posts: 2
- Joined: Mon Jul 22, 2013 10:56 pm
Re: Graphics "jitter"?
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.
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.
Who is online
Users browsing this forum: Bing [Bot] and 2 guests