Hey guys, I'm building a small platformer and thought of adding a small in app economy, as it fits the topic of the game quite well. In the future I might add an option to buy stuff with real cash, but that's only in the future. I'm however struggling with the idea of implementing ingame currencies from a technical perspective. I'm a little afraid of simply adding the players balances into a local database, as it's easily lost. Furthermore also syncing it into my cloud servers seems quite risky. Potentially a lot of transactions might happen and obviously also quite a huge security risk. How are you implementing ingame currencies, if you do? Thanks for your tips!
How to implement ingame currencies
TheMusician985 said:
syncing it into my cloud servers seems quite risky.
Yeah, it would be better to use a server service from a major company that handles security for you.
-- Tom Sloper -- sloperama.com
I see, thank you very much. And there I simply use a database service and have one row per user which reflects his balances?
You'd have a somehow designed API you could query the provider saved data for every user I guess. Keep in Mind that handling inGame currency also comes with risk at different countries, you'd have to for example make sure to prevent money laundering
@TheMusician985 The main set of services that support some form of gaming back-end directly are systems like Steam, Epic Online Services, and the Google and Apple app store APIs.
If you need fancier systems than what these services can provide, you will need your own service infrastructure, which you can build on something integrated like Firebase, or something separate like Lambda or Cloud Functions, or on top of whatever web service framework you want (Laravel or Django or ASP.NET or whatever,) which you'd then host either on cloud servers, or in cloud container or kubernetes services.
Note that, even if you build your own services, you will typically use some kind of store integration to handle “purchase through the app store” or “take credit cards.” Each of the back-end services has their own API, and their own examples for how to do it – you'd do best to pick one, and follow the examples and advice that go with that service.
When real money is involved, the data handling of currency is a big issue but ultimately a relatively small one.
You will need to address all of the OTHER issues in the game that affect it. Data dupe bugs, game balance bugs and flaws, source and sink balance, in addition to constant re-evaluation of the economy in the game from day to day.
Players and attackers will find all kinds of exploits in all games. When money is involved they will hunt even harder
Get the game working well with your simple data first. Unless this is a commercial game with the funding and staff to get the other issues fixed, you will want to limit the mixing of real world money in game. Consider limiting yourself to IAP entitlements if you must have purchases, knowing they come with support costs and hacking exploits galore yet are still easier than real world money issues.
TheMusician985 said:
I see, thank you very much. And there I simply use a database service and have one row per user which reflects his balances?
Strictly technically speaking - you can set up a simple SQL server to store the data, and create endpoints (service) to handle transactions (there are transactions between entities, and 2 special types → money printing (generation) and money sinking (most likely taxes)). One of the thing is - this needs to be absolutely watertight, bugless and secure.
Many problems start when real money is involved (many of those also originate from legislation) - you will most likely allow only buying in-game currency, not selling it at all (and it's likely you will have to actively search for, punish and even report such behavior). Selling in game currency for real money would require you to fulfill numerous regulations and require most of your customer to provide legally required information for such transactions. Additionally in such case you will need to undergo legal audits.
My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com