Log In  

I've made an algorithm that allows you to store 4 1-bit sprites in the space of a normal pico-8 sprite.
This version uses up the cpu a lot less compared to the previous which used pset().
It could be a little hard to use so there's some help on the bottom of this page.
Special thanks to Heracleum#1208 on discord for helping with the code.

Cart #onebitspritesalgorithm-3 | 2022-07-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4


Documentation:
Use 4x more sprite memory if your sprites are 1-bit
16 colors / 2 colors
1 sprite / 4 sprites
256 sprites / 1024 sprites
To draw your sprites, you'll have to use specific colors
Each color marks different sprites from 1-4, some of them mark more at once:
Pixel color in spritesheet/which sprites will be marked by color in that spot
0/none
1/1
2/2
3/3
4/4
5/1,2
6/1,3
7/1,4
8/2,3
9/2,4
10/3,4
11/2,3,4
12/1,3,4
13/1,2,4
14/1,2,3
15/1,2,3,4

P#109460 2022-03-31 09:17 ( Edited 2022-07-01 09:00)

1

As discussed in Discord, I liked @Laz's idea and I love 8-bit monochrome gfx (good old ZXSpectrum/C=64 days), pretty sure I'll use this soon for big titles, intro/splash screen etc...
So here's my implementation on the 1spr=4monochrome spr idea.
Other than the demo code, the cart contains 2 main functions: PXPACK and MONOSPR

  • PXPACK to pick 4 tiles from the current spritesheet, pack them into one and copy GFX data to Clipboard (so you can paste it in your other game cart)
  • MONOSPR to actually draw one of the 4 tiles as monochrome sprite 8x8, in the specified colour and optionally a background color (otherwise it will be transparent)
    Read more details in the function descriptions

Cart #monopacker-0 | 2022-07-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Note: it uses a different mapping than Laz's table; to avoid a conversion table, it simply uses a bitmask where colour 1=1, 1=2, 3=4, 4=8, plain Binary, so it relies on the bitwise OR "|" operator to pack the values for you.

I know peeps would think "well there's PX9 and it keeps all 16 colours" but it's a different concept here. You could REUSE some tiles several times to even fill the entire screen and have the basic spritesheet only occupy a few tiles.
The intent here is to take advantage of single monochrome tiles to have graphics like this (also with the help of 8bit drawing sw like Multipaint):
zx

P#113904 2022-07-02 17:30 ( Edited 2022-07-02 18:07)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 00:50:07 | 0.043s | Q:24