Home
Admin | Edit

Bug Off ! - TIC-80 256 bytes

link

Another 256 bytes procedural gfx dusted off for Inércia 2025 which looks like some kind of bug in a starry night with some annoying high frequency buzzing sfx. (mosquito like)

This intro is based on an earlier prototype of From below (2023) and was packed by Terser 5.20.0 + tic-tool. It use a multi layered HAKMEM 149 based fractal with some scaling bits to direct it.

Quite a lot of effort to pack this one in 256 bytes... it is JavaScript and couldn't use LUA (and thus pakettic) due to different shift behavior with floats. (required too much bytes to solve)

Most of the work was trying to make pleasant patterns for Zopfli (swapping lines, reusing constants, repeating code alot, reducing amount of unique chars etc.) and try to make the result close to the original prototype.

Had to choose between two backdrop once done, with stars or with a half moon, couldn't pack both so decided to show the starry one. Proto also had a gradient but i had to drop it.

Also wrote a small Perl script to add a 5 bytes language chunk at the end of the cart so that TIC-80 know it is JavaScript code, was smaller than a // script:js text header.

Note : Minifying sometimes change the source in a bad way for compression, had to manually convert back some constants to scientific notation, swap stuff and remove ; at the end after it was minified.

Pack / Patch CLI

tic-tool pack -k -s --iterations 3000 bugoff_js_min.tic bugoff_js_pck.tic && perl -0777 -pe 'substr($_, 250, 0) = "\x14\x01\x00\x00\x0c"' bugoff_js_pck.tic > bugoff_js_pck_patched.tic && wc -c bugoff_js_pck_patched.tic

Optimized / Minified code (426 bytes uncompressed)

cls(),e=9e7,r=-1,TIC=f=>{if(e>6e3)for(e=7,r++,x=[],p=[],f=99;f--;)x[f]=p[f]=2e9+1e2*time()*f,pix(6*f,f**f%91,-f%5);for(i=99;i--;)for(f=15;f--;)C=.5+x[f]/1e12,o=2*C+p[f]/1e10+e/1e5,x[f]+=(2e2*p[f]/e>>8)-p[f]*C,p[f]+=o*x[f]-p[f]/3e3-x[f]/6e3,x[f]+=(2e2*p[f]/e>>8)-p[f]*C,o=(f-14)*(e-14)*20/e,r&&(x[f]/=.999,p[f]/=.999,o/=45),pix(149+x[f]/8e7,p[f]/9e7+88,-o-3&15),pix(91-x[f]/8e7,p[f]/9e7+88,-o-3&15),poke(65439+i,o&11**i);e+=32}

Unminified code

// script:js
e=9e7
r=-1
cls()
//circ(43,9,9,12) // moon backdrop
//circ(46,6,9)
//SCN=d=>{ for(i=3;i--;) poke(0x3fc0+i,d/4) } // gradient backdrop
TIC=f=>{
 if (e>6e3) {
    e=7
    r++
    x=[]
    p=[]
    for (f=99;f--;) { // init + second phase
     x[f]=p[f]=2e9+1e2*time()*f
     pix(f*6,f**f%91,-f%5) // stars backdrop
    }
 }
 
 for (i=99;i--;)
  for (f=15;f--;) {
   C=.5+x[f]/1e12
   o=C*2+p[f]/1e10+e/1e5

   x[f]+=(p[f]*2e2/e>>8)-p[f]*C
   p[f]+=o*x[f]-p[f]/3e3-x[f]/6e3
   x[f]+=(p[f]*2e2/e>>8)-p[f]*C

   o=(f-14)*(e-14)*20/e
   r&&(x[f]/=.999,p[f]/=.999,o/=45) // second phase

   pix(149+x[f]/8e7,p[f]/9e7+88,-o-3&15)
   pix(91-x[f]/8e7,p[f]/9e7+88,-o-3&15)
   poke(65439+i,o&11**i) // sfx
  }
 e+=32
}

Versions

Had a lot of fun with this along the years so made several versions.

original proto, balanced so quite effective !

dense with moon backdrop

stylized

looking through a Truchet mesh

was close to 256 bytes on this one (~270 ?) but backdrop was still probably an issue

creepy version

Gremlins version

variant, quite liked this but thought it was too boring

large eyed version

From below + this mix (very early proto)

same

single eyed


back to topLicence Creative Commons