The development of the financial system in the game?

0 like 0 dislike
5 views
Hello! If not more difficult, to share knowledge, how to implement the system of money in the game for gamers, the point is, it is necessary that the game remembers how much money you have, and even when you turn off the game, they were saved. I'm not asking for code(not to alarm anyone) even a verbal description of what you need to do helps me a lot. Write C# and the Unity engine. Thanks in advance friends.
by | 5 views

3 Answers

0 like 0 dislike
The system... Oh how loud!
int currentMoney - started the system.
PlayerPrefs.SetInt("Money", currentMoney) - preserved.
Download to find themselves - PlayerPrefs you a guideline.
by
0 like 0 dislike
Shared Preferences. Just google it.
by
0 like 0 dislike
All finances count on the server, otherwise your program will be easy to cheat. To protect themselves from absolutely children's errors, implement financial logic of a single object, ideally even on a third-party engine, for example on the procedures in the database (this is the most logical place) to the atomicity and consistency of the data answered reliable database engine.

If you need to the balance of the user dependent on time out of the game user, or, track time and entry and exit, and each entrance, adjust the balances from time and a different logic or method that returns current balance, make a formula that will calculate each time by your logic, how much must be added to the saved balance constant time, since the creation of the game user. Grubo speaking you will have not one currency but two/a few, but under the hood, when calculating the final balance, you simply add up the available currencies what are virtual - i.e. which have no current balance and it is calculated from time or something, but what is the only number in the database.
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
0 comments
1,126 users