Download

Best way to Savegame Multiplayer

Hi, how do I save allot of information like : Player money, player info, player inventory, player stats. What is the fastet way and the best way to do it.
Does UE4 support MySQL Databases to save that ?
EDit: I just saw that it Supports Mysql databases, but is is that the best ?

Maybe this will help:

You probably need backend with your own API where you will send requests and receive data from the webserver (database).

I’d recommend an already established back end for that kind of stuff. Check out PlayFab as they seem to be one of the most up to date plugins with the Engine version. Saves you having to roll your own.

Thanks, looks like allot of work :slight_smile:

Another more simple method is to use the USaveGame class (but that will only save locally to the device/computer). It is easy to setup and save players data, but obviously you cannot access these through an online service with a database.

Well, if you want to retrieve simple character info from the database without complex matchmaking system, friend lists, invites etc. it’s not so hard to do. Basically, UE4 send request for user data and receive in specific format (json for example). You should also save this data locally, so you do not need to send too many requests (only when you change something). And also you need to setup backend for saving data and secure them.

Just to elaborate a little further, the MySQL implementation on client side would mean you would ship MySQL credentials with every client which is less than preferable. In a tool or in-house system that may be what you want and could work nicely, as long as there is no way you’re shipping credentials to a third-party which could intend to use it maliciously.

For a dedicated game server that can work nicely, a dedicated server your players can host themselves a MySQL implementation in my opinion would be better than varest. Use a config file (plugins for that) to define MySQL credentials.

Varest for dedicated servers would require you to also host a REST API alongside the system, which of course would work but it’s not the easiest solution. However only using a simple MySQL server and the dedicated server your players would be more familiar with the setup.

It really depends on how your game works, could you elaborate on who hosts the servers and are the servers supposed to talk with each other to share data? Think GTA servers VS minecraft servers, GTA needs to sync data between different servers whilst Minecraft doesn’t because you start again on each new server.

Every game is different but I have been only using mysql for account database and handling micro-transactions (keeps record).
For authoritative server, the server keeps player/game data. Anything the player gets, is only allowed by the server, and with that same process, the player profile/data on server is updated. There should be no need for game save if it is persistent and the server is authoritative. Once you have a population of players on your server, you don’t need the game waiting on the MySQL pipeline que to update player info. If your only dealing with a few players, and they do not need save/updating of info constantly it would be ok but still not recommended for a professional game.