Which is better for loading game assets? - libgdx

I am wondering which is better for my game either to load all the assets only once on a game splash screen for example or loading and disposing the assets of each screen separately ?

Answer of your question is totally opinion based.
Load all the assets only once and dispose when you exit your game.
Load and dispose assets of each screen, depending upon used/unused resource.
In my opinion you should choose these option depending upon size of game in terms of resources.
If your game using few resources you should load all resources for all screen at starting with the help of SplashScreen and dispose when you exit your game.
If your game have lots of resources like consider, your game is combination of three-match game and farming game. Both game type required lots or resources so you must unload unused resources of previous screen and load resource for new screen.

Related

Issue while Resuming Game Libgdx

I am developing a 2d game using LibGdx framework , when i press HOME button and then resume the game it freezes for 3-4 secs as the textures are being reloaded . I have used AssetManager to load the TextureAtlas & then getting the images by findRegion . I referred to documentation for "Texture" (http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Texture.html) and it mentions that " If the OpenGL context is lost all managed textures get invalidated. This happens when a user switches to another application or receives an incoming call. Managed textures get reloaded automatically.". I am confused what to avoid this delay !!
Kindly Help
Thanks
There will always be a delay on resuming the game.
This is because on android if you press home button or switch to another app a so called context loss occures.
When a context loss occurs on Android, it means that the operating system has decided to forcefully free the memory that was occupied with your loaded assets.
When you switch back to the game you need to reload these assets again to prevent the game from crashing and this reloading is reason for the delay.

as3 - using resources - better to preload sounds or load them on the fly

I have a loop that will be loading a new sound every minute. My questions is... I am wondering if it is better to load all 50 at once and play them when needed every minitue or is it better to load the sounds right before I play them?
What is the best way to save resources?
This is for a cell phone app so I need to use all resources very carefully.
It's a good practice to use resources on demand (load sounds when user needs them), especially in resource restricted environments like mobile devices. Every sound object will consume memory. So answer will be: load sound on demand, after playback, unload it by setting reference on sound object to null, load and play another one. If you loading them, from the network, You should load several sounds, for example current and next one, because for mobile devices, network process will turn on radio, and switching radio is battery consuming process.
Network sound loading: load several on demand (for example current and next one)
Filesystem loading: load only current on demand.

Swarm Dashboard slow to resume game

Has anyone experienced a very slow resume when closing the dashboard of swarm? There is about a 5 second delay in my application where a black screen is displayed after the dashboard is closed and before the actually game screen is rendered. I had originally thought that maybe my show() method for the current was doing too much and causing the lag, but after looking a bit closer I see that the show() method is actually never even called when switching from the swarm dashboard back to the game, I suppose this is due to the fact that Swarm is not operating in a libgdx context but an android one.
Any help appreciated.
That's OpenGl context Loss. your assets need to be reloaded. If you have a lot of assets, you should separate them and load them when needed. That will help your game to feel much faster, especially when starting and when coming back from swarm dashboard.

Adobe Air - Improve startup time

I'm building an Adobe Air 2.5. desktop application with Flash CS 5. The apps filesize is 10 MB with a medium amount of movieclips, vector graphics, bitmaps and code in it. It takes around 8 seconds from clicking the desktop icon until the app is available to work with.
How to improve the startup time?
Thanks. Uli
I think that you can decrease load time by placing on stage strictly what you need to show when the app starts.You can draw the rest of the assets upon request, dynamically.
So don't just drag everything on-stage.Instead, instantiate and addChild() as needed.
Depending on the asset size, it might take a little time to load, but cetainly the user won't have to wait 10 seconds before he/she can use your app.
Maybe not all of your app's content will be viewed in every single session, so why put everything on stage from the beggining?

How to optimize the import of swfs in the preloader

I work on a big Flash project as the web backend guy that delivers all the files and assets to the main application SWF. Our last, really big packet of data are all the assets and sounds contained in swf files that are imported during the preloader.
Are there any ways to optimize this process in any way?
I'm really looking for ideas in any direction, no matter if its in the swf, the process of loading and so on. Also I look for solutions for the first time load (empty cache) and for consequent loads (prefilled cache).
A few tips for file optimization:
Choose the correct type of image extension, sometimes gif or png delivers better results then jpg's. Ask your designer to deliver tileable, scalable graphics whereever possible. Take advantage of vector graphics.
Use the sound optimization in Flash, so import wave files and try mp3 compression with lower bit rates.
Load sound effects/bg loops related with user interaction prior. Videos can wait. People are used to wait for videos.
For preloader optimization, obviously each HTTP request is extra load on the server. So reduce the number of swf's to be loaded, maybe by logically grouping them. Preloading the crucial stuff first, then background preloading lower priority swf's is always good for convenient user experience.