I'm currently developing 2 different multiplayer games on Unity where the user has to register (and subsequently log in) to be able to play.
The way I would like it to work would be to only have a single account, thus being able to register only once and then play both games with the same account (think Battle.net for WoW, HS, ...).
Of course, each of the 2 games has its own specific items, coins, etc. that would be stored in their database. What I need is a good way to lay down the DB architecture (I'm using SQL).
I figured that could use a single database in the back-end with a table for authentication and then multiple tables for each game, but I see some problems with this:
Another idea would be to have a single DB dedicated to authentication (with the users' accounts) and then one DB per game with objects, coins, etc. This would of course make the architecture more complicated.
Do my concerns make sense? Is one of those 2 ideas the way things are made in the industry? Are there better ways? What are those and what would be a way to implement them correctly? Thank you all!
Let's handle your questions in reverse order:
Are there better ways? What are those and what would be a way to implement them correctly?
If each game requires registration, and uses the same registration, then the registration should be separate from the games. This prevents the two games from duplicating registration functionality. Since registration is logically separate, the data should be separate as well, meaning that you have an authentication service that stores player identities and an ID. Then in the games, store this ID for each player. Players authenticate against your service with their credentials and receive a JWT encoding their player ID. This is so separate from the games that you can just buy it off the shelf. You can maximize your chances of making a successfuly game by allowing your game devs to concentrate on game dev.
Is one of those 2 ideas the way things are made in the industry?
Yes, the architecture I describe above is used for game platforms, like Steam and Bethesda.net, but also for general online platforms, like Apple and Google. You don't register separately for, say, Gmail and Google Docs. You register with and authenticate against one service, which then allows access to many apps.
Do my concerns make sense?
Yes, your concerns make sense with one exception: don't worry about your game becoming popular. That almost never happens :)