- Home /
info to the databse and rollback preventing.
Well, I have got a question, I'm working on an MMORPG and I'm in a goal to make sure that the position which is sent to the database wont make any rollbacks. The client send the last position of the player when the application quits, but in case of any unexpected shutdowns of the connection / client itself the last position should be still saved, so it wont rollback to the last time the player has quitted.
I thought about sending the last position in time periods, like 5 minutes for example, but im not sure how it will affect the server, and still people might have rollbacks if they had "an accident" 4 minutes after the last position saving. the position sending is being sent as a url. and I'm working with photon for the realtime multiplayer.
Please help me, is there a better way to make sure the last correct position is safe at the database?
Well either saving the position in the database at a regular interval or alternatively locally on the clients machine would both work.
If this is a multiplayer game, one thing you may have to think about is that players could be able to send/save incorrect positions and thereby cheat.
Without getting into too much detail, you would probably want an Authoritative Server.
So if the connection to the database fails, you could still save the position locally and then add it to the database next time you have a connection, but if the entire application force quits then you won't be able to run any extra code to make sure the position gets saved.
Saving a single position every couple $$anonymous$$utes to the database shouldn't harm the server.
Thank you... merry :) I'll use that. But still, id love to hear some more advice :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613103335im_/https://answers.unity.com/themes/thub/images/avi.jpg)