Initial level performance problems

I am currently having a problem in relation to performance on ios/android.

When a level starts for the first 5-7 seconds or so everything seems to run slowly. After that time everything seems to run perfectly.

I am not sure if I am doing anything wrong in general but I am wondering if it has to do with setting up the level. Between adding assets and music, etc I wonder if that is causing any animations to have heavy framerate drops. Would a preloader help?

If it would help would someone be able to explain to me exactly how they work? I have tried to do a bit of reaserch myself but do not exactly understand how it all works and how to implement it.

Any help would be greatly appreciated. [import]uid: 69531 topic_id: 17941 reply_id: 317941[/import]

Are you running on a device or the simulator? If you are on a device, what device and mode?.

Are other apps also in memory?

-David [import]uid: 96411 topic_id: 17941 reply_id: 68477[/import]

In the simulator everything always runs perfectly.

We have tested on the following devices and always the same problem: ipod touch 4th gen / Ipad 2 / HTC Evo / HTC Evo 3D [import]uid: 69531 topic_id: 17941 reply_id: 68483[/import]

i assume you need to load everything you can before starting initial level [import]uid: 16142 topic_id: 17941 reply_id: 68485[/import]

Yes, everything in the level is loaded as soon as the game starts. The only difference between levels is where the items are placed, so when a player restarts we do not usually see any problems… it is only when the initial first level is loaded.

It is something that I am sure players would not complain too much about but we would prefer to figure out how to make it run perfectly all the time. [import]uid: 69531 topic_id: 17941 reply_id: 68488[/import]

5-7 seconds are too much load all the big images first do not load any large musics use audio.stream for that also consider to put loading screen while all your assets are loading after this start all your functions or listeners to play the game
:slight_smile: [import]uid: 12482 topic_id: 17941 reply_id: 68513[/import]

Any guidelines on the best way to preload stuff?
As far as I can tell we can’t tell exactly when everything is loaded up so we wouldn’t know when to finish the loading screen and start the listeners for gameplay.
Maybe I’m missing something there but a solid example would be amazing.

Thanks. [import]uid: 69531 topic_id: 17941 reply_id: 68846[/import]

create your scene something like below

[lua]local var1,var2…

function loadImages()
bg = display.newImage(“bg.png”,0,0)



end

function startTheGame()
Runtime:addEventListener…
timer.per…
end

loadingScreen()
loadImages()
removeloadingScreen()
startTheGame()[/lua]
please make sure u r not adding your loadingscreen image to anygroup else when you load new image that will be on top of that
:slight_smile: [import]uid: 12482 topic_id: 17941 reply_id: 68849[/import]