You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, thanks for this lovely library! I have grand plans to (eventually) incorporate procedural generation via wavefunction collapse into https://github.com/swarm-game/swarm/ (it currently has procedural generation but only based on Perlin noise) . However, I was reading the documentation today, and it seems like I want something in betweenHolmes and Watson:
I do want to generate "natural-looking" procedurally generated things, so I definitely want the random shuffling that the Holmes monad does. Besides just generating more natural-looking things, I also don't want to get the same solution every time.
However, because I am generating infinite worlds and only dynamically generating/loading the parts of the world that are actually explored, the generation needs to be deterministic (based on a seed value), like Minecraft. I also just really don't want to introduce IO.
So I would really like a monad that (1) is built over ST, but (2) does random shuffling based on a seeded PRNG. This seems like it should be totally possible in theory --- from what I can tell Holmes is implemented in terms of shuffle from hedgehog, which has type MonadGen m => [a] -> m [a] and does not itself depend on IO in any way --- the IO only comes in from the use of sample :: MonadIO m => Gen a -> m a, which is one convenient way to run a MonadGen computation but not the only way.
Curious to hear what you think about the possibility of exposing a slightly different API which allows this. I'd be very happy to try to submit a PR if you think it seems reasonable. I saw elsewhere that you mentioned working on a rewrite of this library, so I'm not quite sure what the status is.
The text was updated successfully, but these errors were encountered:
byorgey
changed the title
Thoughts on *deterministic* shuffling, for repeatable procedural generation?
Thoughts on deterministic shuffling, for repeatable procedural generation?
Jun 16, 2024
Hi there, thanks for this lovely library! I have grand plans to (eventually) incorporate procedural generation via wavefunction collapse into https://github.com/swarm-game/swarm/ (it currently has procedural generation but only based on Perlin noise) . However, I was reading the documentation today, and it seems like I want something in between
Holmes
andWatson
:Holmes
monad does. Besides just generating more natural-looking things, I also don't want to get the same solution every time.IO
.So I would really like a monad that (1) is built over
ST
, but (2) does random shuffling based on a seeded PRNG. This seems like it should be totally possible in theory --- from what I can tellHolmes
is implemented in terms ofshuffle
fromhedgehog
, which has typeMonadGen m => [a] -> m [a]
and does not itself depend onIO
in any way --- theIO
only comes in from the use ofsample :: MonadIO m => Gen a -> m a
, which is one convenient way to run aMonadGen
computation but not the only way.Curious to hear what you think about the possibility of exposing a slightly different API which allows this. I'd be very happy to try to submit a PR if you think it seems reasonable. I saw elsewhere that you mentioned working on a rewrite of this library, so I'm not quite sure what the status is.
The text was updated successfully, but these errors were encountered: