How to effectively reduce "texture Memory" ?

EX: Split a 1920*1080 into 120*120 and a total of 144 blocks. For each piece of continuous animation in the same position, use the Texture Packer to pack it individually, so one screen is represented by 144 animations.

Dynamic image:Before I talked to other people in the forum, because my game uses a lot of animation effects, the hard disk space needs more than 1GB, so I don’t prepare a second image with lower pixels, and focus on better phone.

Because people focus on high-quality images, I don’t provide lower quality images and save hard drive space.

I am working on a 2.5D RPG multiplayer online game, and the server has other functions written almost.

It is estimated that there is now 800MB, which is quite normal for an online game (in our Play Store in Taiwan, downloaded games, you have to download other data after entering, and almost all games are >1GB)

This problem is caused by the 1920*1080 full-page animation, which makes the memory increase several times in a moment…

That sounds familiar. I’m guessing that I was actually one of the people who recommended you to ignore the low end devices back then. It’s just impossible to keep up with what advice you give and to whom on the forums. :stuck_out_tongue:

800MB for a mobile game is far from the standard size and with large games, you have to realise that you are not just competing for users’ disposable income, but also their devices’ hard drive capacity. If installing your app means that a user has to uninstall something else first, it immediately becomes a lot harder to get the user to download your game.

In your case, I’d try to reduce the texture memory usage by:

  1. optimising the animations themselves , e.g. if you have a walk or an attack cycle animation, could you perhaps do it with fewer frames?

  2. optimising the image sheets , your current image sheet size of 1920x1080 gives you space for 16 x 9 (=144) frames per sheet at the cost of 16MB of texture memory, but by changing the size to 2048x1024, you’d get 17 x 8 (=136) frames per sheet for only 8MB of texture memory used, i.e. get 8 frames less per sheet, but use half the texture memory.

  3. lazy loading only the required assets , based on how high your texture memory usage is, it sounds to me like you might be loading all image sheets regardless of whether they are needed. You can reduce the texture memory usage by only loading the assets that you require in a particular scene or for a particular event. Likewise, after you no longer need them, you can get rid of them.

Yes, you are right, but in my country, many people use the 64GB mobile phone as a basic device, even 128GB is a “real” mobile phone.

In the game forum, most players will go to see the size of the game. The bigger the game, the more rich the game, the more content and the more popular. :smiley:

Regarding the 1 point, I have done it, I changed the 25 frames to 16 frames of animation.

And the 2 point, I don’t know how this can reduce so much memory, thank you very much.

Finally, at the third point, I did want to do that, but I only tried it, because it took too much time to load each new game, but now I can only do it according to the original plan… :frowning:

The texture memory works like I explained previously.

With your 1920x1080 images, the width and height must follow the power of two sizes, e.g. 512, 1024, 2048, 4096, etc. The images will always take the next largest available. For 1920, the next one that it fits in is 2048, so there are no improvements to be made here. However, 1080 also only fits in 2048. If it were just a little bit smaller, it would fit in the 1024.

1920x1080:
2048 x 2048 x 4 / 1024 / 1024 = 16

2048x1024:
2048 x 1024 x 4 / 1024 / 1024 = 8

But still, for you to hit 1024MB texture memory usage with images that size, you’d have to simultaneously have around 60 such sheets loaded and even then you’d have plenty extra left for all other images. While I don’t encourage premature optimisation, it sounds to me like your project won’t live without some. :stuck_out_tongue:

It seems that I didn’t notice it before, but except for this full-page animation, everything else is done using Texture packer.

Just look at it, it has automatically set the texture to what you said.

This time mainly because of the full-page blood splash animation in battle.

But just after I trim it (to remove the too similar image), it will only use the original 1/10.

In general, the battle can be maintained at 600MB, but I haven’t tested how much more people will increase in multiplayer games…

The remaining super-exquisite character animations will be placed in the lobby to interact with the player (after all, there aren’t too many settings in the lobby, which can be placed in high-frame animations).

My biggest concern is that it takes 2~3 seconds to load every time the game scene change.

I don’t know if the player will be impatient.

This is the most troublesome. :frowning:

you can make a wait effect so people will not complain…in fact they will enjoy the wait :wink:

Yes, I now let it have Cutscenes, but I use the Composer syntax when testing. If I call 1000 Time, it seems that will start making animations of my new scene after 1000.

Because when I used 1000, it let me see the scene at 6000Time, when I used 10000 it appeared in 15000Time. :mellow:

I want to know how your wait effect are using “Composer” or some other way?

You’ll need to somehow stagger the loading of your scene so that you can display other things while it loads.

Say your scene loads 100 items, instead of doing this all in one block in scene:create() which means the UI becomes unresponsive and the Composer transition freezes, do one per frame or whatever number gives you a balance between loading speed and responsiveness.

OK, so I will use composer.loadScene() to load the desired scene and hide it, but it will execute Create().

I remember that Create will only be done once. (If you first go to the 1-1 level and then exit to enter 1-3, once again exit and return to 1-1, it will not execute Create)

But I didn’t see this in the documentation. Can someone explain this?

By default scenes get ‘loaded’ once and then just hidden when you go to another. However if you’ve got memory-intensive scenes, it may make sense to manually delete scenes as you go. You can do this by calling the below code in the ‘did’ phase of every scene:show().

[lua]

local previous = composer.getSceneName(“previous”)

if previous ~= “main” and previous then

      composer.removeScene(previous, false)

end

[/lua]

That’s great, I will try it.