alex_h Posted November 5, 2013 Share Posted November 5, 2013 Softgames have pointed out that all of my games fail to complete loading on their iPhone 3GS running iOS 6. I've determined that the game attempts to start loading my png format texture atlas file but never completes doing so. My first thought was that my atlas might be too big for the 3GS to handle, and the info on this link: http://www.williammalone.com/articles/html5-javascript-ios-maximum-image-size/ seemed to confirm these suspicions. But when I split the atlas into smaller chunks that all come in under 3 megapixels the game still apparently crashes. As I don't have an iPhone 3GS and also currently have quite restricted web access this is a pretty difficult one to fix, so I thought I'd post here to see if there is some known issue I am missing. Does anybody know if there is some trick to getting standard png files with alpha channel to load on an iPhone 3GS? Currently I am just creating Image objects for each image file, setting the src, and waiting for the onload to fire; a pretty standard way of doing things I'd have thought. Quote Link to comment Share on other sites More sharing options...
rich Posted November 5, 2013 Share Posted November 5, 2013 It's not just the size of the images, it's also how many you've got. However if you exhaust the memory in Safari it crashes back to the home screen, not freeze, so I suspect something else is going on. My next guess would be the audio. Try disabling it entirely perhaps and see if the game at least starts. Quote Link to comment Share on other sites More sharing options...
alex_h Posted November 6, 2013 Author Share Posted November 6, 2013 It was initially just a single texture atlas, less than 2048 square, with an additional full screen jpeg for the background and another full screen sized 'please rotate' jpeg image. Should be well within acceptable limits I would have thought. When web audio is available the game loads audio files before the images using xhr, and this process appears to complete successfully. It then reports beginning to load the images, appears to succeed with the jpeg background but never completes loading the png. When I switched to use 2 smaller atlas pngs from what I can tell I think it fails when trying to load the first of them.It doesn't try to play any audio until everything has finished loading, and even then it has to wait until a touch event has occurred before initialising the sound engine, so I'm pretty confident that (for once!) audio is not causing the problem. By the sound of it, at least there is not some obvious answer to this that I was not previously aware of! I suppose one possible avenue would be to try loading the images via xhr as well, but I can't really see any logical reason why that should make any difference. Still, sometimes it pays off just to try things though, even if it's not obviously going to fix the issue, could still lead to more insight into the matter! Quote Link to comment Share on other sites More sharing options...
rich Posted November 6, 2013 Share Posted November 6, 2013 I'd still disable the audio, not because it might be crashing on playback but simply because it's consuming memory. You should take this right back to the most simple test case possible maybe? Just a single js file that does nothing but load up your images and draw them to a canvas. Should only be a few lines of code, but will let you know immediately if it's actually the images or something deeper in your game code. Isolate and test. Or hook it up to a Mac and use Remote Debugging in Safari to see what error it's throwing? Quote Link to comment Share on other sites More sharing options...
alex_h Posted November 6, 2013 Author Share Posted November 6, 2013 Yeah, that's probably the best approach, thanks. That's an interesting point about the audio actually, I hadn't considered that it might be using so much memory that there is none left for the images! Quote Link to comment Share on other sites More sharing options...
pspmiracle Posted February 13, 2014 Share Posted February 13, 2014 alex_h, did you find a solution? I have the same problem now - game loads too long on iPhone 3gs. I have one 2048x2048 texture atlas. Also I tried to split this atlas to 3 1024x1024, remove the all audio, but I got same problem. Quote Link to comment Share on other sites More sharing options...
alex_h Posted February 13, 2014 Author Share Posted February 13, 2014 For me the problem was actually not that it was taking too long to load, but that the game was crashing outright during loading as a result of too big texture atlas for the device to handle. The solution I found worked in my case was to generate a duplicate set of assets at half scale (1024 rather than 2048) and use those when running on devices with a 480 x 320 or smaller screen. I'm not sure if this will help for you. If the problem in your case is that your game takes too long to load you need to change the game so that it loads less assets on the the 3GS. One way of achieving this could be to do the same as I did and halve the size of your assets for that platform, but this may or may not be possible depending on what resolution your assets are to start with. Quote Link to comment Share on other sites More sharing options...
pspmiracle Posted February 14, 2014 Share Posted February 14, 2014 Thank you, I made a duplicate set of assets with 0.5 scale. it works now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.