Sprite sheet animation costing huge amount of memory (100mb)

45 views
Skip to first unread message

dol...@gmail.com

unread,
Apr 4, 2015, 1:00:46 PM4/4/15
to pl...@googlegroups.com
Hey I am running PlayN in Java, loading a sprite sheet which is 3mb~ in size. I am loading the sprite sheet and caching the sprite map loaded from the asset manager. This works well for 1-2 instances of the object which uses this resource, but more than this and it will lag a lot. Which is expected since each one is taking up 100mb (if I load the same type it won't lag since its being cached).

Anyway wondering if someone would be able to help me identify where the issue is here? Surely a 3mb sprite sheet shouldn't consume 100mb in memory.

Perhaps there is an optimized Image class I can use or something.

Cheers!
Ben
Message has been deleted
Message has been deleted

dol...@gmail.com

unread,
Apr 4, 2015, 1:05:26 PM4/4/15
to pl...@googlegroups.com
If I load the same type (that uses the same image) I can load as many as I want since its sharing the image resource. So its nothing to do with the physics engine or the class I use to wrap the animation. Its just the image resource is taking up way too much memory.

Michael Bayne

unread,
Apr 4, 2015, 1:23:39 PM4/4/15
to pl...@googlegroups.com
On Sat, Apr 4, 2015 at 10:00 AM, <dol...@gmail.com> wrote:
Hey I am running PlayN in Java, loading a sprite sheet which is 3mb~ in size.

How big is the actual sprite sheet image in pixels? Its size on disk does not give a good indication of how much memory it will consume, because images in memory are stored uncompressed (as are textures).

If you have a lot of animation frames, particularly with a lot of blank space around them, you'll need to preprocess the images into minimum bounding rectangle frames, and store the offset of each minimum frame into the "logical" frame.

TriplePlay provides classes that make this easy(ish):


If those don't work out of the box, they should at least show you how to go about it yourself.

dol...@gmail.com

unread,
Apr 5, 2015, 12:36:48 AM4/5/15
to pl...@googlegroups.com
Thanks for the reply Michael, I am somewhat new to game development :) appreciate you taking the time to explain things to me.

I'm experimenting with Mipmapping my sprites since they were extracted from a Mipmapped GIF file. As well as cropping out blank space.

dol...@gmail.com

unread,
Apr 5, 2015, 9:10:07 AM4/5/15
to pl...@googlegroups.com, dol...@gmail.com
So I got the sprite files down to around 1.80mb now but the size of the sprite map is still the same 3070 x 2790 I did squish it as much as I could though, any ideas with what I can do form here?
Reply all
Reply to author
Forward
0 new messages