Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Optimize chunk sets requested by players #20

Open
3 tasks
OLEGSHA opened this issue Dec 13, 2021 · 0 comments
Open
3 tasks

Optimize chunk sets requested by players #20

OLEGSHA opened this issue Dec 13, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@OLEGSHA
Copy link
Owner

OLEGSHA commented Dec 13, 2021

Currently, chunks are loaded in an ellipsoid around the player. This is wasteful: many of the requested chunks are empty or invisible. Instead, the player should not request these chunks.

The relevant code is in ru.windcorp.progressia.server.Player.requestChunksToLoad(Consumer<Vec3i>).

The solution entails three parts:

  • Make client and server agree on what block faces are opaque by moving opacity-related methods from interfaces in ChunkRenderOptimizerSurface into BlockData and TileData
  • Add similar opacity methods to entire chunks that determine whether chunk walls are entirely opaque
  • Change request algorithm to ignore chunks that are empty or hidden by opaque chunk walls

Although this is up for debate, a reasonable algorithm for step 3 may be

request 3x3x3 cube around player;
iterate chunks around player with flood-fill algorithm:
    start at player location;
    do not pass through opaque chunk walls;
    do not go further than load-distance away from start;
    if a chunk is not empty, request it.
@OLEGSHA OLEGSHA added the enhancement New feature or request label Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant