Jitter in 2d top-down pixel game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Efromomr

Greetings everyone!

Here’s a link to video with my problem: Kapwing — Create more content in less time

I’ve been struggling with jitter issues for last week. My game runs smoothly in the windowed mode (but still jitter rarely occures) and heavily jitters in the fullscreen mode (looks even worse than on the video).

At first, I didn’t pay attention to that because I thought that this was the problem of my graphics card or just the editor issue that wouldn’t appear in the exported version. However, jitter persists on my friends’ computers and the exported version isn’t a bit better. In the early project versions that was just a subtle movement and now that has become a great problem.

I have pixel snap, vsync and transform snap (feature from 3.2.4 beta) on, though the latter two don’t seem to change anything. Without pixel snap there’re lots of black lines on the screen.

My player moving code is done in _physics_process(), the camera is attached to the player via RemoteTransorm2D. Camera process mode is set to physics (turning this one to idle doesn’t make a change), playing around with drag margin camera size doesn’t seem to have any effect too.

I experience a slight FPS drop (from 60 to 40-45) when I run the game in fullscreen mode, though I doubt that performance issues are the reason of jitter (I’m not running any complex functions in the _process or _physics_process functions). Even if so, I can’t
make out what can cause such a trouble. My scene is organised this way: Scene hosted at ImgBB — ImgBB The map consists of 140x140 tiles, some of them have collisions, I have 3 global scripts (one for stats, one for inventory list, one for some utils). When I remove every single node apart from player and tilemaps, I still get jitter, although it occurs rarely. Maybe I miss some silly issue that can cause serious performance downgrades? Or is it a camera issue?

Thanks in advance!

My friend has the same problem, please respond if you find a solution

Hastur | 2020-11-25 09:04

If you have multiplies the movement vector with delta , undo that. The game would become slow on low fps but not gittery

Dinoking | 2020-11-25 09:42

Removed delta from movement function but that didn’t help :frowning:

Efromomr | 2020-11-25 12:44

Engine.set_target_fps(Engine.get_iterations_per_second())

Try this and comment if it works or if it doesn’t.

Dinoking | 2020-11-25 13:07

Unfortunately, it doesn’t work (my monitor refresh rate is 60 hz and Physics FPS in settings is set to 60)

Efromomr | 2020-11-25 16:19

Then it’s probably sprite issue, check if your pixel snap causes problems. Sometimes (it happened to me) there are wierd scenarios where you have every thing correct but still the thing doesn’t work. Maybe reimporting the sprite and resetting everything in the scene work?

Dinoking | 2020-11-26 08:52

Have rebuilt the scene using the same nodes and child scenes, it works perfectly now. Thank you for a piece of advice, I guess that I would continue struggling with this problem for long, if you didn’t help me!

Efromomr | 2020-11-26 17:06

Nice to help you out, happy coding :slight_smile:

Dinoking | 2020-11-26 17:25