-
-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
enhancementNew feature or requestNew feature or requestperformanceSomething which reduces resource usageSomething which reduces resource usage
Milestone
Description
For each player, if another player is not visible to them (such as being hidden behind a wall), the other player should be despawned. This has some advantages:
- Decreases the number of position/look packets sent to the client to reduce network utilization
- Improves client performance
The second point is the most important. I have tested on both Fabric with Sodium and Optifine, and both are able to get >60 fps with no players spawned. However, with 2k players spawned, the performance drops substantially, even when the players are not in view.
On Sodium:
On Optifine:
The event and the event map should be designed in a way that ~<1k players are usually visible at the same time.
For the implementation, I'm thinking of the following:
- Divide the world into 4x4x4 chunks
- Have a separate program which pregenerates a list of chunks that are visible at a particular chunk given the map. This list will be used to make a Bloom filter or similar data structure
- To determine whether a chunk is visible to a specific chunk, we will do raycasts from many points within the chunk. This is expensive which is why it's being pregenerated
- On the proxy, we'll have channels which the server can subscribe and unsubscribe players to. A player's position and look updates correspond to one channel. Using the chunk visibility information, the server will subscribe and unsubscribe visible and hidden players accordingly
Advantages:
- This should be relatively fast. Bloom filters can check whether an item may be in the set in constant time. We may want to also use a different probabilistic data structure instead of Bloom filters; there are many newer ones that claim to be faster than Bloom filters.
- We could implement the visibility checks entirely on the proxy and do nothing on the server
Disadvantages:
- Requires map blocks to be unbreakable (we are likely to do this anyways)
- Does not account for blocks placed at runtime, although this should not be a major issue
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestperformanceSomething which reduces resource usageSomething which reduces resource usage



