Use the Perlin noise on PICO-8 (PICO-8でパーリンノイズ)
I tried to implement the Perlin noise on PICO-8.
試しにPICO-8でパーリンノイズの実装をしてみました。
PICO-8 uses the fixed point number, so I slightly changed the algorithm to use bit operations and tables. But it's still slow on PICO-8 virtual machine.
PICO-8は固定小数を使っているので、元のアルゴリズムをビット演算とテーブルを使うように少し修正してみましたが、PICO-8の仮想マシン上だとまだ遅い感じです。
Perlin noise for PICO-8 (PICO-8版パーリンノイズ)
Here's the link to the Perlin noise library for PICO-8:
PICO-8用パーリンノイズライブラリへのリンクはこちらです。
Sample code (サンプル)
The following is the sample code with the Perlin noise:
以下、サンプルコードです。
function _init() t=0 cls() end function _update() t=t+0.05 end function _draw() local x,y,v,r,c for i=1,500 do x=rnd(128) y=rnd(128) v=noise(x/20,y/20+t,t) if v>0.2 then r=1 c=10 elseif v>0.05 then r=2 c=9 elseif v>-0.2 then r=2 c=8 else r=2 c=0 end circfill(x,y,r,c) end end
Result (実行結果)
The result is this:
実行結果はこちら。
I wonder what is the best way to use the Perlin noise on PICO-8.
PICO-8でパーリンノイズのいい使い方って何でしょうね。
(日英併記、構成難しい…)