Skip to content Skip to sidebar Skip to footer

How To Use Lots Of Bitmaps In A Game Without Exceeding Vm Memory Budget?

In my game i have 12 different animations and each animation consist of 10 bitmaps and each bitmap is 200x150 pixel. Every time user touches to the screen(virtual gamepad) one of t

Solution 1:

That's 14MB of memory for your animations which might be a lot for the VM heap it should fit nicely into the graphics card memory. I am assuming that you are using OpenGL (if not you will almost have to). In which case you can build your frames one-by-one, bind them to a texture and release them from the VM's memtory. This will be fairly fast but I wouldn't do it often or offer some sort of loading feature if the lag is greater than 1/2 second or so.

Solution 2:

I would consider using a SpriteSheet for this. SpriteSheet would contain all the frames of the animation on one bitmap, and you can then programatically load the correct frame coordinates to create your animation.

Post a Comment for "How To Use Lots Of Bitmaps In A Game Without Exceeding Vm Memory Budget?"