Describe the bug (REQUIRED)
Hi! I was playing around with the camera in defold-orthographic, and after having played my game for a few minutes on my old Samsung, lag spikes started occuring. The framerate dropped more and more for every minute I used the application. After having stripped almost everything from my own script, I found out that it stopped happening when I either turned off the camera follow or stopped moving the game object that was attached to the camera.
Then I went into the orthographic.render_script and tried to set the view matrix to an identity matrix vmath.matrix4(). That made the lag spikes disappear even when follow was ticked. More specifically just
--frustum = proj * view
frustum = proj * vmath.matrix4()
seemed to solve the problem.
My final step was to create a new Defold mobile template project and try to translate the view matrix in the render script. That also caused the lag spikes, so I guess it has nothing to do with the defold-orthographic. In other words:
self.pos = (self.pos or vmath.vector3()) + vmath.vector3(0.01, 0, 0)
self.view = vmath.matrix4_translation(self.pos)
placed before calculating the frustum caused lag spikes from a fresh mobile template project on my Samsung.
To Reproduce (REQUIRED)
Steps to reproduce the behavior:
- Use Defold 1.4.2.
- Start a new Mobile game from templates
- Go to default.render_script
- Add the lines
self.pos = (self.pos or vmath.vector3()) + vmath.vector3(0.01, 0, 0)
self.view = vmath.matrix4_translation(self.pos)
before calculating the frustum in default.render_script.
- Print the fps
- Run the game for >5 minutes on an old(?) phone (android)
- See fps drop over time
Expected behaviour (REQUIRED)
I expect the engine to keep the framerate stable when altering the view matrix.
Defold version (REQUIRED):
-1.4.2
Platforms (REQUIRED):
- Android 8.0.0
- Galaxy S7
Screenshots (OPTIONAL):
Below are plots of all the occurences when the fps is < 55. In the first picture I am not altering the view matrix. In the second one I am.
Does anyone know what could be the problem here? Thanks! By the way, it’s great to use Defold again!