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

Density Function Re-Work #525

Merged
merged 21 commits into from
Feb 10, 2025
Merged

Conversation

kralverde
Copy link
Contributor

@kralverde kralverde commented Feb 1, 2025

Description

This PR adds a density function extractor and reworks density functions as a stack of components to allow for easy mutation of state.

The end goal of this PR is to make the density function code cleaner and more readable, remove unsafe code, and to separate density functions from the chunk noise generator to allow ease of use with other dependencies such as biome generation. (maybe we'll get a performance boost too)

For use with Pumpkin-MC/Extractor#3

Testing

Please follow our Coding Guidelines

@kralverde kralverde marked this pull request as ready for review February 10, 2025 05:40
@kralverde
Copy link
Contributor Author

Final result:

  • A bunch of redundant code removed
  • Compartmentalized density functions
  • 25% speed-up (on my machine)
  • Removal of unsafe code
  • -60 Sanity

@Snowiiii
Copy link
Member

Please add a way to extract all the .chunk files in our extractor, i only see one single chunk.json file

@kralverde
Copy link
Contributor Author

Please add a way to extract all the .chunk files in our extractor, i only see one single chunk.json file

Should be good now

@Snowiiii
Copy link
Member

Great work @kralverde (like always 🙃). The new implementation definitely looks cleaner, Hope this also helps with Biomes.
The Speed difference is also significant, For my machine it got down to 12ms from 20ms

Thank you @kralverde ❤️

@Snowiiii Snowiiii merged commit 8d2ca8e into Pumpkin-MC:master Feb 10, 2025
9 checks passed
urisinger pushed a commit to urisinger/Pumpkin that referenced this pull request Feb 16, 2025
* add density function parser, re-write functionality, and add initial tests

* add more tests and fix typo

* re-work density interpolator

* re-work flat cache

* re-work the rest of the chunk specific density functions

* re-work fill functions

* tweak sample logic and do some refactoring

* convert chunk noise to use new density functions

* work on porting proto chunk

* port proto chunk

* add cell cache test

* fix wrapper functions

* remove test print

* update benchmark

* rework again

* rework again pt 2

* classic off by one

* reduce components on the stack by 60x

* aquifer tweaks

* add multi noise sampler for biome sampling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants