Jump to content

Phaser preloading Tweens / loaded images in state / Phaser performance


Sam
 Share

Recommended Posts

Hi,

another question about performance~
I've been busy updating my code to get more performance out of Phaser and CocoonJS. Currently everything runs fine ( stable 55 - 60fps ).

Question / Problem
When I change States - for example I go from my titlescreen into the mainmenu State:
there are a few sprites set up and a few tweenings are done. A few means 3 - 6.
During the change into the state the game struggles a little bit - it is lagging and also the tweening is lagging.
This happens on all iOS devices (only developing for iOS included normal resolution screens / retina devices / iPad Air).

The images which are loaded, the audio and all the stuff is minimzed and optimized. There are no big file sizes which have to be loaded.

 

A few Questions on it
- Is there something like a preload for tweens?
- Or can I preload a state or something?
- Which other issues cause this?

All the stuff is preloaded in the "preload" function.
My states (example: titlescreen, mainmenu) are out of the "create" function -
as an own state, is that correct?
because to call everything into the create function themes a little bit overdue -
to call an entire game with all the logic etc on start.



Any suggestions / improvements?
 

Link to comment
Share on other sites

  • 9 months later...

Hi Sam,

 

I am experiencing the same issues with Tweens being slow or laggy at the beginning of a scene. I couldn't find a fix for it, but I stumbled upon a similar issue on Phaser's Github page.

 

At the end of that discussion they suggest adding some kind of splash screen on the scene to let it compile or catch up internally and have all the tweens ready to run. You could test it quickly adding a timer before starting the tweens to see if that approach would have a good effect. Something like:

game.time.events.add(Phaser.Timer.SECOND * 2, startTweens, this);

In my case the lag is more noticeable in Desktop Chrome than in Canvas+ with CocoonJS.

 

I hope this helps.

 

Cheers,

Ignacio

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...