feat(engine): search for nearby players using different algorithms #1237
+72
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Searching for nearby players is done in a spiraling pattern around the player today. This search is particularly only useful when your view distance of players gets smaller and smaller, as player density increases to 250+.
I add an additional way to search for players by zone lookup, when your view distance is currently unchanged. I've found this to be less work then doing a full spiral loop every tick, when the area is not dense.
And this is what I get for an extremely packed area.
I also made it so when you teleport into a dense area of players, this will automatically decrease your view distance and switch to search by nearby.