Best way to save and load data for a clicker game

Hello guys, i’ve been creating a clicker and i need to store data like coins, upgrades, best scores etc.

What is the best way to save and load data for this type of game?

Thanks.

Hi astrocoder,

It depend about your game.
Let me explain :

100% local game :

  • Create a local file
  • Create a key (to encrypt your data)
  • Save data into the file (encrypt it before)
  • Read the file (and uncrypt file with the key)

Non local game (beginner):

  • Create a website (php, ruby, c# …)
  • Create CRUD (create, read, update, delete) methods on your server
  • Request page depending on what you want

I think Unity have something to request WWW page. But remember never trust the client, ALWAYS check client’s data.

WebService (Advance) :

  • Create a webservice server (ruby, php, c# …)
  • Create CRUD (create, read, update, delete) methods on your server
  • Make a communciation between client and server (Xml for example)
  • Request server from your client

I’m sorry if I don’t really explain how work the non-local game solution but first of all I have to know what his your case. Explain WebService or basic webcommunication is not really easy. In fact, you have to secure, synchronized et check data everytime you request the server.

I’m really sorry for my english but if you don’t understand tell me I will try to explain with other words :slight_smile:

Have a nice day,
Smile

1 Like

Its a 100% local game, but the what is the best method (OOP way) player prefs

Yeah you can read and write into a file with oop.
See : http://www.obviex.com/samples/encryption.aspx for encrypt, decrypt string and read / write into a file.

Just create a script that not inherite from MonoBehaviour. Call it like you always do in oop.

If you don’t understand reply to my post I will help you.