A terrain generator and globe visualizer in just 1023 characters of Pico-8, created for the 2023 PICO-1k jam.

Keyboard control: ❎ button is 'x' / 🅾️ button is 'z'

Source:

h=true cls()::s::w,o,r,l,u,d=128,128,{[0]=7},34,30,60repeat for x=o,w,o*2 do for y=o,w,o*2 do a=0 for i=-1,1,2 do for j=-1,1,2 do a+=r[(x+i*o)%w+w*((y+j*o)%128)] end end r[x+w*y]=min(max(a\4+3-rnd(6),1),14) end end p=false for y=0,w,o do for x=p and 0 or o,w,o*2 do a=0for j in all({{0,1},{-1,0},{1,0},{0,-1}}) do a+=r[(x+j[1]*o)%w+w*((y+j[2]*o)%128)] end r[x+w*y]=min(max(a\4+3- rnd(6),1),14)end p=not p end o/=2until o<1function g(x,y)return (p[flr(r[x+128*y])] or 0)+(w/2*sin(x/w+(t()+6)/14)+w/2<y and 7 or 0) end p={1,1,1,1,1,2,3,4,4,4,5,5,6,7} pal({[0]=0,1,12,9,11,3,6,7,129,129,4,3,13,5,6},1) n=0::_::if h then for x=(n%3),w,2 do for y=(n%2),w,2 do pset(x,y,g(x,y)) end end else for x=0,d do c=x*2/d-1 for y=(n%2),d,2 do b=y*2/d-1 z=b*b if c*c+z>1 then goto q end m=c/sqrt(1-z) pset(x+l,y+u,g(ceil(n+(m+m*m*m/6+1)*32)%w,ceil((b+b*z/6+1.1)*48)%w))::q::end end end n+=1 if btnp(5) then cls()h=not h end ?" press ❎ to see "..(h and "globe" or "map").."\npress 🅾️ for new planet",18,110,7

if(btn(4)) goto s

flip()goto _

Download

Download
pico_planet_linux.zip 737 kB
Download
pico_planet_osx.zip 3.2 MB
Download
pico_planet_windows.zip 977 kB

Comments

Log in with itch.io to leave a comment.

Very nice. :)