-
-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(server/player): Optimized player coords updating system #1058
Conversation
The changes I applied to the code regarding self.getCoords(), changing the conditions when joining the server at coordinates to userData.coords and getting rid of the self.updateCoords() function. I believe that my changes when saving are more efficient, because the player's position is not overwritten unnecessarily every second if he changes his position, but the position is saved when leaving the server to the database, and then loaded when entering the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Nice PR |
Noo man, but what if server crash or something? |
It doesn't make a diffrence. In both methods, the database receives the coords on player save not on the updateCoords cycle. |
Everything works fine anyway even despite the server crash, I tested this method on a couple of servers where I was a developer and where a large number of people played and every time this method of saving coordinates to the database that I posted here worked smoothly in every case. |
@falszywyyy Oke then |
The changes I applied to the code regarding self.getCoords(), changing the conditions when joining the server at coordinates to userData.coords and getting rid of the self.updateCoords() function. I believe that my changes when saving are more efficient, because the player's position is not overwritten unnecessarily every second if he changes his position, but the position is saved when leaving the server to the database, and then loaded when entering the server. Have a great day!