Balance between performance and memory

As you learned earlier, memory operation takes a lot time. However, developers always have a limited memory. So, it is extremely necessary to have a balance between performance and memory.

Loading or unloading any asset from ROM to RAM takes time, so it is recommended that you do not do such operations for games that depend on FPS. This operation affects FPS significantly.

Suppose a game requires a lot of assets while running one game state and the target device has a limited heap available. In such a case, the developer should group assets. Small assets can be loaded in the game running the state only in required cases.

Sometimes, many developers preload all the assets and use it from cache. This approach makes the gameplay smoother and faster. However, loading assets in a cache that is not required for that particular game state may crash the game if an interrupt occurs. The Android OS is fully authorized to clear memory occupied by inactive or minimized applications. When an interrupt occurs, the game goes to the minimized state. If a new application requires memory and free memory is not available, then the Android OS kills inactive apps and frees the memory for a new application.

So, it is always a good practice to break the set of assets into parts according to game states.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.105.215