Some Questions on MMO Framework

Hello everyone!

I have some questions on what the best practice, of which I am sure there are many, on how to handle MMO communication from a design aspect.

Some details to start.

I have a MYSQL database able to store all my player information, and it is working.

I currently have player state storing the information on player stats (Health, mana, etc), and the scripts set up to execute on server at runtime to gather the stats from database, and replicate to the client.

I have been wondering if this is the best way to handle it.

There is something called game state and game instance, but I am confused on what to actually use it for, so maybe an example would help.

I haven’t ventured too far yet, and wanted to make sure I’m going in the correct direction.

I would like the server to receive the information from the database, store the information on the game server, have the player clients send back to the server for commands, then have the server check to make sure the player can do the action and so forth.

Basically, I am concerned the player disconnects, and the player state vanishes, and the players information is lost at disconnect.

I am aiming to have the server, send the player stat update that occurred on that session to the database only once, 30 seconds after log out or disconnect.

The question is, does player state continue to stay active once the player leaves the current session from log out or disconnect?

Thanks!

For more info on Player State across sessions, take a look at the following:

https://blog.maide.ca/2016/02/26/ue4-persisting-users-across-disconnects/

I have built a very similar system to what you are trying to do. Here is how my system works. I put the stats in the Character class instead of Player State (though Player State should work fine as well). The only value I put in Player State is the unique Username that is used for lookups in the SQL database. Then when a player logs in, it gets their location/status/stats from a SQL database by sending a JSON request using the vaREST UE4 plugin to a JSON web service I wrote in ASP .NET. Those stats then get set on the Character class and auto-replicate to the clients. Then the Character class on the server is setup to send a JSON request back to the JSON web server every 20 seconds or so to update the current characters location/status. When I switch maps, I save the location/status/stats to SQL via the JSON web server, transfer the client to the new server/map, and then reload the location/status/stats from the new server/map.

Here is more info on what I built:

If you have any other questions, let me know.