Download

I need some help with the Savegames in Multiplayer

Hey guys,

i hope someone can help me here. I asked several times on the Hub, but no one even answered me once with an idea or something ):

My game needs to save 2 different things. The world and all players (health, inventory etc.).

My problem is, that i don’t know how i can connect the saved data of a player with him.
I have no unique ID or something and no Username that is always the same.
I guess i can call the save function on the server, if the client quits but how can i load this specific savefile back when he joins again?
Like i said, nothing to indentify a player again.

How can i do this? I tried searching for MySQL support on UE4 but i can’t find a tutorial or something.
My c++ is restricted and i don’t really understand how i link c++ to php and than to my MySQL Database.
I can’t even find a non UE4 related tutorial on this ):

I checked the Steamworks thing and read that my game first needs to be greenlight. But a game with a nonworking savegame system on Multiplayer is nothing to be greenlight or?

Does anyone have an idea how i can solve this or can some provide some good tutorials on how to use a database with UE4?

I would be so nice if someone could at least provide an idea.

Perhaps you should have the server generate a unique ID for each player which is then stored on the server and the client. When the client joins and sends that ID, the server loads the corresponding save.

Ok, so if a client joins i would need to call a function on him that than tells the server to create a unique ID that no one has. He saves the Inventory with this ID and than?
The client gets the ID itself but how does the client know to which server he connects and which ID he needs to use now?

I would need to have an ID for the Server as well but than i would need to track ALL Server that exist and make sure not a single server has the same ID. :confused:

I thought about this too, but i can’t get this working in my head.

EDIT: Ok, for the time that no one can help me with this, i will let the players play all the characters on all server.
Than they are always on the same spot on every map and server, only that the world will be different.
Thats totaly not what i wanted, but since there is nothing easy to do, i must do it like this -_-

Hey buddy, I have the same problem. Did you solved it?

Well yes, you need an OnlineSubsystem that generates a Unique ID for you. For example Steam and its SteamID.
If you are good enough at coding, you can also code your own Subsystem.

Use php scripts to talk to a MySQL database then retrieve this information using Json requests with the Varest plugin. Have the ID stored in the database when player logs in to server retrieve the ids and any other stored information from the database.

Here is one example that will point you in the right direction to see how to interact with the database.

https://forums.unrealengine.com/showthread.php?94421-FREE-VaRest-Login-System-With-PHP-and-MySQL&highlight=MySQL+login

If you are willing to spend a bit of money then play fab is another great option they take care of everything for you with just a little bit of setting up.

https://wwwtest.playfab.com/

A custom subsystem seems pretty easy to do using just dataTables saved server side if youre doing a smaller project.

Just make a “register” function using UMG where you generate a random player ID (counter checked versus the database if its already been given out) and assign whatever inputs you get from the player (username, password, selected class, character gender etc) into the datatable.

Make your own login screen that asks for a user and PW, loop through the datatable to find a match, and load the relevant data.

You can use parallel dataTables to store login info with the parallel table storing game data.

Backup the dataTable regularly.

Done.