FPS problem testing in Android

Hi, as the topic title says, I was testing my game (a platformer) in my Android phone and when I reach the middle of the level (does not depend in the level I test) the game starts trembling. If I go back to the beginning the trembling disapear.
It seems an FPS problem but I dont undestand why only appears once I reach the mid-level point.
If i finish the level and start another, the game starts normally until I reach the middle of the level again.
All levels are loaded through proxys and while a level is played nothing more that the level is loaded. At the end of the level it is unloaded too.

Are you spawning/despawning game objects at different points in the level? What happens if you use the profiler (visual or web)? Capture some frames at the beginning/end of the level when everything is smooth and do the same in the middle and compare them. I’m sure some value is peaking.

I believe this could be a matter of precision.
As you are scrolling away from origo better precision might be necessary for the camera.
At least in earlier versions of the engine the vertexprogram of the engine had the precision of “medium” like this:

uniform mediump mat4 view_proj;
uniform mediump mat4 world;

attribute mediump vec4 position;
attribute mediump vec2 texcoord0;

varying mediump vec2 var_texcoord0;

Try create a new material using the “old” fragment-p but creating a new vertex-p with the head like this:

uniform highp mat4 view_proj;
uniform highp mat4 world;

attribute highp vec4 position;
attribute highp vec2 texcoord0;

varying highp vec2 var_texcoord0;

That did the trick for me at least.
See if it helps.

/A

1 Like

Ah, good point @Andreas_Jirenius. That could be it!

Hi, thanks for your replys.
I try both of the things. I try using the visual profiler and removing the spawning game objects but dont seems to have lots of changes in the values. Trying the vertexprogram that @Andreas_Jirenius sugessted it improves something, but still tremble a little bit. (I dont try it without de spawning game objects)
I was thinking in change the behaviour of them to just hide and not delete the enemys go for example. You thing it will improve something? I’ll post something when I try it.

It’s better to delete game objects when you don’t need them anymore. Let us know how it goes.

Have the exactly same trouble on iOS.
I try to make some platformer prototype where camera follow player, and this bug(?) was realy show stopper for me.

Way to reproduce:

Place some visible game object at (0, 0). (Doing so you can observe camera movement)
Place camera at (-300, 0). In camera script “init” do:

msg.post("#camera", "acquire_camera_focus") go.animate(".", "position.x", go.PLAYBACK_LOOP_PINGPONG, 300, go.EASING_INOUTSINE, 10)

See smooth, nice camera animation.

Place some visible game object at (7000, 0).
Place camera at (6700, 0). In camera script “init” do:

msg.post("#camera", "acquire_camera_focus") go.animate(".", "position.x", go.PLAYBACK_LOOP_PINGPONG, 7300, go.EASING_INOUTSINE, 10)

See horrible, choppy camera animation!

Any other objects animates fine at (0, 0) or faaaar from origin.

This happens on my iPad mini 2 (retina) with ios 9.3.1
Defold Editor 1.2.80

This is not happens on desktop.

Workaround from Andreas_Jirenius (change precision, then assign new material on all sprites) works. Is this official suggestion from engine developers? Or future version of Defold would fix that?

2 Likes