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

Chunk generation priority (PM4) #4187

Closed
dktapps opened this issue Apr 18, 2021 · 2 comments
Closed

Chunk generation priority (PM4) #4187

dktapps opened this issue Apr 18, 2021 · 2 comments
Labels
Category: Core Related to internal functionality Performance Resolution: Fixed Type: Enhancement Contributes features or other improvements to PocketMine-MP
Milestone

Comments

@dktapps
Copy link
Member

dktapps commented Apr 18, 2021

Description

Chunk generation should be able to have an associated priority, to speed up the generation of more useful chunks in the generation queue.

Since the introduction of chunk generation promises, the combination of high chunks-per-tick sending and low generation queue size causes some problematic side effects on chunk loading when flying around in a new world, because chunk generation requests are FIFO. This means that if you move to a different position, and are still using some of the same chunks that you were using at the old position, those chunks will be generated first, even though they are now (usually) further away, and you have closer ungenerated chunks which need to be generated.

This results in the player being able to fly into ungenerated terrain even on very high performance servers if misconfigured.

To address this, generation requests should have an associated priority so that they can be processed in the most efficient order possible.

@dktapps dktapps added Category: Core Related to internal functionality Type: Enhancement Contributes features or other improvements to PocketMine-MP Performance Line: Bleeding Edge labels Apr 18, 2021
@dktapps dktapps added this to the 4.0 milestone Apr 18, 2021
@dktapps
Copy link
Member Author

dktapps commented Apr 19, 2021

Implementing this would have a very high complexity cost, because the generation queue might end up getting continuously reordered due to players moving around.

The older system which just bounces the request over rate limit dealt with this much more effectively, because the player would just re-request chunks with bounced requests. Since the whole chunk order is rebuilt starting from the player's new position when it moves, this ensures that generation is always producing chunks near the player. It wasn't a perfect solution, but it worked better than the current system, which unconditionally accepts generation requests even when the queue is full, and just defers them until the generator is not busy.

@dktapps dktapps modified the milestones: 4.0, 4.1 Oct 11, 2021
@dktapps
Copy link
Member Author

dktapps commented Oct 31, 2021

This problem is the result of an over-engineered solution for #3947 that in the end turned out not to be very useful anyway.

dktapps added a commit that referenced this issue Nov 5, 2021
this fixes the horrible spotty chunk loading seen in https://twitter.com/dktapps/status/1456397007946461190?s=20.
In practice, this made chunks invisible on teleport for several tens of seconds after teleporting. Having a larger chunks-per-tick with large render distance compounded to worsen the problem.
It wasn't really noticeable on small render distances, but very obvious on large ones with fast chunk sending and slow generation.

This also fixes #4187 (at least to the extent that it works on PM3, anyway).
@dktapps dktapps closed this as completed Nov 5, 2021
@dktapps dktapps modified the milestones: 4.1, 4.0 Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core Related to internal functionality Performance Resolution: Fixed Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

No branches or pull requests

1 participant