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 / Tier1: Detect iPad version

Author
Message
Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 4th Apr 2012 10:54
My new game craches on my iPad 1 but not on my new iPad.
Is there a way to detect device version in Tier1?

My game craches when I use explosions.agc (from the forum)



In my loop I use this:



It works okay on the iPad simulator

iOS Apps from Trisect Development.
Click here.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Apr 2012 19:19
That looks like my code... not sure why it would crash your iPad.

Try taking the "init_explosions:" code out of the sub-routine and put it near the start of your main.agc before the loop.

Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 4th Apr 2012 21:08
I cant do that. (it does not work)

I show 25 explosions random on my Winner screen.
When I leave the Winner screen I delete all 25 explosions.

The funny part is that it works fine on my new iPad but not on my iPad 1.

Can I detect which iPad my game is running on?

iOS Apps from Trisect Development.
Click here.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Apr 2012 22:47
I don't know how to detect which version of the iPad you are running on but try just removing this part to the start of your code:


Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 13:47
If I remove those lines I get a lot of error.

I tried to remove some Apps from my iPad to see if it was a memory problem. But it still craches id I use those explosions.

iOS Apps from Trisect Development.
Click here.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Apr 2012 13:52
Maybe I should have used the word "move" rather than "remove"...

"just moving this part to the start of your code"

Basically there can be problems if you dim an array for the first time within a sub-routine. If you define types and arrays at the start of your main file these errors can be avoided. This might not be your problem but if it is then this will solve it.

Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 14:06 Edited at: 5th Apr 2012 14:13
I think this code is was is causing the crash.



I tried to change it tho this:



But it still crashes

iOS Apps from Trisect Development.
Click here.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Apr 2012 14:18
Are the image names correct? Are they the lower case as shown here?

Are you using the same image numbers elsewhere in your code?

Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 14:22 Edited at: 5th Apr 2012 14:49
I use variables for image elsewhere in my code.
The image filename should be correct.

I change the code to this



And this



But it still crash!

While it works fine on my new iPad.

Maybe I should announce it as a HD App!!

iOS Apps from Trisect Development.
Click here.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Apr 2012 15:35
Looks like you need to narrow it down further. How about putting this in to see which images it is loading and which it isn't:


Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 17:32
I found out that its not a code problem, but something to do with the images. I made a new image "exp36.png" and it worked okay.

iOS Apps from Trisect Development.
Click here.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Apr 2012 18:23
Unfortunately LoadImage() is one of the functions which needs more documentation. What is the result if the image could not be loaded? It's really important to check the result for all function calls which may fail for some reason, but obviously it's a bit hard if you don't know what the fail result is!

-- Jim
Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 18:35
I tried to make a new image "explosion01.png" and took the graphics from exp01.png and inserted it into the new image.

I still get a crash!

If I draw something my self its okay, If I copy the graphics from your images it crashes.

Keep track of your milage and deductions
[http://www.ipad-apps.dk/?p=231]Get Driver Logbook[/href]
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Apr 2012 18:40
Can you post the image that worked and the image that didn't?

Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 18:48
Here they are

explosion01.png is a copy of yours.
exp36.png is the one I draw. ( I know it does not look like a explosion)




Keep track of your milage and deductions
Get Driver Logbook
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Apr 2012 18:53
I like yours better

I can't see any major difference. Does the code I posted originally work on the iPad?

I noticed it is called explosion01.png and your code is looking for exp01.png, is that just because you renamed it in your app?

Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 18:57
No your orginal code does not work on my iPad but it does on my new iPad (iPad 3)

I tried to load just one image called explosion01.png and it crashed.

I tried to load just one image with my own exp01.png and it worked.

Keep track of your milage and deductions
Get Driver Logbook
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Apr 2012 19:11
Is there a difference in the image format of the old and new images? Such as indexed colors instead of 32bit?
Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 19:16 Edited at: 5th Apr 2012 20:04
I dont know. baxslash could maybe answer that.

Okay I checked and I think they are RGB/8

I tried saving one as jpg but it crashed.

Keep track of your milage and deductions
Get Driver Logbook
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Apr 2012 22:07
Looking at the code I can see you are loading 35 images, if they are all 768x640 then this could cause a problem. Since iOS requires power of 2 images (or did, I've not tested it on the newer models) the images will be expanded to 1024x1024, at 32bit color thats 4MB per image, times by 35 gives 140MB of image data. Recent tests with a crashing iPad 1 app showed that the iPad will close the app if it reaches about 112MB of RAM usage.

Although that still wouldn't explain why it crashes loading a single image.
Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 22:31
Oh but i does explain, cause I load just one image but make 35 sprites so it should be explained.

I will try and change my images to the power of 2.

Keep track of your milage and deductions
Get Driver Logbook
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Apr 2012 22:47
Loading 1 image and using it in 35 sprites should be fine as they all share the same image and therefore the same memory
Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 5th Apr 2012 22:50
And 512x512 did the trick.

Keep track of your milage and deductions
Get Driver Logbook
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 6th Apr 2012 17:41
If I load a 510x120 image will it be expanded to 512x128 or 512x512?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Apr 2012 02:22
512x128
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 7th Apr 2012 11:40
great, thanks a lot paul, i need to go through all my images as i have some set to 514x120 so i will try to make them 512x120
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 7th Apr 2012 17:28
Make them 512x128

The difference is negligible and AppGameKit wont have to do any work at all at runtime then.

Login to post a reply

Server time is: 2024-05-09 02:19:36
Your offset time is: 2024-05-09 02:19:36