Skip to content

A way to pass terrain height map to generation populators #6868

@dktapps

Description

@dktapps

Problem description

Most populators want to place objects on the surface of the world. Currently, they have to use Chunk->getHighestBlockAt() to do this, which scans down the column to find the highest block at an X/Z coordinate.

However, at least with the likes of GroundCover, we actually have this information already available within the Normal generator, because we just generated the base terrain in generateChunk. So to have GroundCover have to do chunk scans to calculate height 256 times is stupid and costs performance.

Proposed solution

generateChunk-stage populators should be able to receive a heightmap. However, this shouldn't be mandatory, since some generators won't generate a heightmap (e.g. nether).

Either that, or we should consider deleting GroundCover and integrating its functionality directly into the Normal generator itself, or specialising it to acknowledge the fact that it's typically used during generateChunk where heightmap information is available in the outer scope.

Alternative solutions or workarounds

We can optimise getHighestBlockAt() harder, I guess?

We could also include a terrain heightmap in Chunk...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: CoreRelated to internal functionalityPerformanceType: EnhancementContributes features or other improvements to PocketMine-MP

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions