Why does my simple game jitter/lag every 2 seconds?
-
If you are using a timer having an interval of 0s, the timer will eventually have a bit of delay and some jitterness.
For my games, I use the play animation behavior as a timer. Simply set an unused object to play a one-frame animation at a speed of 60 fps. Hook the play animation behavior to the other behavior as if the behavior was a timer. :)
-
@robinsonx I don't think it's the timer anymore. I disabled it (obviously ball goes off screen) and the jittering still occurs. Possibly disabling it made it jitter less, but it certainly still happens.
Even if the timer wasn't running at full speed, the only affect would be the ball moves slightly out of place. (Hopefully in next update they let you disable velocity on X/Y)
-
@kamdroid Might be better having a moving ball with still obstacles, and the camera following the ball. So in hyperPad, rather than having a heap of objects moving at once, you just have 1. I played it, couldn't notice much jitter on my iPad Air, only weird things that happened were I somehow got the ball stuck to the ground and couldn't jump :P only once.
-
@kamdroid what behaviors are you using to move the obstacles?
-
@itap-development Move to Point
I think the problem is probably because of the obsticales moving for the illusion of the ball moving.
-
@kamdroid are you moving a short distance constantly, or moving a longer distance and having a duration?
-
@itap-development Moves to a point (X axis) where it will be off screen and then destroys the object.
You could branch the project if you need to find out more.
-
Particles are a massacre and object initialization takes forever. Just a few guesses, though.
-
Since object initialization is a performance killer, maybe instead of constantly destroying and respawning objects, maybe just reuse them.
-
The more behaviours inside spawned objects, the laggier it will be to spawn them. Try to take behaviours out of spawned objects and put them in something else. If the spikes activate some behaviours when they touch the player, try to delete them and put them in the player instead, stuff like that. Could even put them all in a tag and have the world move all the objects at once rather than each object moving itself (though I'd still recommend just having the player move and the objects stand still).