Hi! First of all, I love the idea of this repo, and I am using to learn elm :D
I am having problems getting randomness into my "game". I think that the problem is that game function doesn't allow me to modify the returned Cmd of the update function (this line), required in order to generate a random value.
Am I getting something wrong? Is there any workaround to getting access to the Cmd?
The text was updated successfully, but these errors were encountered:
What are you wanting to use randomness for specifically? That can help a lot in designing features in the future.
For now, there is not a way to add randomness with the Random module. I wanted to keep it really minimal, and that API is pretty fancy for what I was going for here.
If I wanted to spawn spaceships at some unknown x coordinates, I would probably do something like cos (spin 0.1 time) whenever I wanted a new ship. It is "very predictable" and "not random at all" but it could seem unpredictable if it is happening on some user input.
I am using the randomness for initializing a population of entities randomly in the map (their positions) and move them along their lives randomly, so I need for each frame some kind of randomness. Currently, I am using the Random.step (that does not need the interaction of the Cmd) and passing the generated seed to the next Random.step.
I like the idea you said of using the time for getting the first random seed in order to generate different populations each time you run the "game".