My character is randomly wiggling when moved

@Pkeod I’m just at the start of building my own physics and I got to horizontal speed calculations. Just for testing purposes, I put set_position. It wiggles randomly all the time (pixel forward or backward from supposed position). Numbers show that applied speed or position is all right but visually it is bugged.

@lutfi.altin No, I’m rounding to whole numbers there. Meaning it will be moved when rounding down returns an integer value (in my case either 1, -1, 2 or -2 since max speed is 2).
That calculation is a simplified version to get int values but still, it returns exactly needed values. You can see in the attached project (It is only the start of the physics system).

TrueTileCollision - Copy.zip (43.3 KB)

I’m not seeing “wiggle” can you record what you see?

https://www.screentogif.com/

1 Like

@Pkeod, screentogif seemed too unstable for capturing it. I used OBS.

Could you add this to your init?

	timer.delay(1, false, function()
		profiler.enable_ui(true)
		profiler.set_ui_mode(profiler.MODE_RECORD)
		profiler.set_ui_mode(profiler.MODE_SHOW_PEAK_FRAME) -- comment this line to not show peak only
	end)

Do you see any huge spikes in ms?

2 Likes

Compilation failed. Closing ‘)’ missing but:

function init(self)
	msg.post(".", "acquire_input_focus")
	local url = msg.url()
	local id = go.get_id(".")
	init_physics(self, id, url, "/level/background#tiles", "collision", 16, 2, 4.8, 0.23, 1, 4)
	set_hitbox(self, -5, 4, 16, 0)
	timer.delay(1, false, function() -- here ')' doesn't fix
	profiler.enable_ui(true)
	profiler.set_ui_mode(profiler.MODE_RECORD)
	--profiler.set_ui_mode(profiler.MODE_SHOW_PEAK_FRAME) -- comment this line to not show peak only
end

You’re missing the last bit of the code snippet I posted. end)

1 Like

Silly me.
I don’t know what to really look, but it seemed OK and for my surprise it didn’t have random wiggle.

Something weird is happening, maybe someone else has an idea.

1 Like

I have NO IDEA what’s happening. I went bit further on my physics and there’s not wiggle anymore… And code has nothing to do with it.

Maybe related to my issue.

If you can, maybe try my uploaded project few replays back.
My character DID that when it moved on static camera.

1 Like

I tried your project on my imac and I don’t notice wiggle at all. Unfortunately I cannot try on my iphone (where my issue happens) because there aren’t controls for mobile on your project.

1 Like

I haven’t gone that far with Defold, but if you can add any controls to give input left or right it will move.
or call funtion button_left(self) or button_right(self).

1 Like

I have added basic controls to get it working on mobile, but I don’t notice any wiggle even on my phone, so this is a different issue than mine.

1 Like

Ok, so it started to do it again and this time it did it with debugger:
I don’t know what is Engine.Sim. Here’s the project file
TrueTileCollision - Copy.zip (121.4 KB)

Could it be that having open other applications do this? Because I closed down some applications and didn’t notice that stutter.

Can someone explain what’s happening? It started again out of blue. Here I captured that stutter stops when I turn on debugging.


Here’s the project (debug run in player script). TileCollisionPlatformer.zip (62.4 KB)

Happened before last update and stayed after update. Got to say really killing the vibe for working on project.
EDIT: F2 is peak record debugger

For me, I don’t see the stuttering when I run your project as is, but I do see it when I uncheck vsync and set update rate to 60 in game.project. What this tells me is that your video card might not be allowing vsync to be on when it’s enabled in game (this is something the engine still struggles to get right) which then makes it stutter for whatever reason. Check your graphics card settings and see if you can make a profile for the game to always force vsync on, or set vsync on by default for all programs. Ideally solving this so it “just works” should be a huge priority for engine team and probably is. :slight_smile:

I have GeForce 1060 and after setting it ON in Nvidia control panel it still stutter. :frowning:
Why it stops when debug is enabled?

Who knows, but I see the same thing when vsync is disabled and the profiler displays. Only engine team can say for sure what’s going on but might be hard for them to reproduce. @Johan_Beck-Noren

I saw something like this on another game engine if the Camera Component has been used.