My friends and I created a new demoscene production for PICO-8 — PICOCHAK. It was first presented yesterday at CAFe'2019 demoparty. It took 2nd place in Console Demo Compo.
Code: Megus
Music: n1k-o/Stardust
Graphics: Diver/Stardust
The full source code (including some tools) is available on GitHub: https://github.com/Megus/picochak


dither = {0x1000.0000,0x1000.8000,0x1000.8020,0x1000.a020,0x1000.a0a0,0x1000.a4a0,0x1000.a4a1,0x1000.a5a1,0x1000.a5a5,0x1000.e5a5,0x1000.e5b5,0x1000.f5b5,0x1000.f5f5,0x1000.fdf5,0x1000.fdf7,0x1000.fff7,0x1000.ffff,0x1000.ffff} function draw_gradient(y, cols) local ptn = 1 while y < 128 do rectfill(0, y, 127, y + 3, cols + dither[ptn]) y += 4 ptn = min(ptn + 1, 17) end end |
This is the code I use in the demo. I use "fill pattern" feature of PICO-8 and the ability to include fill pattern in color number


Thanks ! Trying it out.
Oh ... so it's not pure math ? Hmm ...
I seem to remember doing ... something ... a long time ago, a type of pyramid logo that dithered diagonally using only math and logic. Let me see if I can find it today.
Qbasic 1.0. Here it is !
'=========================================================================== ' Subject: EGA LOGO Date: 01-14-98 (23:30) ' Author: dw817 Code: QB, QBasic, PDS ' Packet: EGAVGA.ABC '=========================================================================== DEFINT A-Z DIM C(10), B(10) C(0) = 15 C(1) = 15 C(2) = 11 C(3) = 9 C(4) = 1 B(0) = 7 B(1) = 8 B(2) = 8 SCREEN 7 S = 14 N = S T = 0 LINE (159, 0)-(32, 127), 8 LINE (160, 0)-(287, 127), 8 LINE (158, 0)-(31, 127), 7 LINE (161, 0)-(288, 127), 7 FOR I = 2 TO 159 FOR J = 0 TO 127 C = C(T + (D XOR -((J + I) MOD N = 0))) IF C > 0 THEN PSET (159 - J - I, J), C PSET (160 + J + I, J), C END IF NEXT A = I / 4 B = I / 6 C = C(T) IF C > 0 THEN PSET (160, 66 - A), C PSET (160, 62 + A), C PSET (160 - A, 64), C PSET (160 + A, 64), C PSET (162 - B, 66 - B), C PSET (158 + B, 66 - B), C PSET (162 - B, 62 + B), C PSET (158 + B, 62 + B), C END IF C = B(T) IF C > 0 THEN PSET (159, 64 - A), C PSET (161, 64 - A), C PSET (159, 65 + A), C PSET (161, 65 + A), C PSET (161 + A, 63), C PSET (161 + A, 65), C PSET (159 - A, 63), C PSET (159 - A, 65), C PSET (159 + B, 64 - B), C PSET (161 + B, 64 - B), C PSET (161 + B, 64 + B), C PSET (159 + B, 64 + B), C PSET (161 - B, 64 + B), C PSET (159 - B, 64 + B), C PSET (161 - B, 64 - B), C PSET (159 - B, 64 - B), C END IF N = N + D * 2 - 1 IF N = 1 OR N = S THEN D = 1 - D: IF D = 0 THEN T = T + 1 NEXT |
Not sure if that can be made heads of or tails today. I wrote this so long ago I'm not even sure how it works now.


I'm also not getting your code to dither. Here is the code for it:
dither = {0x1000.0000,0x1000.8000,0x1000.8020,0x1000.a020,0x1000.a0a0,0x1000.a4a0,0x1000.a4a1,0x1000.a5a1,0x1000.a5a5,0x1000.e5a5,0x1000.e5b5,0x1000.f5b5,0x1000.f5f5,0x1000.fdf5,0x1000.fdf7,0x1000.fff7,0x1000.ffff,0x1000.ffff} function draw_gradient(y, cols) local ptn = 1 while y < 128 do rectfill(0, y, 127, y + 3, cols + dither[ptn]) y += 4 ptn = min(ptn + 1, 17) end end cls() draw_gradient(64,5) |


@Megus, I appreciate the code you posted, I just wish you would've checked to make sure it would work.
In any case, I learned something new:
THIS code works:
function draw_gradient(y, cols) local ptn = 1 color(cols) while y < 128 do rectfill(0, y, 127, y + 3,cols+dither[ptn]) y += 4 ptn = min(ptn + 1, 17) end end dither = {0x1000.0000,0x1000.8000,0x1000.8020,0x1000.a020,0x1000.a0a0,0x1000.a4a0,0x1000.a4a1,0x1000.a5a1,0x1000.a5a5,0x1000.e5a5,0x1000.e5b5,0x1000.f5b5,0x1000.f5f5,0x1000.fdf5,0x1000.fdf7,0x1000.fff7,0x1000.ffff,0x1000.ffff} cls() poke(24372,1)--required for -- dual color fills for i=-64,127 do draw_gradient(i,7) flip() end |
Now that dithering effect is a thing of beauty ! I just may do something interesting with it.


BTW, I made the full source code (including some tools) available on GitHub: https://github.com/Megus/picochak
I'm also going to write a "making of" blog post soon to explain the tricks I used to fit all these effects in a single PICO-8 cartridge.


You're famous ! Well ... more famous than you already are. :)


I really like not just the quality of the effects, but I really like the creative theme here. You definitely earn a star.


I wrote a post about some technical challenges I faced when creating PICOCHAK: https://megus.org/2020/05/04/making-of-picochak.html


This cart broke on version 0.2.1b. The movement of the donuts is choppy, and eventually it crashes when it tries to catch up.


It didn't crash for me instead all of the text was messed up a long side a cutsecene or two so the people who made the game were "lets conquer th" and chalk turned evil... wonder how it broke?


I think I found the issue. The code tries to draw circles of unusually large size, and that's apparently causing the lag. I added a simple condition, and it seems to have removed the lag.


Thanks for pointing that out @rnd -- I've added a clipping test for large circles in 0.2.2b so that when the clip region is contained by the circle/oval, it is (almost) free, and when the clip region is contained by a filled circle/oval it costs the same as an equivalent rectfill.
[Please log in to post a comment]