How do I optimize memory usage in a myths and legends app with 500 images?

0 favourites
  • 6 posts
From the Asset Store
500 monsters and creatures images for card games - Set 1
  • I am making an android app about myths and legends which contains many images, among all the stories are 500 images in total. So I would like to know how I can do to optimize the app, minimize memory usage and generally go smoothly.

    I will try to describe the app:

    - At startup you can select between myths or legends (25 stories per category).

    - Each myth or legend has 10 images (3mb in total).

    - Once you have read the story you can read it again or choose another one.

    I have checked the project stats and the peak memory usage is 104 mb

    That said, I have encountered these problems:

    - When starting the app, after the percentage loader it takes quite a while to display the first screen (layout).

    - On low end devices, the app does not start or gets stuck to the point of closing.

    I've been reading about unload from memory but I don't really understand how it could help me and how I can implement it.

    I hope you can help me. Thank you very much in advance

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi.

    All the sprites that are on your layout and all the animation frames in these sprites are loaded into video memory when the layout starts, so.

    Make sure you don't have all the images in one sprite in different frames or animations, create a separate sprite for each large image and keep only those sprites on the sheet that are needed for the history.

    I met an article about how Construct uses memory, it is still relevant, but I lost the link.

  • At startup you can select between myths or legends (25 stories per category).

    Run this layout in Debug Mode in preview and check memory usage for it. I don't trust the estimate C3 gives.

  • Hello, thanks for answering dop2000 igortyhon

    I did what you told me and these were the results.

    In the main menu it is 16.9 Mb

    In the secondary menus of both myths and legends, it was 103.6 Mb

    As for the stories, the lowest one gave 108 Mb and the highest one 123.4 Mb

    When a PopUp is opened it can increase up to 150.7 Mb

    The latter is the highest value in the results.

    One fact that I forgot to mention is that the myths and legends go inside a sprite called a container with the 10 images (9 frames) of each story, this container has measurements of 1400x788

    I hope that this data is useful to help me optimize the app.

  • One fact that I forgot to mention is that the myths and legends go inside a sprite called a container with the 10 images (9 frames) of each story, this container has measurements of 1400x788

    So how many frames in total are in this sprite? 10 or 250? 250 frames of that resolution will use a lot of memory, you can put it on a blank layout and check in debug view.

    But if that's not the case, 150MB should not be causing any issues even on low-specs devices.. You can try getting Logcat logs from the phone, maybe you'll see the error message there.

  • One fact that I forgot to mention is that the myths and legends go inside a sprite called a container with the 10 images (9 frames) of each story, this container has measurements of 1400x788

    I have written to you above about this. If you need to optimize, split this heavy sprite into different sprites and place only the necessary ones on the sheet.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)