Can I use cloud save as a complete database for a card game? or should I approach it differently?

I’ve been working on a card game for a while and made my own dedicated server.

It works fine, but I am worried about scalability so started investigating unity services, and I’ve been very keen to move into a solution that uses game hosting for in-game logic, cloud code for out-of-game logic and cloud save for saving most of the data.

Is it ok to use cloud save as a database for all my player’s data, such as which cards they’ve bought and the decks they’ve built?

Alternatively, I could use some database stored somewhere else for this data, but I’d still need to access it via cloud code. Is there an easy way to use SQL commands from cloud code?

What is the best approach here? Is there a unity service that could work as a database for this case?

Thanks!

Perfectly okay for sure but you ought to estimate your data usage so that you can estimate the running costs (if any). You can use my Unity Gaming Services Cost Calculator to punch in some numbers.

The costs at scale are higher compared to running your own SQL server for reasons of convenience (dashboard, API) and a team maintaining the service vs you doing everything including the API, testing, scaling, maintenance.

3 Likes

Hi @sbehrmannc (and thanks for posting @CodeSmile !)

I’m just catching up on some old open posts, and saw this - but I think I already interacted with you on another site :slight_smile: For other folks who might stumble on this, I’m going to repost my response here…

Response:

Unity Cloud Save is intended for both Player Data and Game Data and with Queries can be used as a drop-in replacement for a database - and should work great for a PvP card game.

Advantages are that it works with Unity Authentication out of the box (so the Player ID will be the same across Unity, including with Leaderboards, Matchmaking, etc) and so any time a player calls a Unity Cloud Function the function automatically knows who they are and is able to save and load data for them securely, that it’s cross platform and that you only pay for what you use, with the first 1 million reads, and 1 million writes each month being free.

Unity Cloud Save also provides a REST API you can use, as well as Cloud Code SDK and Unity CLI module and management interface via the Unity Dashboard. There are also things like support for Triggers, which can run when data anywhere in Cloud Save changes (e.g. a change in game state, or data for a particular player) and they can run Cloud Code functions, which can do things like real-time send messages over sockets to another player (e.g. to tell them it is there turn / that they are being challenged / let them know the outcome of something).

A dedicated database does allow more flexibility in the sorts of queries you can do, with the tradeoff being cost you might pay up front, and any system administration overhead. However, Cloud Save Queries are quite powerful on their own and well suited for things like card games - for inventory, for matching players and for tracking game state.

As a couple of examples of how you can use Cloud Save to find and match players:

If you are looking for an example of the sort of thing you can do by combing Unity Cloud Save, Unity Cloud Code (and messaging from Cloud Code using sockets) to implement real time experience without using a server and database, you might find this video helpful:

(Please excuse the terrible voice over, this was a quick demo created in a couple of days, in between other things!)

2 Likes