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 / Sprite Problems on Android Player

Author
Message
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 9th Feb 2012 11:48
I have been writing an app for about 2 weeks now, and all of a sudden yesterday I have started to notice that sometimes one or two different sprites don't get drawn, but the sprite that disappears changes between runs and I don't get this issue on the pc. I am using a ZTE BLADE phone which is running gingerbread. Is this a bug in the player? I have spent several hours trying to find a problem in code and I will continue to do this for a time. Any suggestions?

Join us at www.devhat.net and in #lobby at irc.devhat.net
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 10th Feb 2012 13:14
i had a similar problem with a lot of images loaded at the same time. it may be a memory issue ? (i have a the same problem on a galaxy tab ... which have enough mémory i think !)

on iOS Devices i have not this kind of problem ... strange
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Feb 2012 17:50
Quote: "i had a similar problem with a lot of images loaded at the same time"


It could be caused by too many large images in graphics memory causing previously loaded images to get deleted by OpenGL.

It could also be caused if the sprites all have the same depth and something triggers the engine to re-sort the sprites (such as a depth or texture change) which may then result in a different draw order.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 14th Feb 2012 04:29
The problem is that the LoadImage function can be very slow on loading larges images depending on the device model and so it's not possible to Load + Delete the image each time we need it.

Any idea how to optimize that and release a maximum of memory without decrease images size?

As said before i have the problem on a Galaxy Ace (ok it's a "low-end" device....) and on a Galaxy tab 10.1 (THIS is a high-end device .. with Nvidia tegra 2).

Maybe there is a memory management problem somewhere ?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 14th Feb 2012 16:35
If you are using images that are not power of 2 in size (32,64,128,256,512,1024,etc) then they will take up more memory than if they were exactly power of 2. You might also be able to use atlas textures to fit many images on a power of 2 texture to save memory.
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 15th Feb 2012 17:07
I think its due to plenty of large textures and not much memory on my own phone. I've sent the project to Rick so you can get hold of it there if you want to have a look @ Paul.

Join us at www.devhat.net and in #lobby at irc.devhat.net
MarcoBruti
12
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 17th Feb 2012 16:26
Hi,
when developing The Black Hole, I noticed that if I used physics and more than 12 physical objects, for example 12 enemies or 6 joints that join couple of enemies, plus some non-physical sprites, the main character (spaceship), coded as a animated sprite, is rendered as a white box.
Are there memory problems/leakage with the use of Box2D?
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 26th Feb 2012 16:51
We need some commands to check for device free mem.

If there is not enough free mem, then we can put on a warning message and stop the game

Login to post a reply

Server time is: 2024-04-20 13:19:50
Your offset time is: 2024-04-20 13:19:50