Results 1 to 14 of 14
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    73

    Default IOS Resume crash

    Hi All,

    I can't seem to get to the bottom of why my game crashes if I resume the game several minutes after exiting.
    I play the game for a short while, exit using the ipad home button, wait several minutes and resume. The screen shows my game where I left it, but it is unresponsive, then, about 5-10 seconds later, quits without warning. The next time I open the game, it starts from the beginning and shows the startup movie.
    If I resume within a few minutes of exiting, the game continues as normal. This makes me think that there may be an issue with the engine, and its not something wrong with my code. Perhaps to do with ios reallocating resources?
    Is anyone else experiencing this?

    I have only noticed that this happens since I upgraded to the May 2012 version of the udk. I don't really want to ugrade to the July version as I have virtually finished the game and only have a couple of issues to resolve before I can release it.

    Are there any events I can hook onto for exit or resume, or memory being freed by ios?

    Many thanks in advance,

    Peter

    EDIT : I just experimented by exiting, opening several large games and then returning to my game, and it started from the beginning - so it appears that if ios reallocates resources, the game starts from the beginning. So my problem must be caused by something else...
    Last edited by peterfhannon; 08-07-2012 at 08:21 AM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Dec 2011
    Location
    Munich
    Posts
    85

    Default

    There are several states an iOS App can be in.
    When you hit the Home Button, the Applicationdelegate executes its applicationWillResignActive: and - once you're back on the home screen - applicationDidEnterBackground: methods. What UDK calls in these methods is unkown to us because we do not have access to the source code, however generally an app would try to 1. put everything on halt (such as timers, objects etc.) 2. deallocate stuff that can easily be reallocated or that isn't used anymore.

    When a game is in the background and you launch other apps (or memory is being used by other background apps/tasks) it will sooner or later receive a memory warning and call it's applicationDidReceiveMemoryWarning: method, once again we do not know what UDK does in there, generally an app should free up as much memory as it can if it receives a memory warning.

    Now when you multitask back to an App it calls its applicationWillEnterForeground: and once it's done applicationDidBecomeActive: methods, trying to restore an app back to it's original state. However, if this process takes too long (more than 4-5 seconds i think), iOS will think the app is unresponsive (- possibly crashed) and terminate it.
    I think what happens in your case is that the your game received a memory warning, UDK tries to deallocate as much as it can and when you go back to it reallocating simply takes too long. There's nothing you can do that from withing UnrealScript: UnrealScript isn't running in the background so even if there were a "viewWillAppear" equivalent, you couldn't catch it. Try to reduce the amount of actors and other dynamic stuff that the game has to restore.

    To explain the behaviour you're seeing when you launch many other apps: if an app cannot free up enough memory or if there simply is no memory left, the app is terminated and it essentially starts over when you multitask back to it.

  3. #3
    MSgt. Shooter Person
    Join Date
    May 2011
    Location
    Italy
    Posts
    52

    Default

    i have the same issue, i dont really know what to do about this tho..

  4. #4
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    73

    Default

    Thanks for the clear explanation Benfranke. I've narrowed it down to my scaleform menu. I've tried several ways to get it to come back to life but no joy.

    I've decided to set:

    <key>UIApplicationExitsOnSuspend</key>
    <true/>

    In my plist.

    However this has the side effect that if you open the game too quickly (<5 seconds) after exiting, it closes straight away and you have to open it again. This is still a lot better than it freezing for 5 or more seconds if you open the game after it has gone to sleep...

    Cheers,

    Pete

  5. #5
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    41

    Default

    Quote Originally Posted by peterfhannon View Post
    I've narrowed it down to my scaleform menu.
    I remember running into a possibly related issue somewhere around the March release after reading this post. Scaleform would crash after waking the device from sleep mode. But since May UDK it's been working fine (on our iPad 3 at least).

  6. #6
    MSgt. Shooter Person
    Join Date
    Dec 2011
    Location
    Munich
    Posts
    85

    Default

    If you can pin this down to one module of UDK then it might be that
    a) Scaleform takes too long to reallocate resources previously deallocated because your HUD is too complicated
    b) there's a bug in ScaleForm that breaks compatibility with multitasking (in certain conditions/on certain devices/whatever).

    Opting out of multitasking for your app is a good (and maybe the only possible) workaround. Make sure to inform your users of it though - since multitasking is now an expected feature on iOS now your users might go "Hey I'm just gonna check my e-mail for a secoOH GOD WHERE DID MY GAME GO".
    Deallocating an app on iOS is an asyncronous process (that means it runs on a different thread and takes time to complete) so when you're starting the game too quickly after exiting it might interfere with the deallocation process and be terminated right away - that's nothing to worry about though.

  7. #7
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    73

    Default

    Quote Originally Posted by Piotr View Post
    I remember running into a possibly related issue somewhere around the March release after reading this post. Scaleform would crash after waking the device from sleep mode. But since May UDK it's been working fine (on our iPad 3 at least).
    Hi Piotr, I'm using the May UDK and I can confirm this is definitely an issue on the ipad2. Are you using the July UDK by any chance?

  8. #8
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    41

    Default

    Quote Originally Posted by peterfhannon View Post
    Hi Piotr, I'm using the May UDK and I can confirm this is definitely an issue on the ipad2. Are you using the July UDK by any chance?
    Nope. May UDK and iPad 3. We haven't noticed any issues with scaleform and going to sleep, switching to the background etc. Nothing I can reproduce anyway... Don't have iPad 2 at hand to test.

  9. #9
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    73

    Default

    Ok - I have now tested with ipad3 and have the same issue, perhaps there is too much going on in my menu scene and, Like BenFranke says, the udk is unable to restore everything in time.

  10. #10
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    47

    Default

    I've seen this resume crash of and on in our project (Scaleform and iOS) on iPad 2 and 3 with the May UDK. Out of interest, I tried switching between several high-resource iOS Unreal Engine games (Infinity Blade 2 and Batman: Lockdown) and they seem to exhibit the same behaviour (frequently restarting when reloading).

    I am interested what the difference is between Piotr and Peter/my own games that might be causing this. I assume my team's is because the Flash files have not yet been optimized and 'split up' so I have all of my front end in one large file that's loaded into memory, likewise with the in-game UI...

  11. #11
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    41

    Default

    Alright, we managed to reproduce it.

    If I open our game, have a Scaleform scene visible and put the device to sleep, after waking it up the game freezes and quits shortly after. Turns out that it only happens if I cook the game in Release_32 config (the default) AND have my iPad connected to the Internet. Disabling WiFi and restarting the game made it go away, which makes me wonder what UDK is doing online behind our backs... :)

    Anyway, cooking with the Shipping_32 game config (as you should for distribution anyhow) seems to solve the issue for me.

    Tested on May UDK, iPad3.

  12. #12
    MSgt. Shooter Person
    Join Date
    Dec 2011
    Location
    Munich
    Posts
    85

    Default

    Weird and really unexpected, at least on my part. So it's been narrowed down to ScaleForm and an active internet connection?

  13. #13
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Posts
    75

    Default

    Quote Originally Posted by benfranke View Post
    Weird and really unexpected, at least on my part. So it's been narrowed down to ScaleForm and an active internet connection?
    ScaleForm. Apparently it is being worked on; meanwhile using the Shipping game config should fix it.

  14. #14

    Default

    Quote Originally Posted by AAWsome View Post
    ScaleForm. Apparently it is being worked on; meanwhile using the Shipping game config should fix it.
    Spot on! It's a Scaleform issue that we're aware of, but should be ok with Shipping Config.
    -Aaron Jones-
    Epic Games, Inc


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.