Is it too much memory?

magic

Active member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
Messages
226
Hi,
I wonder; is it too much memory for this:

I load at least 54 images to be rendered. Each is 1024 x 1024 pixels size. I wonder is it too much memory for today modern device.
Can someone show calculation how much memory needed for that amount of images to be loaded into memory. tnks
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,124
One 1024x1024 in the common RGBA format will be 1024x1024x4 bytes = 4096KB, exactly 4MB.
54 of them will be 216MB of course. I would say you have to try it out on the devices you mean to target to be sure about performance.

Older mobiles would be the weakest link here. They are not as fuzzy about the numbers nor total usage of memory but they might become slow if textures are above their favorite size. You never know a devices favourite size. I can tell you that an 2012 Samsung Note2 has a favorite texture size of 64x64. A texture size of 256x256 would make it crawl. Things changed greatly since then of course on the market.

On new hardware I don't think it matters. But I would not just ignore it on mobiles. I would test the ones i was targeting.
If you won't get the performance you want, divide it down, and don't be afriad of the increased number of textures. But respect size.
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,298
It might be needed to load them during OnUpdate on Mobile devices as they might crash if OnCreate takes to long
 

EdzUp

Member
Joined
Jun 21, 2017
Messages
38
I would only load media when its required, dont have images loaded when you dont need them as this will make your app sluggish and memory hungry. Free up images that aren't required will make it more lean and work better on older devices.
 

magic

Active member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
Messages
226
54 of them will be 216MB
in that case device that have 1.0G RAM still can run it.
...but probably not due to sharing ram with OS and other apps:(
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,124
Ya the loading aspect of things.. Mojo1 has a great async feature so you don't have to do any tricks with flags to load textures dynamically through the game. Mojo2 did not inherent this feature but someone added a mojo2 async module. I got it somewhere but I never got it to actually work?

Android startuptime is allowed to take a certain amount of seconds so look from a userperspective. I mean I can see minor delay to my game when I add a soundtrack to it (the soundtrack is 4-5MB).

If you cannot get async load to work you can do what I do ; use flags and load bit by bit inside the game where it can load without being noticed. Try to be clever about it how you portion everything up.
 
Last edited:

magic

Active member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
Messages
226
Loding is fine. I use flag and load it one at a time on every update circle.

About the speed: I m quite surprised to see our html5 is really good. i set the framerate at 40fps to render those images at once on top of each other.
For html5, I got around 37fps while android only 26fps. That makes me wonder; what if I create a hybrid app on android instead of nativeo_O

This thing happen probably because the PC is fast and got a lot ram and i run html on pc. I need to testrun those html on android soon
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,124
Nice! I noticed actually that even cheaper devices will give you an amazing performance in HTML5 nowadays.
I guess the hw-support that existin most browsers like Safari Chrome and Edge today will give you close to native speed, at least they do on my devices. Except Firefox on Linux which sucks for me though but that is proably bc I don't have time to set things up correctly.

On Android for instance I use Chrome and I get 60 fps. If I compile Android natively in Cerberus it will run at 120hz because the screen allows it. In the browser you get the said 60 fps, enough to make democoding happen on your phone.

But if you use touch and compile to HTML5 watch out because Win10/11 tablets use only the newer W3C JavaScript Pointevents standard for touch and Cerberus does not.
 
Top Bottom