Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Prealoading assets — Gideros Forum

Prealoading assets

NinjadoodleNinjadoodle Member
edited June 2014 in General questions
Hi Guys

I just wanted to ask a couple of questions about preloading and whether it's necessary etc.

How does loading in Gideros work? Does it load into memory only what's in the current level?

If that's the case, is there a danger of a long wait when switching from scene to scene, waiting for the next scene to load?

I'm not really sure whether preloading is necessary, so I'm wondering how you guys go about doing this.

Thank you in advance!

Comments

  • ar2rsawseenar2rsawseen Maintainer
    In Gideros texture loading is synchronous, it means if it takes time to load the image then the game will freeze.
    Thus it is recommended to preload all your assets on scene start, or better yet to pack the into texture packs, one pack for each scene or as close to it as possible :)
  • Hi ar2rsawseen

    Thanks heaps for the quick reply! I'm still not quite sure how to go about this tho.

    Do I have to load the assets inside a Scene Start listener or just at the top of the script somewhere?

    I've been searching the forums and found some examples, but I'm still pretty confused about this.

    I'm gonna have a look into it some more and see what I can figure out :)
  • ar2rsawseenar2rsawseen Maintainer
    well the usage really depends on your game
    If you can fit all assets in 1024x1024 then just put them in one pack and store in global variable, thus they will always be in memory

    If there are more textures, then try dividing them by scenes.

    In this case on scene init you would load a texture pack and store it in scene property
    on scene exit you could (but not mandatory) call garbagecollect (I even think sceneManager does it automatically for you)

    If there are too many images overlapping between scenes, then you can create one global pack with most common images and then each for each separate scene.

    Just don't get your one single pack bigger than 1024x1024 if you want your game to run on all possible devices, even old ones.

    Since loading one bigger pack will take more time on scene start (but speed up the running scene), then I implement a little hack into scenemanager to display a loading text

    http://giderosmobile.com/forum/discussion/comment/3220#Comment_3220

    Hope that helps :)
Sign In or Register to comment.