persistent actor in game world

I’m looking to make a game where players can store their inventory items in a container and then disconnect from the server. When they later reconnect to the server, their items will still be there for them to retrieve.

Is a database usually used for these types of persistent actors? Would keeping all the container items in server memory be an option for this type of game?

Any advice on how to get started with this?

Yes, a database is required ( or a server-side save system).

Are there any common configurations for games that need this type of persistence? Is HTTP used by the game clients to communicate with the database server? Are there any code examples to look at online?

Looking for any documentation or suggestions on how one might get started integrating a database with your game to provide these type of persistent features.

Depending on where you want to store the information, you could just use the Save/Load system built into Unreal. This basically creates a binary .sav file that is written to the computer hard drive. You could also use a backend system such as PlayFab (generally free for low useage) or GameSparks to save data and/or files to the player so that they can be retrieved from anywhere then.

Thanks for suggestion. I’m new to online multiplayer but I see that PlayFab has options for virtual player currency, item stores, player stats, inventory, leaderboards and allows for login with Steam. Doesn’t Steam already have some of these features (like leaderboards and analytics)? Does Steam let you store any player data in their cloud or is it not designed for this type of situation?

Is a service like this usually used in conjunction with Steam or is it meant for standalone games?

It depends on your goals, should it be persistent per player and per server, should it be persistent over server restarts, persistent for a player across multiple servers? If I understand you correctly you have dedicated servers for your game that players can connect to, store inventory in some container and later be able to find it again after reconnecting? If it is just that it should be pretty simple, just store the inventory as replicated variables on an actor in memory on the server and the client can access them. If you need persistence over server restarts or crashes then you can implement a save system on the server. If you need persistence over multiple servers etc. you would need a cloud service. Steam has a decent amount of features built in, including per player cloud saves. I would recommend you to read the Steamworks documentation and see if it has the features you need. It it doesn’t you could adopt features with a different service such as PlayFab.

Yes, that’s what I was thinking. But also other players might also interact with the container when they are offline.

I would like this type of persistence so the player doesn’t lose all of their progress if there is a server crash or restart needed. Dune suggested the Unreal Load/Save system which creates a binary .sav file on the server but I’m not sure if this would be a scalable solution. There could be a lot of containers on the server and may involve a lot of reading/writing to the hard drive.

I would like players to have the option to host their own dedicated server (if they have the required setup and connection). It seems unreasonable to have them configure a database manually in order to get the dedicated server up and going, doesn’t it? So if I wanted to use a database, I guess there would have to be some kind of middleman which handles setting up and configuring the database. Maybe that’s where a service like PlayFab (or other third party service) would come in?

Any ideas on how to implement this type of save system so server crashes won’t destroy player progress?

Don’t need this type of persistence between servers. Servers should be completely independent of one another. If player joins a new server he essentially has to start over on that server.

Ok in that case it is very similar to something that I am working on at the moment. For everything in game you can use the standard UE4 replication system, you can also configure it in a way that all clients can interact with the inventory. I’m not sure if the default save system would work well for your case, it basically lets you save the properties of a save game UObject but that might not be the best structure to save the progress of an entire world. You can implement a custom save system where you serialize all your data manually and save it with the same backend to the file system. That is a bit more advanced though, you can probably work on this save system later on after everything else works since backups for server crashes probably aren’t a high priority early on.

I built a plugin for cases like this.
It’s been used on a few game projects as a “cache database” that later is synced to a cloud server.

A “SQLite” database attached to Dedicated Server that can be setup as asset in Unreal Editor, doesn’t require configuration by modders and doesn’t need knowledge of SQL language (it generates SQL code by itself):