Game gets laggy
I have a game with 200,000 pixels of scene.size.height
It's a hero that constantly is jumping from one platform to the next, like Doodle Jump.
So, a loop behaviour is constantly spawning 1 platform every 100 pixels my HERO moves up, and it has a parameter of only doing this within 500 pixels above my HERO's head (i double checked this and it works fine)
There are clouds being created as well every 300 pixels my hero moves up.
There is a bonus gem being created every 12 seconds that makes my HERO do a mega jump of he collides with it.
All my actors have the destroy behaviour very well put (when they surpass a certain amount of pixels south of my hero (I double checked and it works perfectly fine)
So, technically, there aren't an overbearing amount of platforms being created since the spawning has a threshold of activating only 500 pixels above my hero, and all the platforms are constantly being destroyed 1000 pixels below my HERO... am I missing something? Why does my game slow down after like 30 seconds?
It would be so nice to have a list of possibilities. Thank you!
Comments
So, my game starts off super fluid, not laggy at all, then 30 seconds down the line it gets laggy... what can it be, if I made sure that there are no more than 12 actors on screen at a time who are constantly being destroyed and spawned...
Is there something else that is accumulating that I'm not aware of?
Something I realized in other apps is that the first day I download them they weigh lets say 30mbs, then a week later they weigh 40 mbs, and so on... it sometimes gets into the hundreds.... is there something similar happening with my app but at a more rapid pace?
well, there is a constrain on the HERO's climb (point system)... it's a crazy little formula... hmmm, I have a feeling it is this... I have like 5 of these formulas hanging around... constantly calculating the hero;s distance traveled....
I'm talking to myself in this forum... dancing by myself... Billy Idol anyone?
Hi,
I can take a look at the file if you wish (Just PM me),
I would say your spawning rules are causing the lag, and the formula isn't correct causing for a constant spawning of actors. I am sure there is an simpler way to do what you described (Doodle Jump style).
Best,
Two.E
GSLearn.com | Templates | Free Demos | Udemy Course
Constantly spawning and destroying actors can be far far laggier than just having the actors there on the screen. The spawning mostly. Particularly if they're actors with minimal logic in them. Like @Two.E said, though, it'll be hard to say without seeing the file.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support