I'd like to use a retro-styled NES USB controller with PICO-8 on Windows & Mac (and Raspberry Pi, eventually). The ones I've found so far on Amazon all have terrible reviews, though. Any recommendations for a good USB retro controller?
Click with the mouse to drop the ball. Physics test doodle for a pinball game.
This is my PICO-1k jam entry. The entire source code is 1024 characters in PICO-8, including the comment at the top. Arrows to fly, button (z on keyboard) to fire.
--top*burn a=48n=32k=64_={}camera(-k,-k)c=16x=0y=0t=0o=0g=0q,b,r,s,h=sqrt,btn,rnd,spr,sspr::a::l=t%8/4map(0,0,-k,-k,c,c)for j=3,k do z=j/4h(q(q(z))*c-l,1,k+k,1,-j*n,j,k*4*z,1)end l=l<1o=max(o-1,0)f=b(4)and o<n if f then m(r(3))o+=2 if(o>n)o=98 end i=l and o>n and s(124,-k,-40,4,1)or h(0,56,min(o,n),6,-k,-a),l and t>650or h(a,n,n-t/n,8,n,-a) i=b(1)p=24m=sfx if(i and x<c)x+=2 p=c if(b(0)and-k<x)x-=2 p=c if(b(2)and y<n)y+=1 p=k if(b(3)and-n<y)y-=1 p=74 s(86,x+8,a,4,2) for e in all(_)do e.x+=e.d e.z+=.1 j=e.d<0w=88z=4/e.z if(e.l==0or e.z>k)del(_,e) if(e.l)e.l-=1 j=r(2)>1goto e h(56,k,c,c,e.x*z+24*z,a*z,c*z,c*z,j)w=k if(f and max(abs(u/z-e.x-21),abs(v/z-e.y-8))<8)e.l=8m(3)g+=.75 ::e::h(0,w,56,24,e.x*z,e.y*z,56*z,24*z,j)end if(r(98)<1)d=sgn(r(2)-1)add(_,{x=r(n)-d*k-c,d=d,y=r(k)-a,z=1}) z=.7u=x*z+13v=y*z-8s(2,u,v) if(f and l)s(c,u*.9,v*z)s(17,u,y*z-5)z+=.1 s(38,x*z+10,y*z-2,2,1)z+=.1 s(46,x*z+14,y*z+1,2,1) s(p,x,y,6,3,i)s(240,-30,-41,g,1)flip()t+=1 if(t<999)goto a ::g::s(137+t%2*k,t%192-140,-n,7,1)flip()t+=1 goto g |
PICO-8 allows 65536 characters, which on one hand is a tight limit for some projects. But, on the other hand, we've seen amazing things from Tweet jam in 140 characters or fewer.
That made me wonder...can a whole PICO-8 game be written in 1024 characters (1k)? There are some impressive JavaScript 1k demos. Let's see what we can do!
Rules:
- Entire program source code lists as 1024 characters or fewer inside PICO-8, including comments.
- Must be a playable game, not just an animation.
- No limits on music, sprites, or map, since they don't count toward PICO-8's character limit.
This entire cart is 243 characters (plus six sprites). The code is just:
k,f,q,b=64,0,sqrt,btn x,y=k,k::a::cls(12)for j=3,k do s=j/4 sspr(q(q(s))*16-f%8/4,1,k+k,1,k-j*32,k+j,k*4*s,1)end r=b(1)p=22 if(r)x+=2,p=16 if(b(0))x-=2,p=16 if(b(2))y+=1,p=k if(b(3))y-=1,p=70 spr(28,x+8,99,4,2)spr(p,x,y,6,3,r)flip()f+=1 goto a |
It was a successful attempt to code the basics of a game in two tweets. There's actually enough room to clamp x and y to the screen. I hope someone will use this as a starter to make a real game.
Here's the whole thing:
k,i,q=64,0,sqrt cls(1)memset(i,223,k)::a::for y=3,k do s=y/4 sspr(q(q(s))*16-i%8/4,0,k+k,1,k-y*32,k+y,k*4*s,1) end i+=1 flip()goto a |
Leverages memset for the checkerboard, piggybacking off some code for the background rendering in my upcoming PLAT4MER cart.
The bottom part is the waterfall demo and some generic particle emitter code.
You can save a few more cycles if you hardcode the gravity constant. Otherwise I believe that this is close to optimal.
More information at my github
I wrote Brick Breaker as a full-featured, polished PICO-8 sample program. It was an opportunity for me to learn the PICO-8 Lua variant and now stands as a good example program for other programmers new to PICO-8.
It demonstrates (commented) use of:
- loops
- create & destroy objects
- local vars
- text
- multiple levels
- sprite animation
- powerups
- particles
- map usage
- title screen & game over
- sound effects
- music
- sprite packing
- basic physics
- assertions
as well as some techniques for reducing token count, a limited resource on PICO-8.
I did most of this work in parallel with the 2017 Global Game Jam. The PICO-8 version of Brick Breaker is based on my JavaScript Brick Breaker sample program, which you can play here.