My entire game is server side and I use nodejs
with mysql
.
When players connect or join a game, their player data (Items, Stash, Quests, etc) all get stored into the memory buffer.
For example, if a player joins a game and there are 40 items on the floor and he decides to pick them all up, it's easier just to add that to their Inventory object instead of using a insert
statement each time. Then, when that user disconnects I can save all that data respectively. (Now that I think of it, that query would run 40 insertion
rows..)
That's the problem I have though, do I save the data during the looting process or wait until the player disconnects and run a db update
to save their memory buffer (only the changed buffer) to the database?
The Issue I have with that is, if a player picks up over 40 items in the game, that's going to be a lot of sql insertions
when they disconnect..
Imagine them finding a ton of items from mobs and having a huge amount of new updated buffer data that needs to be stored.. (after they disconnect), that would be a dreadful update. Especially if they stored hundreds of items in their stash or whatnot. Hmmm.