24

Cart #picochak-0 | 2019-10-27 | Code ▽ | License: CC4-BY-NC-SA
24

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

P#69361 2019-10-27 17:02 ( Edited 2019-10-28 05:50)

:: dw817

Superb ! Star for you.

Question, how do you do that dither rectangle effect with just two colors ? Could you post code please just for that ?

P#69367 2019-10-27 19:55 ( Edited 2019-10-27 20:00)
:: Megus
 ```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

P#69371 2019-10-27 21:26 ( Edited 2019-10-27 21:27)
:: dw817

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.

P#69376 2019-10-27 23:32 ( Edited 2019-10-27 23:41)
:: dw817

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) ```
P#69377 2019-10-27 23:36
:: dw817
1

@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.

P#69385 2019-10-28 03:14 ( Edited 2019-10-28 04:52)
1

I'm... speechless...

P#69391 2019-10-28 05:02
:: Megus
1

@dw817 Yes, sorry that I forgot about that poke. I had so little sleep last days — finishing the demo, traveling to the demoparty and having fun there... :) Glad that you figured it out yourself.

P#69392 2019-10-28 05:45
:: Megus

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.

P#69393 2019-10-28 05:50
:: dw817

Must be fun where you are, @Megus. :)

Yes, this dither technique is quite interesting. I've only seen this on Pico-8 and that diagonal thing I did above years ago.

Will be experimenting with it most of today.

P#69405 2019-10-28 15:25
:: dw817
1

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

https://www.lexaloffle.com/bbs/?tid=35781

P#69415 2019-10-28 20:05 ( Edited 2019-10-29 19:59)
1

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

P#69465 2019-10-29 19:11