Bitplanes are powerful, but they can be difficult to understand. How do you use them in PICO-8?
The short version: bitplanes let you draw colors to the screen without completely overwriting the existing colors, making it possible to do effects like shadows, transparency, etc. But be warned: they come with a lot of unintuitive restrictions, like monopolizing half your screen palette or requiring it to be set up in a particular way.
Longer version: PICO-8 colors are 4-bit numbers (0-15). The screen is a 128x128 4-bit image, but you can imagine it as 4 separate 12x128 1-bit images overlaid on top of each other. By poking a particular location in memory, we can tell PICO-8 to draw to these "bit planes" separately. Normally, drawing overwrites any existing colors, but if we selectively disable some of the bitplanes, some bits of the old color will remain onscreen.
Technical version: see "Technical details" below.
This post lists some specific examples and tricks that you can do with bitplanes. I won't attempt to fully explain how bitplanes work, but I'll leave some resources at the end.
PICO-8 supports bitplane drawing; the wiki (search "bitplane") has a description of how they work:
> 0x5f5e / 24414
> Allows PICO-8 to mask out certain bits of the input source color of drawing operations, and to write to specific bitplanes in the screen (there's 4 of them since PICO-8 uses a 4BPP display). Bits 0..3 indicate which bitplanes should be set to the new color value, while bits 4..7 indicate which input color bits to keep.
> For example, poke(0x5f5e, 0b00110111)
will cause drawing operations to write to bitplanes 0, 1, and 2 only, with 0 and 1 receiving the color value bits, 2 being cleared, and 3 being unaltered.
> This formula is applied for every pixel written:
> dst_color = (dst_color & ~write_mask) | (src_color & write_mask & read_mask)
This is precise and correct, but I find it a bit hard to understand. So I made this cart to give myself an interactive sandbox where I can play around with bitplanes, to see how they affect drawing.
Title. When I set Finder to open .p8 files in pico, it opens, but pico just hangs on a black screen.
Example Video
Recreation of the JavaOS screensaver as seen in
https://youtu.be/yxV_pR1ZsXM?si=T757wSvjK0JbQaI2&t=1011
code has been made as small as possible while remaining highly performant. (3% cpu usage)
Description
This cartridge simulates orbital mechanics using Newton's law of universal gravitation. It is recommended to experiment with the settings, which can be found in the code. The planets are generated randomly, so try reloading the cart to find interesting combinations.
Camera Controls
By default, the camera will follow the average of the planets' positions, giving you a view of all the planets. Use the Z key to lock on to a specific planet, and keep pressing Z to cycle through different planets. Pressing the X key will let you move the camera manually with the arrows or WASD, and pressing it again will go back to the automatic camera.
pov youre playing a celeste mod that hasnt removed screen shake
@Infinite86 yes. yes we can.
slightly less cursed version where the current screen shake amount is added to the next and shake decreases a lot faster
! IMPORTANT !
It appears this might be a Windows specific solution, in order to launch it in the 3:1 aspect ratio it is intended for, you either have to type the following into a command line, have it in a batch file or as the target on a Windows Shortcut:
"cd C:\Program Files (x86) (*) \PICO-8\pico8.exe -displays_x 3 -displays_y 1"
(*) Part before star symbol dependent on your install location.