How to Instantiate an Object and all Its Children

Started by AGP, July 11, 2013, 07:51:50 AM

Previous topic - Next topic

AGP

Different copies of the same files. I haven't serialized them on Android. I don't even know how to do it, to be honest, or what its benefits are (shorter load time?).

EgonOlsen

Yes, much shorter load time and reduced memory usage at load time. However, that still doesn't explain the problem. The only thing that i can think of ATM is a difference in your code between desktop and Android.

AGP

I can see absolutely no difference in my code. But as long as we're talking about load time, I have a little block that goes:


    allMaps = assets.list("city5");
    for (int i = 0; i < allMaps.length; i++) {
    manager.addTexture(allMaps[i], new Texture(assets.open("city5/"+allMaps[i])));
    manager.compress();
    }

I had to call compress() every time I added a new texture to keeo from running out of memory. I wouldn't think that this is very fast. Is there a better way to accomplish this? Would it be through serialization? Something else?

EgonOlsen

I would rather reduce the texture size for the mobile version. Depending on the device which you are using, you are limited to 16mb up to 256mb of memory for your Activity. If you have to compress data after each texture, your textures are too large IMHO. Serialization wouldn't change this btw., because it doesn't affect textures.
About the actual problem: I still have no idea nor can i verify it in my own android apps. Can you provide a simple test case that shows the problem?

AGP

Yes, I will e-mail it to you later today. Thanks.

And I already have reduced the textures to 256x256. That's as far as I'm willing to go, because I don't want to hurt the visual on tablets. It doesn't have to work on everything, anyway, since I can't even sell this one.

AGP

Calling city.setFixedPointMode(false) for every chunk worked wonders, thank you.