News for hackers. Stuff that matters.
Re:Snake in a QR Code by skrebbel on Friday September 04, 2020 @10:25AM (#24375184)
If you want to see a variation of this concept in the wild, in active use by lots of people, check out PICO-8 cartidges.

PICO-8 is a virtual game console. I.e. it's an emulator for an oldschool game console that doesn't exist in reality. It's designed to be easy to code for while maintaining the limits and aesthetics of old game computers

PICO-8 games are, of course, distributed on cartridges. However because it's a virtual console, the cartridges are virtual too: they're PNG files.

Try browsing PICO-8 games here: https://www.lexaloffle.com/bbs/?sub=2&cat=7

Press the play button the play a game right inside the web browser, but be sure to click the little "Cart" link right below the playing area to see what's going on. You'll see it open a little PNG file.

That PNG file is the cartridge. It contains the entire game.

The file format is explained here: https://pico-8.fandom.com/wiki/P8PNGFileFormat. Obviously, because PICO-8 carts are purely digital, the format doesn't need any of the contrast, the error correction features or the orientation markers that QR-codes have. You can't take a picture of a cart with your phone and play it. You need the exact same, byte-for-byte PNG file. But it's still super cool.

Re:Snake in a QR Code by muxator on Friday September 04, 2020 @11:43AM (#24375966)
This is the coolest thing in ages. The game's code is steganographically embedded in a PNG image containing the screenshot of the game! Wow
Re:Snake in a QR Code by read_if_gay_ on Friday September 04, 2020 @12:27PM (#24376411)
Steganography is cooler for sure, but can't PNGs already store arbitrary data in the header? IIRC, the game Spore did that so you can exchange creatures by sending images.
Re:Snake in a QR Code by nacs on Friday September 04, 2020 @02:49PM (#24377773)
I think the issue with that is that many image hosting sites optimize their images or at the least strip unnecessary data and EXIFs.

So at any point while being copied from person to person, that game data could be lost.

Re:Snake in a QR Code by nlawalker on Friday September 04, 2020 @12:15PM (#24376281)
Games for the “Redshift” game console in the Zachtronics game Exapunks work the same way. They copied the idea from PICO-8: https://mobile.twitter.com/zachtronics/status/10277956046744...
Re:Snake in a QR Code by svachalek on Friday September 04, 2020 @12:55PM (#24376661)
This is very cool, and gives me a thought, what if you did it without "cheating"? That is, what if the whole game including its rules were in the picture? Something like Conway's game of Life but less shape-dependent, maybe utilizing the color to generate behaviors.
Re:Snake in a QR Code by aelred717 on Friday September 04, 2020 @01:10PM (#24376805)
The closest thing I can think of is Piet: https://www.dangermouse.net/esoteric/piet.html
Re:Snake in a QR Code by LordDragonfang on Friday September 04, 2020 @02:31PM (#24377620)
>Richard Mitton supplies this amazing program which calculates an approximation of pi... literally by dividing a circular area by the radius twice.

>Naturally, a more accurate value can be obtained by using a bigger program.

That's delightful

Re:Snake in a QR Code by bentpins on Friday September 04, 2020 @08:07PM (#24380226)
Nintendo back in 2001 came out with the e-Reader that would plug into a Gameboy Advance and read cards with data printed on them. You'd have to scan a few "stripes" of data, but it there were several NES games that you could run if you had the right cards. The cards held the data for the games, rather than them being already on the cartridge https://en.wikipedia.org/wiki/Nintendo_e-Reader
Re:Snake in a QR Code by deergomoo on Saturday September 05, 2020 @01:50PM (#24385451)
I was always gutted that thing never came out in Europe. I had tons of Pokémon cards with the stripes and nothing to use them with.
Re:Snake in a QR Code by rahimiali on Friday September 04, 2020 @11:55AM (#24376082)
You should turn this comment into a blog post. Your writing is captivating. You made this ecosystem sound a lot cooler than the web pages you linked to.
Re:Snake in a QR Code by skrebbel on Saturday September 05, 2020 @04:21AM (#24382175)
Thanks! I'm humbled :-)

That said, I think the PICO-8 ecosystem is a lot cooler than I made it sound :-)

EDIT, try watching this demo for example: https://www.youtube.com/watch?v=UR3MXKIefAI It's a demo, not a game, so not interactive and hence youtubeable. Tell me that isn't cool (and remember, it fits in is cartridge png).

Re:Snake in a QR Code by ehsankia on Friday September 04, 2020 @06:00PM (#24379322)
I don't know if I'm stupid, but those anyone have an example PICO-8 PNG? I can't find one in either of the two links you sent, nor on the internet. Am i missing something here?
Re:Snake in a QR Code by kaoD on Friday September 04, 2020 @06:16PM (#24379437)
Click "Cart" on the bottom left of the BBS entries.

E.g. on https://www.lexaloffle.com/bbs/?tid=29967

Takes you to https://www.lexaloffle.com/bbs/cposts/4/44467.p8.png

Re:Snake in a QR Code by ehsankia on Saturday September 05, 2020 @12:07PM (#24384583)
Huh, so the PNG actually looks like a real cartridge? How are they able to do that? Is the data section hidden in a non-visible part of the file, or are they able to somehow encode it in there while still having it look visually like a cartridge?
Re:Snake in a QR Code by giantrobot on Saturday September 05, 2020 @01:38PM (#24385372)
https://pico-8.fandom.com/wiki/P8PNGFileFormat

The images are RGBA PNGs. So for each display pixel there's a byte for each color channel and the alpha channel. The two least significant bits in each byte are a quarter of a PICO-8 data byte. Those bits are read from a channel byte and concatenated in RGBA order to get a data byte.

Using the LSBs for each channel means the those swizzled bits won't contribute very much to that pixel's color value. At worst it would just look like noise in the image.

Also by putting the data inside the image data of a PNG it won't be stripped off by some optimizer or hosting service.

Re:Snake in a QR Code by stOneskull on Friday September 04, 2020 @11:51PM (#24381276)
that 'top-down adventure tutorial' is great. basically teaches you everything. thanks for sharing pico-8.
Re:Snake in a QR Code by 83457 on Friday September 04, 2020 @01:25PM (#24376964)
This was the first thing that came to mind. If PICO-8 ever comes out with a mobile version, having a way to load a game by QR Code or some sort of game image would be cool.