Open drewaburden opened 10 years ago
I've been able to address the stuttering, but doing this causes the player to appear as if he is lagging behind the camera pan and then quickly catching back up every few seconds. It is also barely noticeable, but noticing the lagging is probably better than noticing the stuttering.
Something I did made the stuttering more noticeable, so now there's the camera lag and the stuttering. I can probably get rid of the camera lag, but who knows what that'll do to the stuttering. I'm still looking into this.
The camera lag was fixed with b4501656a4719fc86d253ece270c96dc7eb3ecf8. As far as the player jitter goes, it doesn't always happen. Sometimes it's really bad. Sometimes it's not noticeable at all. Another thing is that the sprites in the background jitter when the player moves while camera is sitting at the edge of the bounds, i.e. not moving. So, for instance, when the camera has reached the far right edge of Scene1, if the player moves around while not panning the camera, the sprites in the background jitter around. This leads me to believe that it might have something to do with the bounds checking.
Using one deltaTime per render iteration seems to have had no effect. I also tried using getRawDeltaTime() to get non-smoothed frames and that also appears to have had no effect. My next thing to try is to alternate the rounding of the camera position. So, on one iteration, it rounds up, then the next it rounds down, then up, and so on. Hopefully doing that will keep the camera from drifting away but keep it at a TextureFilter.NEAREST-friendly position.
I think I've fixed the background sprite jittering. I had forgotten to fix the other half of the problem that was causing the camera lag. This fix will probably be included in my next commit.
Alternating rounding of the camera position seems to have done nothing.
I may have finally figured out what is wrong. Instead of using Euler integration (simple position += velocity*deltaTime
), I need to be using Verlet integration or something similar.
Well, that didn't seem to work either. I have absolutely no idea what is causing this.
This is possibly happening because the resolution is somewhat low. Allowing for more pixels to work with might help fix the problem (or possibly make it worse if the user chooses an even lower resolution, however unlikely). Initial tests for issue #30 seem promising.
When the player moves close enough to the edge of the screen as to trigger the camera panning, the player movement appears to jitter very slightly. It's hardly noticeable. Some theories as to why it's doing this: