Endless Game performance problem

Shommey

  • Posts: 14
I discovered strange problem in performance drop after some time in my game. I have 7 "Do every N seconds" events for spawning obstacles and collectables.. When load play scene obstacles and collectables start spawning after "Game Started" Bool becomes true, which becomes true after a button touch. So, when scene is created, timers start to work immediately and check if game is started, otherwise it wont spawn. I waited 10-15min before starting spawn, and there was no performance drop, everything was fine, so the timers are not causing performance drop. Then pushed button, everything started spawning as it should and collision and all other stuff I have worked perfectly, but after 5-6mins of playing, game becomes unplayable, lagging, low FPS.
Before posting, I've checked if everything is killing on leaving screen, and it does...
Game is for Android, and I have tested it on mutiple devices. This is a small game, and devices are high-end, so devices should run it perfectly.

Since in Stencyl 3.x evry actor is recycable, my guess is something with actors isn't good. Anyone konw how to check recycled actors pool, or anything else I can do?

merrak

  • *
  • Posts: 2738
I had a case earlier where dead actors seemed to still respond to events. Do you happen to have any events on the actors themselves (not in behaviors)? If so, try putting some print statements in them and see if they're still firing after the actor is dead.

I usually don't use events outside of a behavior for anything other than temporary debugging. What I noticed was that the dead actors were responding to my debugging controls, but no sign of code in behaviors executing.

Shommey

  • Posts: 14
Thank you for your answer..
Yes, I have events on actor themselves. Those are mostly:
When created
every 0.5 sec grow self to.. etc
Those events are just for visual effects.

How do you check them if they are responding? I put event to actor:
When self is killed
do every 1 sec print something..
And nothing prints.
Am I doing this wrong?

merrak

  • *
  • Posts: 2738
Try putting a print statement on the 'every .5 sec' and see if the prints continue to display after the actor is "killed". I have a suspicion it will continue to print. If so, we found the problem!

Of course, we need the solution, too :)

Maybe try moving the events to a behavior? I'd help you out doing some experimenting, but I have a larger project running/compiling. I'm very interested in the answer myself. If I get around to checking it before you do, I'll let you know what I find out.

Shommey

  • Posts: 14
I just tried putting print, as you said, on various actors (both collectables and obstacles) and when it goes of screen it gets "killed" and it stops printing..
So, you think putting events to behaviors will help? :)

I'm still thinking about checking recycled actor pool size. But I can't find any code (or block) how to print it out to console.
If I find out someting more about this problem in meantime, I'll let you know. :)