Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

My game has a collection of cards (about 64) that are unlocked (one by one) provided that 4 items are collected/gained in the game.

Right now the deck of cards is modeled with a plist file, like this:

<plist>
     <dict>
    <key>card1</key>
  <dict>
    <key>available</key>
    <true/>
    <key>series</key>
    <integer>1</integer>
    <key>model</key>
    <integer>1</integer>
    <key>color</key>
    <integer>1</integer>
</dict>
<key>card2</key>
<dict>
    <key>available</key>
    <false/>
    <key>series</key>
    <integer>1</integer>
    <key>model</key>
    <integer>1</integer>
    <key>color</key>
    <integer>2</integer>
</dict>

The value for the key named "available" marks if the item is locked or not. Right now I have to include the data for the items collected by the user, but including that inside the plist looks like too much hassle.

What kind of structure should be more suitable for this? How do you manage a collection of unlockable items like this?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I assume there's gonna be some kind of "save game" mechanic in your game. In this case, the simplest solution is to include in the player's saved game file a list of the cards the player already unlocked. Unfortunately I'm not familiar with the plist data structure, so I'll just provide an example in xml:

<UnlockedCards> 
   <CardId>1</CardId>
   <CardId>5</CardId>
   <CardId>9</CardId>
   <CardId>23</CardId>
</UnlockedCards>

The reason I'm using CardId's instead of CardName's, is that your card names might change with localization, or patches (typo fixes etc.). If you associate an Id with each card, then you won't have to worry about those changes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.