Skip to content
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

Merged
merged 3 commits into from
Jun 9, 2023

Conversation

falszywyyy
Copy link
Contributor

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!

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.
Copy link

@KentaKK KentaKK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link

@xkariee xkariee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@Thekuca Thekuca changed the base branch from main to dev June 9, 2023 22:43
@Thekuca Thekuca changed the title Optimized saving of player position refactor(server/player): Optimized player coords updating system Jun 9, 2023
@Thekuca
Copy link
Member

Thekuca commented Jun 9, 2023

Nice PR

@Thekuca Thekuca merged commit 48076f2 into esx-framework:dev Jun 9, 2023
1 check passed
@Tinky124
Copy link
Contributor

Noo man, but what if server crash or something?

@Thekuca
Copy link
Member

Thekuca commented Jun 10, 2023

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.

@falszywyyy
Copy link
Contributor Author

Noo man, but what if server crash or something?

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.

@Tinky124
Copy link
Contributor

@falszywyyy Oke then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants