Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way for world generators to not be forced to run in an async task #6556

Open
dktapps opened this issue Dec 3, 2024 · 0 comments
Open

A way for world generators to not be forced to run in an async task #6556

dktapps opened this issue Dec 3, 2024 · 0 comments
Labels
BC break Breaks API compatibility Category: API Related to the plugin API Type: Enhancement Contributes features or other improvements to PocketMine-MP

Comments

@dktapps
Copy link
Member

dktapps commented Dec 3, 2024

Problem description

Some generators, like Flat, do not require an async task, and using an async task to just copy a chunk is a waste of resources.

There may be other cases where it might be desirable to run parts of, or all, of generation on the main thread, such as when creating entities or tiles during a generation step (e.g. paintings or chests).

Proposed solution

Make Generator->generateChunk() and Generator->populateChunk() return Promise, so that individual generators can decide how they want to do async generation. This could be a promise resolved immediately on the main thread with a chunk copy, a PopulationTask, or perhaps some other mechanism entirely.

It may be more complex than this (e.g. a chunk source may be needed for adjacent chunks), but that's the basic premise.

Alternative solutions that don't require API changes

@dktapps dktapps added Category: API Related to the plugin API BC break Breaks API compatibility Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC break Breaks API compatibility Category: API Related to the plugin API Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

No branches or pull requests

1 participant