Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / accumulative 6MB limit on images solo or in sprites??

Author
Message
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Feb 2015 01:23
I am using AppGameKit 2.0.11 with AGK2 player build Jan26, 2015, and I still have an issue with creating sprite animations. I had asked about this earlier and was told there are no constraints except for the amount of available memory. My device has 1GB of RAM and over 20GB storage available.

I can only get 2 animated sprites created. The android device crashes as the 3rd one is loading. I do not get an error (that I can see), AGK2 player merely goes away.

I can present the code, but not the images. And that is where the issue lies when asking for advice. Everyone is going to use images I am not using and thus will say everything works for them. So whomever would like to assist, you could create dumby images. I will give the specs on the images so they are the same size and resolution.

As I load the images I am also determining the size and adding in order to know the total size of the images.

So, the test code shows (while running on the Android device) that around the 50th frame of animation 8 is where it will crash.

Attached is a text file of the image parameters.



home.wavecable.com/~mindsclay

Attachments

Login to view attachments
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Feb 2015 01:25
I did some experimenting and apparently there is actually a limit to the TOTAL number megabytes that can be loaded into sprites.

All the images I used were 240x135 and less than 4KB each.

I started with 1 animated sprite and loaded as many frames as I could until it crashed. The number of frames doesn't matter, it is the total size of all the images. The limit is somewhere around 6MB, but more like 5.954MB.

Then I divided the number of frames into 2 sprites. Same thing occured, at about 6MB it crashes.

Then I divided into 3 sprites, same.

If I keep the total size under 5.9MB I can keep adding more animated sprites. Anything over that and it crashes, even if not right away in a few seconds it will crash.

So it is the TOTAL size of all the images that has a limit. I was told there was no limit except system memory. 6MB is well below the 1GB of RAM my device has.

So, is this an AppGameKit bug? Or is this an Android limitation??

home.wavecable.com/~mindsclay
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Feb 2015 01:29
I am not using an atlas, I am loading images via AddSpriteAnimationFrame().

Even loading images only, no sprites involved, causes the same issue.

I have even performed a factory reset on my device so that the only apps are AGK2 Player, Google Apps and Google Plus.

My device is 1920x1080 HD with a POWERVR SGX544 GPU, 1GB RAM, 32GB storage. This is not a wimpy tablet. Plenty of resources.

home.wavecable.com/~mindsclay
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 23rd Feb 2015 16:19 Edited at: 23rd Feb 2015 16:22
Could part of the problem be that your images aren't powers of 2?

From what I understand, if the height and width of the sprite isn't a power of 2 then AppGameKit adds on transparent pixels to make them power of 2. So in this case the images being loaded would end up being 256 x 256.

The nearest power of 2 dimensions to you images would be 256x128, maybe if you could change your images to these dimensions.

I'm not sure if this explains it but it might be something to try.

Also, I'm guessing the reason you're not using atlas textures is that you have a nice simple loop for loading in all the images.

edit: i've just look at the format file you added, shouldn't the images be png rather than jpg? I believe png have better compatibility across devices. Again this may not be the issue but might be worth trying.

mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Feb 2015 16:54
I do not know why you have to guess when I have included the code.

No. I resized the images to be power of 2 in width and height. That didn't change anything.

png more compatible:
Except .png files are larger than the compressed .jpg.

Originally, I was using .png files and still had the problem. I thought the images were to big so I resized them (smaller) and made them .jpg.

If the .jpg files weren't compatible then why would they work at all??

If you had read my initial posts you would see that the issue is happening after the 2nd animated sprite, which means the first two animated sprites are okay as long as I don't try creating a third.

home.wavecable.com/~mindsclay
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Feb 2015 17:24 Edited at: 23rd Feb 2015 17:25
I think the issue is that the images are taking up too much memory...

Let me explain. I am trying to create a point-and-click puzzle/adventure type of game. It uses still images for the most part, easy enough, but I wanted to have a few short animations as transitions. (like a POV getting out of bed, or door opening)

I am in this situation because using the video functions is not practical for a couple of reasons.
1) only one video can be loaded at a time
2) takes to long to load before playback, thus the need for more than one video loaded at same time

So I thought I would have my transition animations play via animated sprite, thus the huge sprites I have been using (960x540). I thought I would load only the animations needed for a particular scene, but now I am at the point of having 6 animations in one scene. Obviusly I cannot load that many images. The animations can play in any order depending on the action of the player, so they need to be ready for play not wait for them to load.

I thought I would try using memblocks, but there is still the issue of huge memory usage. Maybe I will find a creative way to load the images on the fly within the main loop?

Evidentally, no one else in AGK-land has tried to do what I am doing. I have been asking about this issue since AGK1, especially with the video issues (when the video ends two purple rectangles appear momentarily, and we can have only one loaded at a time), and no one has a clue. I thought maybe there might be prescedent.

home.wavecable.com/~mindsclay
mindsclay
11
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Feb 2015 17:26
The documentation doesn't say you cannot use images that aren't power-of-2 based in dimensions. It merely says that the image will re-size if they are not.

home.wavecable.com/~mindsclay

Login to post a reply

Server time is: 2024-03-29 10:43:13
Your offset time is: 2024-03-29 10:43:13