Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Can I do progressive load before packing? — Gideros Forum

Can I do progressive load before packing?

edited October 2013 in General questions
I was looking today into the animation API trying to understand it...

And I saw the packing function where you give it a bunch of files and it packs using MaxRects for you.

This is slower than just loading something packed. But I figured if I could load each file separately and do a coroutine.yield() between them I could load huge animations without interrupting gameplay/loading bar (a problem my current version of the engine in Corona has... iPad Retina animations are crazy slow to load and freeze everything).

So, how I do it?

If it is not possible... can you add that as feature, please?
I make games for children: http://www.kidoteca.com

Comments

  • @speeder_kidoteca unfortunately texture loading is not assync and although it is in our roadmap, efficient implementation in our current system would be quite complex, as all works on a single thread.

    So even with coroutines, if file is large enough, it will freeze the gameplay.

    Most common suggestion is to preload all the files on the beginning of the scene.

    You can either create a static packed texture (using Texture Packer) and load it on scene start.

    Or load all separate files by creating Texture instances for them and storing as scene properties and use them later (you can even create a loading bar and update it between loaded textures this way).

    But unfortunately these are the all available options for now.
  • ar2rsaween

    I think you ALMOST understood me.

    I know large enough files will freeze things, that is my point, I want to load smaller files, one after the one using coroutines, instead of loading a large file.

    For memory efficiency reasons, it would be awesome if I could load those files separately, and then pack them in memory using maxrects.
    I make games for children: http://www.kidoteca.com
  • Aha, I see.
    so you want to know the progress of loading texture separately, but then also using all the perks of packed texture :)

    Unfortunately yes I don't think it's possible yet.
    While you could load all the graphics separately and then try to create the dynamically packed texture like this:
    local pack = TexturePack.new({"1.png", "2.png", "3.png", "4.png"})
    I don't think it will reuse the loaded graphics from memory, because they way it dynamically creates a pack differs from a standard texture loading way.

    So currently your best bet would be to create static preloader:
    http://www.giderosmobile.com/forum/discussion/995/how-can-i-create-preloader#Item_1

    or load separate files.

    As loading separate file may turn inefficient and won't provide smooth animation, I would go with a static preloader :)
    or even integrate it with SceneManager to appear automatically with every scene:
    http://www.giderosmobile.com/forum/discussion/comment/24059#Comment_24059
    http://www.giderosmobile.com/forum/discussion/3733/implement-loading-scene-/p1
Sign In or Register to comment.