Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kelixaleir · May 03, 2013 at 04:01 PM · playerprefshighscorearcade

Implementing HighScore board

I'm wanting to implement a local Highscore board into my game and I'm not sure which is the best way to do this.

I've read a few posts about using PlayerPrefs to save the data and a few that say that creating a textfile to store the scores in would be better.

Which would be the best way?

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ByteSheep · May 03, 2013 at 04:09 PM 0
Share

Both ways seem valid, using PlayerPrefs does seem like a slightly simpler solution though.
You could for example save an array in your PlayerPrefs of all the highscores by using PlayerPrefsX.
I think reading the scores from a text file would probably require a bit of extra coding (maybe the text file would be a couple bytes smaller though?)

avatar image iwaldrop · May 04, 2013 at 01:37 AM 0
Share

Personally, I'd serialize it in binary so that it's harder to edit by players. That would allow you to create/check a hash against a hash generator to check if it's been modified by the player.

Some useful tips to that end.

avatar image ByteSheep · May 04, 2013 at 01:56 AM 0
Share

Couldn't you just as well encrypt the playerprefs values though?
Plus, it might not even be worth going through the hassle of encrypting the scores since it is only a local leader board.

@iwaldrop, quick question about the hash generation - Would you need to store one hashed and one non-hashed version of each value? And then each time you get the value you would generate a new hash from the non-hashed value and check it against the previously saved hash value?
So the logic would be something like:

if(GenerateNewHash(NonHashedValue) == HashedValue)

Sorry for the extra question.

avatar image iwaldrop · May 04, 2013 at 02:19 AM 0
Share

Well, let me give you a for instance:

Two friends are competing in the same game, showing each other their leader-boards and motivating one another to do better...this actually happened between a group of my friends and Gradius V. Without having the score values protected from user tweaking, one could just go in, change their score to something higher, and win. Her other friends might give up, or play for a long time against an unachievable bar. I think it's comes down to just going that extra step to ensure that your products are 'tight'.

Saving the value in plain-text kind of defeats the purpose of serializing to binary in the first place. If someone actually went through the trouble of finding the scores in the binary file it would be a trivial matter for them to edit the plain text versions too. No, what you do is save the hash. Your code creates the hash and is, for all practical purposes, 'black-box'.

A quick search found John Skeet's answer to be quite good: link.

avatar image ByteSheep · May 04, 2013 at 02:33 AM 0
Share

Thanks for the reply, think I will have to go over it again in the morning.
Not a topic for late in the evening ;)

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

PlayerPrefs save after quit? 2 Answers

PlayerPrefs Highscore problem 1 Answer

PlayerPrefs highscore system? 1 Answer

How do I get my endless runner high score,How do I make high score for an endless runner 1 Answer

How can I save highscores and display them for later? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges