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.

AppGameKit Classic Chat / application closes while using addanimationframe

Author
Message
fancy music
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: in the alpha demo
Posted: 1st Nov 2015 13:29
ok, so i hit a roadblock while developing on agk2 (tier 1). im trying to load these images as animation frames in the game and everything works fine on the pc but when i export as an apk and load it on mobile the application closes before it even finishes loading.

at first i thought it was the size of the images, im using 2 sprites which contain 23 images as animation frames. both the sprites have about 90kb worth of images so i dont think the size would make that much of a difference. also the dimensions for the images in sprite 1 are 357x608 and sprite 2 538x608 and they are .png format.

i tried seperating the images and creating a simple app to test them but they work fine in this version, so im thinking there has to be something wrong with the amount of images im using because the test app i created only has 24 images but the original app has about 250-270 .png images with a total size of about 6.00 mb.

i there a limit to the number of images agk can load or could it be from something else?

here is the code for the test app, ive also include the entire program in the downloads. im testing this on a cheap lg sunrise (1.2GHz dual-core Cortex-A7, Adreno 302 GPU with 512 MB RAM and 4 GB storage) and another cheap samsung captivate glide (Dual-core, 1000 MHz with 1024 MB RAM and 8 GB storage) (forgive me as i really dont much about computer/phone specs)



assisstance with this issue will be appreciated

Attachments

Login to view attachments
AreCustomize
10
Years of Service
User Offline
Joined: 22nd Dec 2013
Location: Cyberspace
Posted: 1st Nov 2015 21:41
Hi!

I downloaded your project, exported it as an APK with the latest AppGameKit (2.015b) and tested it with my Samsung Galaxy S3 (android 5.1.1 rooted) and LG G Pad (android 5.1.1 rooted).
I came to the conclusion that there's nothing wrong with your project, maybe there's something wrong with your mobile devices instead (amount of RAM that isn't enough to render those images or something else)

Sincerely
AreCustomize
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 2nd Nov 2015 01:53
Android and *nix things do NOT like file names like this "mm_image_1 (0).png".

Files and directories should NOT have spaces or special characters (it can be done, but it can cause problems). Windows is way to forgiving of file and directory names.

Rename your files and try again. File names should only consist of a-z, 0-9, dash, underscore and period.

Also, Android, iOS and *nix operating systems (of which Mac is) are case sensitive for file names and directories. To them the files 'FILE.png' and 'file.png' are two different things. Windows thinks they are the same (and this causes lots of problems, sometimes).
Cheers,
Ancient Lady
fancy music
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: in the alpha demo
Posted: 2nd Nov 2015 18:26 Edited at: 2nd Nov 2015 20:41
ok i went ahead and changed the filenames from "mm_image_1 (0).png" to "mm_image_1-0.png" and i still couldnt get it to work. i think this might have something todo with some other code in my game because it works in the test app but not on the main one even though the code for loading the images are the same.

ill keep checking, maybe there is something im just not seeing.

edit:
i tried renaming the images again this time removing all underscores and dashes and it produced the same result, even tried converting the .png files to .jpg and they didnt even show up, this is one tough bug

edit 2:
so i cut the amount of times i was calling the loadimage and createsprite commands, and the app worked. im really starting to think that the amount of images that are being loaded is somehow affecting the game, is there some kind of cap on the amount of images an app can have?

edit 3:
i created another test app that replicates how much space my actual game has, basically the program has 300 70kb .png images and loads them in the app and there is a counter for how many images are loaded. as i guessed, the app closes midway through on mobile so i figured that there is probably some cap on the amount of images you can load into the program or maybe just a cap on the images you can load using addanimationframe.

ive added the 2nd test app in the downloads if anyone wants to check it out, ive also included the source.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2015 22:07
Sounds like the device is running out of memory. Even though the images are 70kb in PNG form they must be decompressed to be used on the GPU, so they will end up being width*height*4 bytes in memory. Also since the images are 357x608 pixels they will be padded to the next power of two size on most mobile devices, which is 512x1024, so each image will take up about 2mb in memory.
fancy music
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: in the alpha demo
Posted: 8th Nov 2015 19:38 Edited at: 8th Nov 2015 19:40
@paul johnston
Quote: "Sounds like the device is running out of memory"


yea thats it, i went through the images in my main app and in most cases the dimensions would pad up to the next highest power. im definately going to have redo most of my assets because i didnt realize how much memory i was really taking up. in some cases i had images that were 1167x274, so i guess that it pads up to 2048x512 and that eats up memory too fast all these heavy images also kill my loading time too.

Login to post a reply

Server time is: 2024-11-25 15:20:44
Your offset time is: 2024-11-25 15:20:44