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
Recursive refining mapgen API prototype #5005
Conversation
- Implemented basic recursive API for mapgens - Added a simple demo which just creates a stone-landscape from one single pink noise - TODO Currently the implementation is very buggy and only works thanks to some workarounds - TODO Add support for buffers holding values for the borders between cells EXP/WIP EXP
Can you post demo screenshot? :) |
Some background on the used noise: Advantages when compared to classic noise
Disadvantages when compared to classic noise:
This demo corresponds to the following parameters: lacunarity=0.5, persist=2.1, spread=1, octaves=max_level=8, scale=0.2, offset=0. However the basic noise-function and the interpolation are different. Therefore it could not be reproduced with classic noise. |
any progress on this? |
It's very interesting, but pink noise is a boring example, i'd like to see more interesting structures shown as examples, such as a downhill river system. |
Sorry no progress at the moment as my dev system was broken and I don't have a replacement yet. |
Good to hear from you. |
Even though I don't find time to actually write code, I could give some updates on the design:
|
Given that this has been sitting around for a while and isn't yet ready for review, would you be willing to close the PR for now? This sort of thing is probably best on the forum, or at least being reopened when you have time |
Closing until it becomes relevant to merging. |
You can keep this closed (stopped working on this as I did a complete rewrite with a slightly different approach). Nevertheless there are good news that I will add to the related issue. |
This is an early prototype of the API for recursive mapgens as proposed in #4839. It is still work in progress.
I've created a simple demo mapgen which creates just a stone-field which is based on a simple pink noise. The mapgen itself is in the DEMO AREA of mapgen_rec.h/mapgen_rec.cpp. The rest of those files is just the API and its implementation.
The execution/information flow for the generation is basically the following:
1.1 Allocate buffers (engine)
1.2 Initialize buffers (mapgen)
2.1 Allocate the fragment and the buffer (engine)
2.2 Run the passes (engine)
2.2.a Each pass can read from as many buffers as it wants (pass)
2.2.b Each pass writes to at least one buffer (pass)
2.2.c At least one splitted fragment buffer has to be written. Those buffers will be used as inputs for the next iteration of step splitting (engine)
2.2.d It is possible to write to temporary buffers that are only available to following passes in the same splitting process
All this is done when invoking just one function in the basic recursive mapgen. All the real mapgen itself has to do is to specify the buffers, the passes and how the buffers map to the passes. O course it also has to also implement those two steps that are marked with (mapgen). The code of those steps is very similar to that of existing mapgens.
Passes could be implemented in a configurable way and therefor could be shared between mapgens. E.g. only the first line of NoisePass::doSplit has to be changed for different noise functions.
The result of step 2 is cached. Therefore on average the resulting fragment only corresponds to one or two splitting operations independently of what resolution was chosen for the root fragment.
Note: The mapgen is still somewhat buggy and will never release the allocated fragments and buffers. It just works stable enough for testing and is more of an demonstration of what the API should look like.