mikeprimm / SchematicBrush

Adds schematic file based brush tool to WorldEdit
10 stars 6 forks source link

Populating a WE selection with Schematics at a set Density #10

Open ChristianLieven opened 7 years ago

ChristianLieven commented 7 years ago

Hey Mike,

This is an idea a couple of us had on the server. We'd like to be able to make any sort of WE selection, then define a SchemSet or a mix of SchemSets and then have the SchemBrush populate that area subject to a random scattering algorithm.

Ideally, to determine how close together trees cluster this algorithm would take into account a few biological parameters such as the horizontal dimensions of the canopy or its density i.e. amount of light under it of the individual schematics.

Ideally, users would be able to play with the parameters (or even better, a single parameter), but depending on the algorithm you choose this might not be necessary/ feasible.

Here are some suggestions of what kind of algorithms would make this happen in principle: http://www.gamasutra.com/view/feature/130071/random_scattering_creating_.php?page=3

http://procworld.blogspot.com/2011/05/forest.html

I don't think you need to worry about factors like slope, water or sunlight much. I think it should be up to the user to just use another SchemSet and some sort of 'scatter coefficient' (sparse - dense) more suitable to an area's topography.

What do you think?

mikeprimm commented 7 years ago

Neat idea - let me read the provided info, and give it some thought!

ChristianLieven commented 7 years ago

With regards to what Steineke posted here, this could be a rough pythonic pseudo-code outline for the command, that helps avoid all the mental acrobatics he's performing to squeeze this into FAWE:

def ForestGen(we_selection, trees_schemset, density, undergrowth=none, undergrowth_density=0, debris=none, debris_density=0):
    # scatter algorithm that uses parameters from the tree schems to determine where to place trees.
    # Parameters used are height of the tree, width of the canopy and light level at the coordinates.
    scatter_algorithm_trees(trees_schemset, density)

    if debris:
        # scatter algorithm that just picks random free coordinates in the we_selection
        scatter_algorithm_debris(debris_schemset, density)

    if undergrowth:
        # scatter algorithm that samples coordinates based on the undergrowth_density parameter and the light level in the we_selection.
        scatter_algorithm_undergrowth(undergrowth_schemset, density)