Why do updates kill user data?

Discussion in 'Public Game Developers Forum' started by lazypeon, Mar 11, 2009.

  1. lazypeon

    lazypeon Well-Known Member
    Patreon Bronze

    I noticed a ton of updates kill user data -- is this just an unfortunate side effect of updating that can't be overcome?

    I can understand if the game is updated in such a way that the old data isn't really relevant, or keeping the old data / scores doesn't make sense because the scoring can't be compared to the new version.

    However, I'd try everything I could to preserve my user's data at all costs, which leads me to believe that this loss of data is not the developer's fault.

    Does anyone have any insight? The latest example I've heard of is Zombieville USA, which apparently erases the scores / records after the update.
     
  2. PointOfLight

    PointOfLight Well-Known Member

    Dec 29, 2008
    4,223
    18
    38
    Programmer
    Indiana, USA
    I would say that's game dependent. I've had plenty of games that have survived updates just fine, and in fact can't think of one that's lost data. Of course, as long as my save games are in tact I don't tend to pay too much attention to anything else.
     
  3. InsertWittyName

    InsertWittyName Well-Known Member

    Nov 26, 2008
    202
    1
    0
    If an app loses data after an update, that's entirely the developer's fault.

    There's no data loss expected from the upgrade itself.
     
  4. lithiastudios

    lithiastudios Well-Known Member

    Jan 9, 2009
    101
    0
    0
    As a developer, how would I ensure high scores/user data doesn't get wiped during an update? If I were to create a plist with user data from scratch once the app was run for the first time, would that work? How does the update process work? Will it just overlay files onto the existing app directory? or does it delete the current app's folder first?
     
  5. Diablohead

    Diablohead Well-Known Member

    Jan 19, 2009
    1,553
    1
    0
    Freelancer, PC game developer
    Puzzlequest still carries my data after multiple updates, zombieville usa is one of the only games which has cleared my top score after an update but it has a valid reason, the game is much better and slightly different now.
     
  6. lazypeon

    lazypeon Well-Known Member
    Patreon Bronze

    I had/have the same question too. That's exactly why I thought the updates were causing my data to be lost -- that the save was simply being overwritten.
    Good to hear that's not the case, and that data can be preserved. I've seen the issue so far with Zombieville / Creeps!, and it's made me hesitant to upgrade a few of my other apps.

    If anyone has information about what exactly happens during an update I'd be interested to hear it; in the meantime, I'll do some digging myself.
     
  7. Little White Bear Studios

    Little White Bear Studios Well-Known Member
    Patreon Silver

    Aug 27, 2008
    2,572
    0
    0
    Not entirely true. The first couple months the App Store was open, Apple had a random update bug that wiped all user data when the update happened. You'd see the bug pop up all the time in various app user reviews, and the dev would get the blame, when really, it all happened before the app was ever launched. However, nowadays the bug happens rarely. But it's always a fear in the back of our minds.
     
  8. Little White Bear Studios

    Little White Bear Studios Well-Known Member
    Patreon Silver

    Aug 27, 2008
    2,572
    0
    0
    If everything goes according to plan, Apple overwrites everything except the data in the app's Documents directory. This is generally where devs store local user data. During this whole process, the app is not started, which means the dev has zero control over anything. Once the app is launched the first time, it's up to the dev to read the user data correctly.
     
  9. lazypeon

    lazypeon Well-Known Member
    Patreon Bronze

    Ah perfect -- exactly the type of info I was looking for. Thanks!

     
  10. So if we want the update to continue reading the old data, we'd keep the reference (dictionary name for example) the same, but if we actually want the update to start over, we'd change the reference name so it won't load the old one, right?
     
  11. Little White Bear Studios

    Little White Bear Studios Well-Known Member
    Patreon Silver

    Aug 27, 2008
    2,572
    0
    0
    Seems reasonable, as long as the data you're talking about is kept in the Documents folder. It's easy enough to test. Just load your app, and write out your saved data. Then, load a newer build of your app over the top of the old one, without deleting the old one first. The app will get replaced, but the user data should still be there. What you do with that user data when your app loads is up to you.
     
  12. allenp

    allenp Member

    Mar 8, 2009
    17
    0
    0
    Information Architecture
    Hanover, NH
    I've seen that you can use NSUserDefaults for this - but does anyone know if it will survive an update? It looks like the quickest way to store a lot of information.
     
  13. StandAlone

    StandAlone Member

    Jan 28, 2009
    5
    0
    0
    Chicago

    NSUserDefaults-stored data will survive an app update. Anything in the ~/Documents or ~/Library folders should be fine. Of course, if the user deletes the old version before updating, then they'll lose everything.

    B
     
  14. The upcoming 1.2.0 version of "The Creeps!" (waiting for Apple approval right now) will not lose your scores or unlocked levels no matter what version you upgrade from. I made sure of it this time! :)
     

Share This Page