Ok so I’m trying to create a little persistence in my game. In other words the player location is saved to a database, when objects are moved the locations are the same the next time the game is played.
Now in c# I have no problems connecting to a database and saving and retrieving data to use in the game. Where I run into confusion is when to save certain things.
Lets take player location for instance. obviously I don’t want to be saving out to a remote data base every time the player moves. That would be to many calls to the db.
So the question is when do I grab the player location, rotation, etc and push that out to the database?
I thought about doing it when the player logs off, or hits “Exit”. But what if they just hit the red x in the corner and kill the window? I don’t know if I can control that. or maybe even on a timed event. But say for the sake of it that 1000 people are playing the game at the same time. With players and objects imagine how many db calls that would be. Just doesn’t seem right.
Any idea?
Thanks.
How about timed calls? Once every few minutes…
Or when something important happens? Such as an achievement?
Is there a reason for precise, accurate position of the player in the DB, such as replication to other player?
Then they’ll learn not to do that again.
I’m going to use Assassin’s Creed and Grand Theft Auto 5 for an example.
These games do not save every frame. They wait for something of “significance” to happen and then they save in the background.
Eg:
- Buying an item from a shop. More specifically, when finished shopping.
- Completing a mission
- Finding a collectable (Finding a stunt jump in GTA, finding a feather in Assassin’s Creed, etc…)
- Earning money.
- Skyrim autosaves everytime a new area is loaded.
- It’s easier in turn based games. Turn based games like Puzzle and Dragons save after every turn.
I just noticed that you’re talking about a multiplayer game, and a MMO at that. Yes, having a thousand people playing at a time with persistence means you are going to have to have a fat internet pipe with some serious server-side power. When getting to scales that large you’re gonna need to have a lot of server-side experience, or find a server guy to work together with. I would do whatever your server guys find best.
Games like World of Warcraft literally log every single interaction and event that happens AS IT HAPPENS. I wouldn’t even think of World of Warcraft as having a “save” system, unless you count backups. Their databases are live and changing constantly as people are looting, killing, and completing missions. It’s not like the data is “saved” then “loaded” later on.
Garth thank you for both posts. While your first post gets me started it is ultimatly the second post that is my goal. I am trying to get more of a single play thing rolling first then dive into networking.
I am looking at things like UnityPark, or photon cloud. But admittedly am very in-experienced at multi-player. But hey at least I’m not a fraid to ask questions and learn!
just a note to avoid confusion on your side. on a multiplayer game the player client does not calculate the movement and send it to the server for storage but the player sends an attemt to move to the server, the server calculates if the movement is valid and sends the new position back to the player. if your game is calcuated on the client you are pretty much inviting “hackers” to cheat in it, allow bots etc. . so every for the gameplay important information has to be calculated (and stored) on the server itself.