|
 |
"Samuel B." <stb### [at] hotmail com> wrote:
> Are you familiar with the so-called "wave function collapse" algorithm? It can
> produce similar results to this, but must be run for many cycles.
I was not! Having just looked it up, it does indeed seem applicable to this kind
of thing. However, as you say, probably quite expensive for an SDL
implementation. A very interesting approach to procedural generation that I'll
be sure to come back to at some point, thanks for the pointer!
My somewhat naive algorithm currently traverses the grid only 5 times: once to
zero it, once to populate it with 'floor' cells, once to remove 'loners', once
to place stair cells between suitable near-neighbour floor cells (in a
kind-of-random way), then finally once to build cell geometry based on the final
state.
> Are the pathways here completely traversable, or are there islands?
Good question! There will most certainly be islands, the above algorithm in no
way guarantees complete connectivity. However, given a high initial density of
floor cells, and also that the stair cell pass might replace
otherwise-unconnected floor cells with stair cells, it seems likely that
completely connected structures might occur by chance!
A nice aspect of this approach is that setting floor and stair cells manually is
an option. If I made the stair pass a bit more rigorous, in theory one could set
floor cells alone and let the program fill in the stairs etc.
Bill
Post a reply to this message
|
 |