android - High Assets Loading Time -


i published game on play store , of friends complain me huge loading time more 1 min (more 1000 frames) in lollipop device (nexus 4 ,os 5.0).usually take 5-10 (180 frames approx) seconds load assets devices single-core 1.0 ghz processor.

i loading assets using asset manager class.

the problem loading mp3 sound files.there 52 sounds,2 music files.

thanks in advance

i've never used assetsmanager, can reccomend various other techniques out:

assets stored in android project's assets directory , packaged apk automatically when deploy application. no other application can access these files.

files can stored on internal storage, readable , writable. each installed application has dedicated internal storage directory. directory again accessible application. 1 can think of storage private working area application.

normal practice me create different handlers, such soundhandler, spritehandler, animationhandler etc. can seperate calls out evenly , load need each class. might adding splash screen (if don't have 1 already) highly useful load on runtime assets loading. provide 'illusion' assets loading screen layering.

example:

    public void create () {             batcher = new spritebatch();             settingshandler.load();             assetshandler.load();             soundhandler.load();             setscreen(new mainmenuscreen(this));     } 

i reccomend using texture atlases created texture packer gui. you're able load images .txt files rather image file. give 'atlas' on spritesheet reading in strings preferable.

example atlas file:

gui.png format: rgba8888 filter: nearest, nearest repeat: none drone1   rotate: false   xy: 274, 2   size: 176, 66   orig: 176, 66   offset: 0, 0   index: -1 drone2   rotate: false   xy: 2, 91   size: 150, 66   orig: 150, 66   offset: 0, 0   index: -1 

example implementation of texture atlases:

    int droneindex = 1;     textureregion[] drones = new textureregion[1];     (int = 0; < drones.length; i++)      {         drones[i] = gui.findregion(("drone" + droneindex));     }     dronefly = new animationhandler(0.2f, drones); 

i reccomend following libgdx's advice. , manipulate files in realtime when being loaded sd or assets folder , allocate memory use accordingly. thats not can do.

what reccomended? how decrease loading time of assets in libgdx offers great answer. creating form of splash screen main gui, make assets loaded doing rendering screen on assets loading @ runtime. emphasize on example given above full code example.

i reccomend looking coding principle "dry" (don't repeat yourself). great principle if wish suffecient write in regards classification of objects. loading time isn't can assets. it's code. further reading here, here , here


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -