Data storage location and best cheap/free solution

Hi,

I’m currently working on mobile game that has some features I would like to store.

  1. each player has some boost up, number of lives, some energy points, level number… this piece of data should be stored.
  2. I have some teams (of players) where in the game, we should be able to see player’s points inside the team, but also each player should be able to see leaders board with all players of all teams and their relative rank position.

Data should be synced, so every player has accurate data about his leader board rank

Each data should be loaded at the game start, but some data evolving during game should be updated.

I was thinking to store:

- in local sqlite DB data relative to player

- data relative to teams, but also to each player should be stored on some cloud/remote DB

A) I would like to know if there is a particular pattern/best practices for such need that I could follow and adapt to my need ?

B) I know about services from PlayFab, Nakama. However they are pretty expensive when it’s your first game and you do not know if the game will be successful or not. So what are the others possibilities and to what should I pay attention ?

thx

I can only really comment on the database side, but it depends on the size of your game, you can also make a Digital Ocean account, and for smaller games, you can easily get away with just setting up a development postgres server. It’s incredibly cheap, and unless you have A LOT of players, it’s going to be more than enough. (At least it was for us)

Just make sure you don’t include the database credentials inside your game. Create a small API endpoint where users can authenticate and send the database request to the API, which in turn can talk to the actual db.

2 Likes

when you are telling “it was enough for us”… how many users/players do you have running on the PostgreSQL ?

We had a total of 400-ish players, with a peak of 90 interacting with the game at the same time. Granted it was only live for a few days since it was a limited time event thing, but we had absolutely no issues with the cheap developer database.

1 Like

Look, you can go the easy way and get a $5/month subscription on some website hoster with CPanel. Game does Resource to JSON conversion, POSTs it to the web server you paid for, the server runs your PHP script, the script converts the PHP to an SQL query and there is your global data. Of course there’s a little extra glue code for using player ID as a key, giving each player a unique key for authentication, making the actual PHP (don’t worry it’s an easy language i promise)…

If you want it for free, boy you’re in for a sidequest:

How to self-host
  • Set up port forwarding on your router (if you do have access to it and your ISP didn’t lock you out)
  • Get a dynamic host name from something like NoIP, refresh it every 24h cause your ISP will change your IP all the time
  • Set up some backend server like PHP, node.js, ASP-net, spring boot
  • Get some flavor of SQL running
  • Get encryption keys from some trusted (by google & friends) group like letsencrypt.org
  • Finally, write the save/load scripts for the database side in whatever language your server runs.
  • Pray the computer or your internet connection don’t crap out running 24/7 for the next 30 days

Third option, just in case: google play games. Yup. They have a built-in leaderboard system.

Question now is 3 D’s: Do you have 5 bucks? Do you have time and patience to set up your own server? Does your game reeeeeeealy need that leaderboard?