Author Topic: How to Instantiate an Object and all Its Children  (Read 5225 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: How to Instantiate an Object and all Its Children
« Reply #15 on: August 26, 2013, 12:49:15 am »
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?).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to Instantiate an Object and all Its Children
« Reply #16 on: August 26, 2013, 08:37:35 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: How to Instantiate an Object and all Its Children
« Reply #17 on: August 27, 2013, 01:32:36 pm »
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:

Code: [Select]
    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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to Instantiate an Object and all Its Children
« Reply #18 on: August 27, 2013, 03:28:26 pm »
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?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: How to Instantiate an Object and all Its Children
« Reply #19 on: August 27, 2013, 09:35:16 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: How to Instantiate an Object and all Its Children
« Reply #20 on: September 13, 2013, 10:11:24 am »
Calling city.setFixedPointMode(false) for every chunk worked wonders, thank you.