MYSQL Data problem
#5

It's not wrong, but it would make life much easier and your code easier to maintain and fix bugs.

On the other hand, if you only save ALL their data during OnPlayerDisconnect, you can loose data.
If a player logs in and plays for hours in a row, does alot of missions, earns alot of money, whatever...

Say he plays for 10 hours straight, earns millions of dollars, earns hundreds of scorepoints, finishes over 100 missions, killed 150 players, and whatever more.

In case of a sudden server-crash, all that progress is just gone, as nothing has been saved during those 10 hours.
The player who put in hours of playing time to earn his stuff will be furious as he has to start all over again.
If it happens frequently, he might just leave your server (I would) and search for a better one, which DOES save data frequently.
He also might complain on your server's forum that you have to fix bugs, as his data wasn't saved in time.
To the player, he doesn't know your script only saves data when he logs out.
To the player, it appears your script has a problem loading/saving data.

I play MMORPG's and those save data whenever it changes in case of a server-crash, to minimize the dataloss and loss of progress for players.

It's like coding an entire day, writing 5k lines of code and never save, only just before you turn off the pc and go to bed.
When the electricity would fail (electric work by the company, a blown fuse, whatever reason), you would lose your entire script.
You'll have to start over and wonder: why oh why didn't I save earlier?

For all those reasons I stated:
- minimize dataloss
- easier to maintain code (the queries themselves as they are all quite short)
- easier to spot bugs
- less prone to making mistakes as your query-line doesn't span over 10+ lines

I prefer to use small queries all over the place and save data whenever it changes, and I recommend it to everyone.

If my own server would suddenly crash, I have 0 dataloss.
In case the server crashes during execution of a query, there are 2 possibilities:
- either the query was sent properly and the data was updated (server might crash, but mysql is a separate process and might not crash
- either the query failed to be sent to MySQL and only that last value-change was lost

The only thing that might be lost, it when a player already started a mission and is close to the end-point of the mission, in case of a server-crash, the trip he took from start to finish for that mission is lost, as data isn't saved in the middle of a mission.
That's 5-10 mins of playing time that gets lost, but not any data.
Reply


Messages In This Thread
MYSQL Data problem - by vassilis - 15.01.2015, 01:35
Respuesta: MYSQL Data problem - by Zume - 15.01.2015, 03:44
Re: MYSQL Data problem - by PowerPC603 - 15.01.2015, 09:57
Re: MYSQL Data problem - by xVIP3Rx - 15.01.2015, 10:06
Re: MYSQL Data problem - by PowerPC603 - 15.01.2015, 10:15
Re: MYSQL Data problem - by xVIP3Rx - 15.01.2015, 10:29
Re: MYSQL Data problem - by vassilis - 15.01.2015, 12:41
Re: MYSQL Data problem - by PowerPC603 - 15.01.2015, 12:54
Re: MYSQL Data problem - by vassilis - 15.01.2015, 12:59
Re: MYSQL Data problem - by PowerPC603 - 15.01.2015, 13:02

Forum Jump:


Users browsing this thread: 1 Guest(s)