Log In  
Follow
BoneVolt
Follow

As stated in the title, you can now use up to 32 colors at the same time in pico-8 now.

The feature was revealed by Zep in this thread: https://www.lexaloffle.com/bbs/?tid=38555

This makes all the suggestions I gave in that thread possible and more.

You can't simply use all colors all over the screen though. You have 2 screen palettes and you basically have to select which palette you will use on each drawn line on the screen. In the gif above, the screen is divided into 2 halves, each with its own palette.

Palette Scanlines

Here is the code I used for both screen palettes:

--regular screen palette
pal((
{
[0]=128+9,9,1,128+12,
13,12,6,7,
8+(curr_shield==6 and 128 or 0),2,128+10,128+11,
128+15,10,4,15}),1)

--values 0x10 and 0x30 to 0x3f change the effect
 poke(0x5f5f,0x10)
--new colors on the affected line
 pal({[0]=2,0x8d,1,0x81,0x8d,0x8c,0x86,0x87,0x88,0x81,3,0x83,0x86,0x8a,0x82,0x87},2)
--0x5f70 to 0x5f7f are the 16 sections of the screen
--0xff is the bitfield of which of the 16 line of the section are affected
 memset(0x5f79,0xff,7)

The first pal() is to set the game's screen palette. Nothing new here.

poke(0x5f2c,0x40) enables the 2nd palette. This is the same address that changes screen modes (rotated, stretched, mirrored). You can add these effects as usual, so 0xc5 (0x40+133) will rotate the screen and enable the 2nd palette. See the wiki for all effects. This poke is no longer needed after update 0.2.1.

Pal([table],2) changes the secondary palette. The second parameter defines the target palette (0 for draw, 1 for display, 2 for secondary). You can change colors individually with pal(c1,c2,2) as usual too. You can also access it by peeking/poking addresses 0x5f60 to 0x5f6f.

The memset at the end is a bit more complicated: each address from 0x5f70 to 0x5f7f is a section of the screen. 0x5f70 is the first 8 lines, 0x5f71 is the next 8, etc, all the way to the bottom, 0x5f7f. The value you insert in the address is a bitfield for the 8 lines of that section. 0b1 will affect the first line, 0b11 will affect the fist two lines, 0b1010101 will intercalate the lines between the two palettes, and 0b11111111 (or 0xff) will change all lines in the section.

With this, you can select either palette for all lines on the screen. But what if you want to use columns instead of horizontal lines? poke(0x5f2c,133) will rotate the screen, so if you rotate the sprites back to compensate the screen rotation you can have something like this:

Each character has their own palette!

CRT effect, using the same principles! memset(0x5f70,0xaa,16) alternates lines!

Gradient Fill

If you poke(0x5f5f,n) with values between 0x30 and 0x3f, you'll have a different effect. The color corresponding to the last digit of the address will be swapped for a gradient of colors. Each of the 16 sections will be swapped for a different color (pokes 0x5f60 to 0x5f6f). An example will make it clearer:

Here the black background of the game was swapped for a gradient of the 16 basic colors, using the code below:

poke(0x5f5f,0x30)
for i=0,15 do
 poke(0x5f60+i,i)
end

So what does the 0x5f70 address do in this mode? Now each bit determines if that particular line will use the corresponding 0x5f6n color or 0x5f6n+1. Adding the code below will produce the following effect:

memset(0x5f70,0xaa,16)

This might seem a bit unimpressive at first, but remember that you are free to use any of the 32 colors in this gradient, not only the ones you're using currently on the screen. This can be used to add colors to a platformer background or background effects in a shmup for instance. Here is a quick example:

If you look closely the game uses all 15 colors in the foreground and UI except for color #12 (light blue). The light blue is used for the gradient, using the regular colors 0, 1, 12, 6 and 7 and also 0x81 and 0x8c from the alternate palette (18 total colors). Here's another example using 21 colors:

Here is the code for this gradient. Just swap the colors for whatever you like :)

--swap 0x30 for 0x3n where n is the color that will be swapped for the gradient
poke(0x5f5f,0x30)
--put the gradient colors in the table below:
pal({[0]=0x82,0x82,0x84,0x84,4,4,0x89,0x89,0x8e,0x8e,0x8f,0x8f,15,15,0x87,0x87},2)
--blend lines
memset(0x5f70,0xaa,16)

That's all I have for now. Have fun!

P#78518 2020-06-25 22:17 ( Edited 2020-08-11 13:00)

The first paragraphs are just some opening thoughts to contextualize where I'm coming from with this idea. If you are not interested in that, skip to [Suggestion].

Context

When the 2nd palette was first discovered, increasing the total number of colors on the screen has been suggested a number of times. That in itself is a pretty weak idea: bumping up pico-8's limitations is against its whole purpose of self-imposed limitations. If you want more colors, just use any other platform. End of story.

But recently, with the 0.2.0x versions, a lot of new features have been added that expand what pico-8 is capable of: better code compression, tline, the upcoming oval(), new chars (kana, puny). Tline in particular changes the whole feel of the carts that use it, with the possibility of mode7, rotation, map lighting, etc. While those effects were previously possible, the games that had them would pay a high cost in CPU and tokens.

Ever since the 2nd palette came, I had some ideas of how the color limit could be increased without going against pico-8's design principles. From these ideas, I selected my favorite and arguably the one that fits pico-8 the best. With pico-8 going beta and possibly its core being set, this might be my last opportunity of sharing it, so here it is:

Suggestion

  • Change the [p] parameter in pal(tbl,[p]) to a integer value between 0 and 128. The [p] value is the first scanline that uses the new palette;

  • This would effectively increase the possible uses of the function from 2 (draw palette and screen palette) to 3 (draw palette, screen palette, and mid-screen palette);

  • If [p] is 0, you change the draw palette as usual. Likewise if [p] is 1, the first line is changed to the new palette, all the way to the last line. No changes here. If [p] is above 1 it means the first scanline of this palette is not at the top of the screen, so it will change the screen palette from that line onwards;

  • Using [p>1] more than once per flip will replace the last mid-screen palette. In the code below, only the [64] value would take effect:
function _draw()
 pal({129,130,131},32) --changes the mid-screen palette for y>=32

 pal({132,2,0},64) --overwrites the pal() above so only this one takes effect when the screen is drawn
end

Uses

In alignment with pico-8's philosophy, this would allow new things to be done, but also create new challenges to overcome and breed creativity through its limitations. Here are some examples:

Water palette

Pal-swap the lower half for some water effects, like in some 16-bit games. It could also be used for water reflection.

Split-Screen

In a game with split-screen, changing the screen palette would affect the other player's half-screen. This new feature would prevent that.

Fighting game character select/VS screen

Poke(0x5f2c,0x85) rotates the screen, so instead of top/down palettes, it's left/right. With that, you can have nice 15-color palettes for each character in a VS screen, with the black background hiding the transition between palettes. More juice could be added to each side with their respective palettes (character's names, country flags or whatever else).

UI

Kind of a crude example, since this game was not intended for that, but you could have some different colors for UI if it has a more clear separation from the game area, like it's common in RTSs and some point-and-click games (the red arrow indicates the transition line).

Custom Tools

In my custom tool, Painto-8, the entire screen changes when you open the palette selection. This feature could help to circumvent that, making it less jarring.

Mode 7

In games that use mode7-like effects, you can have 1 palette above the horizon (for the sky and UI) and another below (ground, characters and objects).

Anyways, you get the idea. It really creates a new layer of cool things to explore while mostly keeping the same restrictions. I think it fits pico-8 well... Who knows :)

P#78471 2020-06-24 23:45

A few days ago someone on my discord server asked me how to configure keys in an exported cart and I didn't figure out how to do it, nor did I find any information about it anywhere...

So I assume there's no way to do it right now...?

Just letting the player access the Keyconfig screen from the controls screen would be great.

And saving the config after each session :)

I think it's something that can easily affect user reviews in external sites, Itch.io, Kongregate, and so on, and also help with accessibility.

P#78469 2020-06-24 18:20

Cart #cloud_outline-0 | 2020-02-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

I created this cart to show a way to make the outline() function affect many objects (in this case the circles) at once instead of outlining each one individually.

Some people got interested in how it works, so I'm sharing it here to show the code behind it.

The bottom one uses just 3 more tokens than the top one.

P#73320 2020-02-21 19:00

Cart #transparent_lines-0 | 2020-02-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

This is a test for the purpose of using poke() bytes vertically as a way to draw transparent lines more efficiently.

Before version 1.12d you could only use pget/pset to draw a vertical transparent line, while now you can use poke(0x5f2c,135) to draw bytes vertically.

While the effect is the same, the CPU usage difference is pretty significant :)

This could be used for transparent rain effects for example.

Keep in mind that poke(0x5f2c,135) only works in the bbs right now.

P#73181 2020-02-17 19:22 ( Edited 2020-02-18 12:20)

Cart #christmas_rpg_doodle-0 | 2019-12-23 | Code ▽ | Embed ▽ | No License
6

This is not a game, just an animation that looks like a Christmas-themed RGP.

Maybe it will turn into a proper game someday.

Merry Christmas pico people! And a new year full of happiness and accomplishments for you and your family!
<br>
Twitter | Itch.io | Discord | Youtube

P#71333 2019-12-23 01:21

Cart #rainbow_tunnel-0 | 2019-11-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

This is my first TweetTweetCart (558 chars of code)! Made for TweetTweetJam 3!

<> to move
Z to jump

My best score is 560
Itch page: Rainbow Tunnel

Have fun!

P#69989 2019-11-17 21:19 ( Edited 2019-11-19 13:39)

Cart #ball_effects-0 | 2019-10-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
16

Made this cart to test some distortion effects for future projects.

A lot of people got interested in a tweet I made with it so I'm posting here in case anyone wants to see the code or use it on a project.

Move with the mouse;
Z/X (O/X) to change size;
Left mouse click to switch effect.

P#68876 2019-10-14 17:29 ( Edited 2019-11-19 13:43)

Cart #painto8-1 | 2020-06-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
29

--Version 02--

  • Right-click on any color on the palette to open a menu with the 2 palettes. Swap between them with the tab on top.

  • This version has poke(0x5f2e,1), so you can run the cart just when changing palette or drawing on the map area, otherwise, press ESC to resume to drawing on pico-8's sprite editor. (SHIFT+S to save changes so you don't lose what you've drawn while running the cart. Also saves the palette).

  • Suggested use: Save a backup painto-8 blank cart, and create a new file copy for each new sprite sheet you draw. For example I saved painto-meteor-joe.p8 and painto-sonic.p8 for the sheets below.

  • Remember to change cartdata("bonevolt_painto-8") for each cart, otherwise all painto-8 carts will load the same palette.



Older version

Cart #painto8-0 | 2019-09-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
29

I recently discovered the 16 extra colors, and since it's not very fun to go back and forth between sprites/code/game just to test colors, I made this cart so you can actually draw sprites with the extra colors directly!

Main features

  • Swap between tabs PAL1/PAL2 to select which colors will compose the 16 colors of your sprites:

  • Select the index on the right and the color on the left. "OK" means your palette already has that color. "▤" Means that index is using a color from the pal1 when you're viewing pal2 and vice-versa.

  • Your pallete is saved between sessions (poke 0x5e00~f).

Standard pico-8 features

  • Draw
  • Zoom in/out with mouse wheel
  • Save by pressing SHIFT+S or via the pause menu
  • Pick colors with right mouse button on the sprite

Extra features

  • 2 extra sprite tabs, because why not! (will draw on the map region: 0x2000-0x2fff)

P#67210 2019-09-04 04:10 ( Edited 2020-06-24 19:20)

Hello everyone, today I stumbled on a undocumented feature I didn't know existed: 16 extra colors.!

I searched on the wiki and the forums and I didn't see it mentioned anywhere (except this thread, but it was a differnt thing and that feature was removed by zep at that time).

If you change the screen palette via poke (0x5f10 to 0x5f1f) to a value above 0x80, the color will change as shown below:

Here's world 2 of Jack of Spades with all colors swapped, except black and yellow:

Original colors for comparison:

You can't have more than 16 colors in a single frame though, since poking (0x5f00 to 0x5f0f) will just make the color transparent, as documented in the wiki. Still it's good for fades, and can be used for someting like stage-specific palettes like in the NES and other old consoles.

Pretty cool!

P#67208 2019-09-04 02:59

Cart #jokenpico-0 | 2019-07-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Jokenpico is Jokenpo with a twist with code that fits in a tweet!

It is a 2-player game.

Controls:
RIGHT is rock
LEFT is paper
UP is scissors

The diffence from regular jokenpo is the score:

If Scissors wins: +4 points
If Rock wins: +2 points
If Paper wins: +1 points

At a first glance scissors seems overpowered with 4 points, but it wins against paper (1 point), so it is less likely that your opponent will use paper.

(an easy way to remember each score is: scissors cuts paper into 4 pieces, rock smashes scissors into two halves and paper wraps stone into one ball)

P#65949 2019-07-19 20:31 ( Edited 2019-11-19 13:45)

Cart #whereswilly-2 | 2019-07-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

This is my first tweetcart! Use the mouse to find the red 웃! Inspired by Where's Wally/Waldo!

Each time you hit Willy with the cursor the difficulty (number of characters drawn) and initial score will increase value by 120.

Can you get to 1000 points? :D

Obs: Cart exceeds 280 chars by 3 to have more variety on things being drawn

P#65491 2019-07-01 02:16 ( Edited 2019-07-01 04:04)

Cart #jostitle-6 | 2019-09-20 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
43

Jack of Spades is a game I made as a submission for GitHub's GameOff game Jam.

This is the latest version, with a lot more content than it had in the jam. I ended up making it a multicart, because I couldn't manage to keep it under the token/compression limits.

The game autosaves, you can play it on multiple sessions. It is played just with the mouse, so you can easily play on phones too.

There's an executable version here: https://bonevolt.itch.io/jackofspades

To play on your PICO-8 app download this version (put them all on your "..\pico-8\carts\" folder and open "jostitle.p8")

This is how to equip items (not explained during gameplay):

But you have to get the items first!

P#65294 2019-06-19 21:20 ( Edited 2020-07-07 12:56)

Follow Lexaloffle:        
Generated 2020-08-14 02:57 | 0.128s | 2097k | Q:152