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

Optimize chunk sets requested by players #20

Description

@OLEGSHA

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions