Texture/ memory usage ?!

Started by arianaa30, June 16, 2012, 04:32:20 AM

Previous topic - Next topic

arianaa30

Hi there,
I'm getting out of memory from my demo! I'm just using maybe 10 objects (mostly md2, but did not activated the animations), with their textures. I've read the wiki, and some related comments about memory savings. However I know the size of textures is not important, but still wondering! the whole resources are just 2.4 mb! I'm using some common textures; 256x256, or some of them are 512...In a typical game, it is the same way.
Does it matter, for textures where I add them to texture manager? should they be set in the beginning?! and what about the blitting? One of my textures is a sky; so I blit it (a typical 24bit 512 texture).

zammbi

How big is the heap size on the device?
If it's 16 megs 512x512 images would quickly make it run out of memory.
512x512 is about 1 meg in ram I believe.

arianaa30

Hi,
Well, at this point, I'm just using Android's simulator, sdk 2.2 . The heap size is 24.

EgonOlsen

The resources use 2.4mb in COMPRESSED format. After loading them, they are all uncompressed. If your md2 contains keyframes, try to limit the number to the needed minimum. Key frames require quite a lot of memory. And why do you think that texture size is not important? 512*512*4=1mb*2 (for the local copy in VM memory)+mip maps ~ 2.5mb for each 512*512 texture. Try to default the textures to 4bpp or use the new Virtualizer class. The wiki contains almost everything you need to know: http://www.jpct.net/wiki/index.php/Reducing_memory_usage

arianaa30

ummm, so you mean even if I do not animate the .md2 files, the feyframes will use memory, right?
I've activated the tricks about 4bpp and others in the wiki. I've converted the 512x512 files to 256, and the 32bits to 8 bits. hopefully it worked somehow, but I still had to remove some objects. They are necessary to add.
Thanks for your helps.

EgonOlsen

Quote from: arianaa30 on June 18, 2012, 09:36:41 PM
ummm, so you mean even if I do not animate the .md2 files, the feyframes will use memory, right?
Yes, of course they do. Key frames are pretty expensive memory wise. That's why the desktop version has the option to remove animation sequences from a loaded md2 animation. The idea is to load the md2 with the desktop version, remove all the sequences that you don't want and serialize the result to load it back into jPCT-AE.

What's the polygon count of your animated objects?

arianaa30

#6
I see. Removing them seems to be a bit hard!
Well, I'm using a .md2 model viewer, and it says it has 16 frames and 554 triangles.
One of them which after removing, things got better, had 198 keyframes!! however the size was just 250kB.

EgonOlsen

It not hard actually. You can do it in jPCT-AE itself, if you don't want to bother with the desktop version and serialized objects. However, it's only possible if your file contains sequences that you don't use. The "normal" md2 from Quake2 usually defines a lot the sequences for walking, running, taunting, shooting, dying...and you might not need of them in your game. Then you can savely remove the ones that you don't need. If that doesn't apply to you, then the only way is to reduce the number of keyframes itself...if possible.

arianaa30

That sounds good.
Thanks a lot for your helps guys.
Egon, I'm developing my game on top of your demo for jPCT-AE (the one with grass, rock and two trees). Aren't you planning to create a visual plugin for your game engine in eclipse to help to at least place the 3D objects in the world? (like what Jigloo does). It could be nice since each time translating an object, and then watching the output is bothersome :)