Log In  

BBS > Superblog
Posts: All | Following    GIFs: All | Postcarts    Off-site: Accounts

Here's a fun little project. By "fun" I mean "nightmarish" and by "little" I mean "countless hours of headaches".

Let's network a Pico-8 cart.

This operation involves careful controlled management of the game state and manipulating the player controls with a wrapper. If we're using an HTML5 build, we can already manipulate the player inputs with JavaScript trivially enough -- there's an API explicitly for that one purpose. It also doesn't sound too hard to pause the game whenever controls haven't been received, although keeping a frame-perfect lockstep sync might be a hassle in itself.

But the BEST networking would involve allowing the local game to run a few frames ahead of the networked player and carefully revert and re-run those frames whenever changes in input are received, so that the game still runs full speed and remains synchronized with just a little bit of reality-bending when there's latency. This requires a deep, deep control over the entire game state, and the ability to run the game (without rendering) much faster than it's intended to go.

Fun.

Maybe I'll try it sometime. The license explicitly states I'm allowed to alter and use HTML5 cartridges for any purpose. If I can't hack around that, maybe I can make my own Pico-8 emulator that runs off of the .p8 text format files... although that seemingly falls into the legal grey area of the license a bit, since it would technically require fabricating a 16 color palette and sound waveforms similar enough that they could be considered a derivative work or some such, ... unless I read the same data out of a JavaScript file generated by the HTML5 exporter...? Gah.

That's enough rambling for now. This post is just a reminder for fun things to try whenever I'm bored next.

6
17 comments


Lua has a peculiar block syntax for multi-line strings. It looks like this:

game_backstory = [[
Once upon a time,
the wind was blowing,
kicking the sea up,
nice and wavy.

The tide swept in,
a darkness came,
and everyone drowned
in sweet gravy.
]]

Unfortunately, this makes Pico-8's code editor freak out and try to parse the entire string as individual numbers and words and stuff, grossly aggravating the token count. Plus I can't type \n in the pico-8 editor, despite the character being available in the font.

I'm already using both, since \n makes a great delimiter for writing human-readable data.

Cart #16085 | 2015-11-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

There was also a multi-line comment syntax based on it, where you could write

--[[
comments on
multiple lines
]]

[ Continue Reading.. ]

1
4 comments


IMO instead of single license checkbox, you should be able to select by mutliple checkboxes the kind of CC license you want for your game.

So, by default it'd be CC0, but then you could check each part of CC license, so you can have any combination of by nc sa nd.

1 comment


Sometimes, especially when working with animations, I prefer using GraphicsGale than Pico's internal editor. So I'd be glad if I could copy/paste sprites to/from standard image editing programs. As of how palette thing would work when pasting, if pixel is "unknown" (not in pico's palette), color with closest r/g/b values from palette would be used.

So e.g. if I have some pixels that are totally blue (#00FF00), when pasting those pixels will be changed to closest color in pico's palette which is 1 (I think) in this case.

Alternatively import/export of spritesheet from/to png file would be welcome, with same color conversion process when importing as when proposed pasting.

9 comments


Let's say I have a cartridge that changes game states by swapping out the _update and _draw functions. This way, when I'm at the title screen, the title screen's _draw function is called directly, as it is stored in the global variable named "_draw", and when I switch to the in-game state, the level drawing function moves to "_draw" instead. This reduces logic (and therefore saves precious characters / tokens) since you no longer need to call the function yourself based on what gamestate you're in.

Now, one of those game states is transitional. It doesn't need an _update or _draw function. It exists entirely as an _init function that draws and flips itself for a bit, then changes the gamestate to something else. But since Pico-8 knows that there was an "_update" function before, it still remembers that and tries to call it...

... Which crashes the program script with a Lua error saying that it failed to call _update on a line beyond the end of the program. Fun! :D

I can of course work around this just fine. In fact, with a full implementation I'm sure this problem wouldn't even exist, since flip() would presumably skip the _update and _draw calls until it's done. But this is still a thing worth noting... somewhere. Probably. ^^;

Test cart:

[ Continue Reading.. ]

0 comments


The "Read Me" shortcut the installer puts on the Start menu points to "pico8.txt" (It should point to "pico-8.txt")

Very minor. Easy fix.

0 comments


Like explode() in PHP, nothing fancy, just taking a string and convert it into an array based on delimiter, so e.g. I can have following string: "303;12;18;6;23;45;10;66" and after doing:

array = explode("303;12;18;6;23;45;10;66",";")

Array will be {303,12,18,6,23,45,10,66}.

Reason is of course token space and I want to encode maps this way for my contra cart.

0 comments


You can use the (invisible) mouse to click the (invisible) editor mode buttons while you're still in Pico-8's command prompt, even though you can't see them, switching to an editor that way instead of hitting Esc.

The mouse is probably intended to be ignored in this state, making this a bug, right?

1
3 comments


I heard of Pico-8 on the Indie retro news blog, and loved the idea. I quickly purchased the "soft hardware" implementation, and I love it. What a great community, and what a great idea.
I love the restrictions ... except for one!
I feel that the cartridge limit is restrictive. I mean, I know it's "meant" to be restrictive, and I appreciate that it forces a certain kind of game - or at least a certain way of thinking about games - HOWEVER I also feel that the resolution and interface restrictions control the type of software developed beautifully.
With more "RAM" (or is it ROM if we're talking about a cartridge? Soft ROM :)?) we could see some amazing games with great depth catering to the display hardware restrictions.
If simply allowing any size cartridge is out of the question, what about considering several "categories", so we could have 64, 128, and 256k cartridge categories, for instance?

ps
None of this is any kind of negative or "I know better than thou". I love what you have created!

Cheers,

Rob

50 comments


I wrote a new tool that turns carts upside down.

% ./p8upsidedown jelpi.p8.png

Cart #16098 | 2015-11-02 | Code ▽ | Embed ▽ | No License
1

The tool is built with the picotool library (discussion). This version of the tool inverts the sprites, inverts the map, and translates the code to use inverted coordinates for drawing functions.

This is meant as a hack/demo and is known not to work with every cart. It works with many carts, and some of the failures are interesting. Notably:

  • The code translation increases the token count, so large carts (Celeste, Dusk Child) can't be turned upside down.

  • This version doesn't support spr/sspr calls that draw a rectangle of tiles. This wouldn't be too difficult to support: it'd need to flip the entire spritesheet not just individual sprites, translate the sprite IDs in the map, and extend the code to rewrite sprite ID args. But I have other things to do this weekend. :)

  • The print function will always print left to right, so we compromise and merely relocate the y coordinate for print / cursor calls. There's nothing the tool can do with carts that call multiple coordinate-less prints.

  • I wrote this to exercise and demonstrate the picotool libraries for mutating Lua code via the AST. The lib doesn't know how to write out an arbitrary AST and preserve other comments/spaces, so p8upsidedown generates hideous code. Unfortunately the luafmt writer isn't entirely up to snuff either so it's not much help. This is mostly not an issue to Pico-8, though I did find a bug where Pico-8's special "t += val" syntax rejects a newline between the "+=" and the "val", which p8upsidedown might accidentally introduce.

Anyway, a fun weekend hack with picotool. Enjoy!

-- Dan

1
4 comments


When I load a cart that has too many tokens, the "run" command fails correctly, saying "Program Too Large, xxx / 8192 tokens". Unfortunately all other commands fail in the same way in this condition, including "reboot", "ls", and "load". As a workaround, I can go into the editor, delete enough code to reduce the token count below the limit, then I can perform commands. Filesystem commands should just be allowed in this case.

1 comment


Cart #16375 | 2015-11-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

(old tag: 16090)

I thought I wanted to make a game about launching missiles, but then I thought about it some more. All I really wanted was to make a game about moving an unwieldy cursor over a radar screen and pressing a button to do something.

So here we have SUPPLYDROP, in which you control a crosshair over a busy radar screen. Distant and imperilled groups of people have pooled their scant resources to send a distress signal, in the hope of reaching you and calling down desperately-needed supplies. You can help them, but their signals are terribly brief. Moreover, you only have ten supply drops to use. One supply drop can feed many people, but do you want to hold it back, in hopes of two beacons near each other? Or will you respond immediately to each call?

Watch for the signal beacons (orange squares). Move the crosshair with the arrow keys and use Z to place supplies near or on them to help those people. At the end of the game, you'll see your score and how many groups you saved. Any groups you missed will lower your score.

(Press Z on the score screen to restart.)

I had a lot of fun making this one over the last few days. I hope you enjoy playing it!

2
5 comments


I would like to learn how to reproduce the famous sinus scroller text effect, but i can't make it to work.

Can someone explain the idea behind this ? I don't want the code (i want to find it myself), i just want to understand how to approach this.

I've created a table with a cell for each letter of my text, now i need to print and move each later to the left in a sinus pattern, but i can't figured out :

cls()
table={1,2,3,4,5,6}
x=127

function _update()
end

function _draw()

for i=1,6 do
print(table[i],127-i*10,cos(i*3/12)*20+60)
end

end

With this i have a sinus with my text, but it's not moving in real time, and it's in reverse mode. At some point i need to erase each letter from their previous position ? How to erase only one printed letter ? Print the same letter at the same position with transparent color ? Maybe sprite are better for this because they are easiest to move ?

2
5 comments


Hi,
I won the LiveCode Create it Competition Round 1 (last wednesday). So, I'm in for the round 2 (Feb 2016).
I will have to share my time between LiveCode and Pico (and my daily job because we have to fill the fridge).
It would be nice if one of you (no more) helps me for the LudumDare October Challenge 2015 : I need $1 on http://jihem.itch.io/bld. I can do the same (so if you're making the challenge too, I can validate it)
Regards,
jihem

0 comments


Cart #16069 | 2015-11-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

Extremely limited (hacked-together) work in progress:

Explore a room!
Listen to some (unfinished) music!
Feast your eyes on a colour! (two, if you count black)

(the piano was playable - two chords - but i've switched it off so the music plays through)

7
8 comments




Note: Model K. doesn't block bullets

1
5 comments


I had thirty bucks to blow, so I got a Game Gear (No picture, due to my phone sucking).

I know this is unrelated to PICO-8, but this thing is amazing!
Came with Sonic the Hedgehog 2, which is a BLAST (see what I did there?).

Sorry to waste your time, I just wanted to tell you guys.

1
1 comment


Cart #16052 | 2015-10-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Ratio.

1
0 comments


Cart #16045 | 2015-10-31 | Code ▽ | Embed ▽ | No License
21

Minesweeper! Features multiple difficulty levels and amazing sound effects. Released under the zlib/libpng license.

Arrows transport cursor and navigate menu
Z reveal tiles or activate menu options, menu opened when tiles not revealed
X flag tiles for knowledge

21
13 comments


I have dual monitors setup to my really old laptop. I'm running windows8.

I'd like to use my external monitor for pico8 without having to redistribute through windows which monitor is #1.

Does anyone know what I can do to 'force' pico8 to fullscreen on monitor 2? It doesn't seem to care what desktop it's on when maximized like most programs. Voxatron has same issue.

I don't think this is necessarily a Pico8 issue and is more of a windows issue, but I thought I'd ask here in case other people found a solution to this.

0 comments




Top    Load More Posts ->