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.

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

[Please log in to post a comment]