1
\$\begingroup\$

Let's say that I'm developing an iOS RPG where the player gains 1 point per monster kill.

The amount of monsters killed is persistent data: it is an endless adventure, and the score keeps on growing. It isn't a "session score" like Fruit Ninja, but rather a "reputation score".

There are Game Center leaderboards for that score. Keep killing monsters, your score goes up, and the leaderboards are updated.

My problem is that, technically, you can log out and log in using a different Game Center account, kill one monster, and the leaderboards will be updated for the new GC account.

Supposing that this score is a big deal, this could be considered as cheating, because if you have a score of 2000, any of your friends who have never played the game can simply log into your iPhone, play the game, and the system will update the score for their accounts, essentially giving them 2000 points in the leaderboards for doing nothing.

I have considered linking one GC account to a specific save game. It won't update your score unless you're using the linked GC account. But what if the player actually needs to change their GC account? Technically they would be forced to start a new game and link their account to that profile.

How should I prevent this kind of cheat? Essentially, I don't want someone to distribute a high schore to multiple GC accounts, given the fact that the game updates the score constantly since it isn't a "session score".

I do realize that it isn't quite a big deal. But I'm curious about how to avoid this.

\$\endgroup\$
  • \$\begingroup\$ not sure i understand the question surely the save and the score submission needs to be linked to the GC account \$\endgroup\$ – RoughPlace Nov 5 '13 at 9:31
  • \$\begingroup\$ @Yakyb: Imagine a pokemon game. One "save file". There is a leaderboard score called "Pokemon caught", and it updates every time you catch a pokemon. Suppose that you have caught 215 pokemon. Your GC account has 215 score in the leaderboard. Now switch to another GC account and catch another. This new account now has 216 score in the leaderboard. This score is not linked to any specific GC account - it is stored in the save file. \$\endgroup\$ – Oxide Nov 5 '13 at 9:34
1
\$\begingroup\$

Well, any time you need persistent data that usually means you need to write it to a file.

What I would do, is make a dictionary of dictionaries and write that to a file. The main dictionary will hold the keys of each username, and the value fields will hold the high scores in a dictionary. That is, assuming you have more than one high score per user, maybe a top ten high scores. You might also be able to get away with a dictionary of lists.

If you only have one high score per username, you can just use a regular dictionary with the username as the key and the high score as the value.

Since you are developing iOS, you should write to a plist since they are pretty easy to read and write from, but it's ultimately up to you.

Hope this gives a nudge in the right direction.

\$\endgroup\$
  • \$\begingroup\$ There's only one save file, and it already stores your score. However, it occasionally uploads it to the leaderboard because, well, it's a leaderboard. \$\endgroup\$ – Oxide Nov 5 '13 at 5:23
  • \$\begingroup\$ Ok, from reading your comment to Yakyb, you need to do what I said and that is write a dictionary containing the scores. From my understanding, you want each user to have their own high score, so make a dictionary, which is a key-value pair, and write it to a file. Ok so lets say there are two users, UserA and UserB. UserA high score is 100, UserB high score is 200. You can store both of these as a dictionary, so when you access myDictionary[UserA] it will output 100. Likewise when you access myDictionary[UserB] it will output 200. Then, you can write that structure to a file. \$\endgroup\$ – Josh Nov 5 '13 at 16:59
  • \$\begingroup\$ Dude. No. That's not it, I'm positive. I don't have multiple users, I only have one, and the score is already stored in the device. The problem is when I update the GC leaderboards, because you can switch GC accounts, allowing you to fill the GC leaderboards with 10 accounts with the same high score, since GC seems to be designed for session-type scores. \$\endgroup\$ – Oxide Nov 5 '13 at 22:28
  • \$\begingroup\$ Ok, well I guess I am not understanding what you want. Maybe I should have said GC account instead of user. \$\endgroup\$ – Josh Nov 6 '13 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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