Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2
Story Format: SugarCube
I’ve watched Dan Cox’s youtube video on Procedural Generation in Twine: Introducing Generative Art (https://youtu.be/6InRIveRig4). And found that I can create a pattern that resembles a 2D array Dungeon Map using his example on Noise Simplex 2 by substituting the characters to 1 and 0:
<<nobr>>
<<for _i = 0; _i < 10; _i++>>
<<for _k = 0; _k < 10; _k++>>
<<if window.noise.simplex2(_i, _k) < 0>>
"""0"""
<<else>>
"""1"""
<</if>>
<</for>>
<br>
<</for>>
<</nobr>>
The code for the story JavaScript can be found here: https://github.com/josephg/noisejs
Here is the output:
Can I somehow get this output and substitute this to an array variable?
<<set $mapArray to
[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,1,1,0,0,0,1,1,1,1,0,0,0,0,0],
[1,0,0,1,0,1,1,1,1,1,0,0,0,0,0],
[1,1,1,1,0,1,0,0,1,1,0,0,1,1,0],
[0,1,1,0,0,1,0,0,1,0,0,0,1,1,0],
[0,1,0,1,0,1,0,0,1,0,0,0,1,1,0],
[0,1,1,1,1,1,0,0,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]>>