return to table of content

Show HN: Bitwise Liminal – A Short Film in 256 Bytes of Code

sowbug
8 replies
16h23m

Stuff like this makes me believe that the entirety of life really could be encoded in DNA. I've read that if you gzipped the human genome, the file would be about 4MB, which intuitively seems too small to represent a human. But if this behavior can emerge from 256 bytes, then clearly my intuition is off.

smokel
1 replies
10h59m

Life generated from DNA in a vacuum would probably be pretty boring. The entirety of life requires some surroundings to interact with, and as it stands there is but one of those, and singular things don't compress well.

Also, have a look at the Mandelbrot set again. There's quite a lot of information in, arguably, a very modest process.

And finally, to suggest that these 256 bytes are less impressive than they are, consider what hardware and software is needed to support it. These 256 bytes would not lead to the same illusion on a C64.

teddyh
0 replies
4h50m

There's quite a lot of information in, arguably, a very modest process.

But quite low in Kolmogorov complexity.

ivan_ar
1 replies
16h9m

Is a misconception that DNA is enough by itself to replicate a living being, there are biological bases in the embryon that need to be pass down from the parent as biological infraestructure for the new being to form.

sowbug
0 replies
15h48m

You're absolutely correct, just as you'd be correct to observe that these 256 bytes require a fairly complex software platform running on fairly complex hardware.

And all these things, including us, operate within the fabric of the universe, whose complexity is only beginning to be understood.

ToValueFunfetti
1 replies
15h32m

4MB are enough to discriminate between 2^(3.2 * 10^7) possible states. Suppose you have a decompressor that can interpret a percent of a percent of a percent of a percent of those states as functional lifeforms. There are about a trillion species on the planet[1]; let's say there are a trillion times as many potential species that don't currently exist and a trillion variations within each. And then let's multiply by another trillion for good measure. Wolfram Alpha tells me[2] we've left a margin of error of roughly* ten to the ten million.

[1]https://www.nsf.gov/news/news_summ.jsp?cntn_id=138446

[2]https://www.wolframalpha.com/input?i2d=true&i=Divide%5BPower...

*'roughly' in the sense that a mountain range is roughly coarse sandpaper, but too round not to round to

adtac
0 replies
14h18m

Even a SHA-256 hash would leave 10^31 margin of error. The "percent of a percent of a percent of a percent" part is sweeping a lot under the proverbial rug here ;)

kweingar
0 replies
11h39m

You may be interested in an article posted to HN a few days ago that argues against the conception of DNA as code and of cells as computers or machines.

https://www.nature.com/articles/d41586-024-00327-x

Aspos
0 replies
16h7m

It could be a 4 megabyte-long seed for a random generator.

zeroq
7 replies
18h4m

I can't stress enough how much I admire that it is true 256 bytes, instead of usual 1k game jams, where submissions are presented as zipped, gzipped, and postfixed, and not including assets to fit the criteria.

Hats off.

rvba
2 replies
17h24m

Is "import gameassets" allowed in those competitions?

On a side note "import GOTO" works in python :)

selcuka
1 replies
16h57m

On a side note "import GOTO" works in python :)

Never heard of this, and it doesn't work on my interpreter (tested with both 2.7 and 3.11). Are you sure it's not a third party package?

Retr0id
0 replies
16h53m

It indeed does not work. I was curious, and found this hilarious article "confirming" its existence: https://www.edureka.co/blog/goto-statement-in-python/ - it's complete nonsense and appears to have been written by ChatGPT.

The feature has been implemented a few times as a joke (more or less), e.g. https://github.com/snoack/python-goto/, but that one at least hasn't been updated for 5 years.

Hikikomori
1 replies
17h32m
noman-land
0 replies
12h58m

This one is incredible.

lifthrasiir
0 replies
7h10m

[...] where submissions are presented as zipped, gzipped, and postfixed, [...]

Well, you can always include a decompressor in your entry. PNG bootstrap has been popular enough in the JS demoscene for a long time and it starts to be effective for 1K or larger demos. There are other alternatives for smaller sizes, and 256B demos just happen to be too small to put any kind of decompressor in general.

[...] and not including assets to fit the criteria.

I do agree on this aspect though.

KilledByAPixel
0 replies
16h7m

thank you! it is a crazy challenge that is just shy of being impossible that seems like magic when it actually works.

javajosh
4 replies
18h15m

A minor note: this is the first time I've seen an svg embedded in a canvas purely for it's onload event. Within this context the canvas is referred to by its (bare) id. How strange and wonderful!

cdelsolar
1 replies
16h44m

Why is that allowed? I didn’t realize one could do that in js.

cal85
0 replies
1h48m

If you nest any valid elements inside an unknown element like <asdf>...</asdf>, browsers just ignore the invalid wrapper element but still display the nested children. This fact is exploited by spec authors when introducing new tags to allow backwards compatibility: elements like canvas, video and audio all specifically allow optional children that are automatically hidden - but they won't be hidden in older browsers that don't know about the new elements. This allows you to easily define arbitrary fallback content for older browsers that don't support the new elements, just by nesting children in them.

kilroy123
0 replies
17h54m

I noticed and thought the same! Pretty cool.

KilledByAPixel
0 replies
16h5m

It turns out that packing it into an svg onload is a tiny bit smaller then using a script tag!

It is possible to save a little more space by putting it in the canvas onclick event.

naniwaduni
3 replies
17h1m

TIL that elements with ids are exposed as global variables in JS.

onetom
2 replies
12h26m

I've also noticed this a few years ago, but where is this documented? Was it already the case in IE6 for example? Have you found any definitive source, which states this behaviour?

serial_dev
0 replies
11h33m

HTML Spec:

7.2.2.3 Named access on the Window object

window[name]

Returns the indicated element or collection of elements.

https://html.spec.whatwg.org/multipage/nav-history-apis.html...

lifthrasiir
0 replies
11h24m

The relevant WHATWG specification: https://html.spec.whatwg.org/multipage/nav-history-apis.html...

It was said to be introduced in MSIE 4 or around and then eventually standardized by WHATWG (because `window` was never formally specified before that point, AFAIK): https://stackoverflow.com/questions/9740275/html-element-id-...

phs318u
2 replies
15h44m

Is there an annotated version breaking down each part of this for us lesser mortals?

cal85
1 replies
3h13m

I've had a stab at decompressing the code by hand, adding comments and meaningful var names where possible. I still don't understand the maths in it...

https://github.com/callumlocke/bitwise-liminal-expanded

junon
0 replies
1h32m

Just a guess, the speedup is probably due to you caching the 2d context.

cal85
2 replies
18h43m

What the fuck. How?

Retr0id
1 replies
18h20m

Ray marching, most likely.

KilledByAPixel
0 replies
16h4m

Yes, this raymarching, though the vhs effect was really the trickiest part.

asadhaider
2 replies
17h36m

The author has more content at https://killedbyapixel.github.io/TinyCode/

penteract
1 replies
17h17m
ebiester
0 replies
1h43m

My first thought on seeing the source was dwitter - it's such a fun community to peruse!

zokier
1 replies
18h16m

You'll want to put the code in code block (prefix line with spaces) so asterisks don't get mangled

dang
0 replies
13h30m

I've changed the formatting to do that above - I hope it's better now!

https://news.ycombinator.com/formatdoc

john-tells-all
1 replies
17h26m

Their work is always jaw-dropping. Here is some explanation of the tools they use: https://frankforce.com/tools/

And here's their work on the micro animation blog Dwitter: https://www.dwitter.net/u/KilledByAPixel

Youtube explanation: https://www.youtube.com/watch?v=HV7Dmo277Rs

Timwi
0 replies
1h58m

That “YouTube explanation” doesn't actually explain how any of the Dweets work. Don't get me wrong, his work is amazing, I loved seeing it and I'm excited to listen to him show it off; I'm just saying that anyone looking for a detailed walkthrough of how any of it works, that video will disappoint.

imaginationra
1 replies
7h36m

If this is a "short film" then you just read my new novel.

bsza
0 replies
5h16m

You could replace "t+=.1" with "t+=.01" and 9986 with 9e3, then you'll have a ~45 second loop still within 256 bytes, though a bit of the bottom part of the screen will be cut off.

zokier
0 replies
18h17m

Reminds me a bit of Megapole (another 256b demo) https://www.youtube.com/watch?v=Z8Av7Sc7yGY

swayvil
0 replies
7h5m

The first interdimensional probe returned. The universe next door is minecraft.

sebastianconcpt
0 replies
18h25m

Cyber-hallucinogenic cryptopoetry.

riidom
0 replies
18h42m

Nice visual style!

nickdothutton
0 replies
3h14m

Very J G Ballard. Nice work.

mapreduce
0 replies
2h33m

Can someone explain to me what are we seeing in the short film? I see some black and white animation with boxes moving and some noisy lines on it. But I'm not sure I understand what it means. Anyone can help me understand?

lxe
0 replies
13h44m

Love seeing demoscene on HN. Excellent work.

lingeringdoubts
0 replies
16h23m

You can add image-rendering: pixelated on the canvas element to remove the blurring. Mind you, that may be an intentional effect.

layer8
0 replies
4h55m

I wonder how small the SVG spec could be golfed for this program to still work.

iszomer
0 replies
14h58m

This made my 5560U ramp it's sysfan up 100%. :-)

gpderetta
0 replies
17h59m

Fantastic.

Also this would be perfect as an SCP.

dang
0 replies
16h0m

Recent and related:

Cross My Heart – A Frogger Demake in 256 Bytes of HTML/JS - https://news.ycombinator.com/item?id=39336677 - Feb 2024 (44 comments)

Normally we downweight follow-up submissions (see https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...) but since (a) the submitter is the author in this case, and (b) the work is amazing, I've made it a Show HN instead (per https://news.ycombinator.com/showhn.html) and left it up.

clemiclemen
0 replies
7h39m

This is impressive and actually looks like a real movie scene. And to think this only fits in 256 bytes makes you rethink how bloated the things we are using everyday are and also how powerful current browsers are.

I am however more impressed by the 8K demos such as "the Sheep and the Flower" [1] which was shared on HN recently or "One of those days" [2] which is a remake of an actual Youtube video [3] (granted not exactly the same video by the second but the style is immediately recognizable). They are way bigger than this 256 bytes movie but convey a lot more graphics and story.

[1]: https://news.ycombinator.com/item?id=39121101

[2]: https://www.pouet.net/prod.php?which=75790 and YouTube video: https://youtu.be/8T_Um-cw0Wc

[3]: https://www.youtube.com/watch?v=R1NagZN2kjY

bloqs
0 replies
18h39m

Neat

actionfromafar
0 replies
18h39m

Thank you, I lost it in a move ages ago!