Live data from Hacker News

This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

iczelia.net

61–70 of 93 posts

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#61

On a related note -- when I see the minuscule filesize of the original Zelda game on emulators, I marvel at how little text/code/information could produce how much wonder, how far-reaching impact, and how many hours of enchantment for me. https://en.wikipedia.org/wiki/The_Legend_of_Zelda_(video_gam...

Indeed, magic. How about the Commodore 64, there was a game (Eindeloos, Radarsoft, 1985) within 64kb that has a huge map. Someone recently (after 40 years!) extracted the map (500 screens) and the png alone is 800kb. See the story an zoom in and try finding the little heart in the map! https://adayinthelifeof.nl/2025/03/07/endless.html

Elite on the BBC Micro - which had 32kB of RAM, a huge chunk of which was required for the screen - managed to have eight galaxies with 256 distinct planets each.

Everything about them was procedurally generated, even the names, which required some clever code to ensure none of them used rude words.

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#62

For me: - Browser: works after renaming to .html - Linux: "./snake.com: line 20: lzma: command not found". Installing the xz package makes it work (already had XWayland enabled so X11 worked, but may be needed if you have a strict Wayland session). - Windows: As either .com or renaming to .exe I get "The application was unable to start correctly (0xc0000005). Click OK to close the application." Not sure how to make t…

If I ran it with just $ chmod +x snake.com $ ./snake.com ... then it would try to use Mono to launch it: Cannot open assembly './snake.com': File does not contain a valid CIL image. But, running it explicitly with Bash works: $ bash snake.com Pretty nifty but doesn't work out of the box on any Linux, at least :p Running Debian 13.

Cosmopolitan libc binaries require a little extra config to work around the defaults most distros set for binfmt: https://justine.lol/apeloader/

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#63
post #30
post #26

Earlier quoted context omitted.

Don't most (all?) browsers consider file:// and localhost to be secure for the sake of enabling those features? https://developer.mozilla.org/en-US/docs/Web/Security/Defens...

Unfortunately, no. CORS will block this on Chrome and Firefox. https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/COR... The security risk : https://www.mozilla.org/en-US/security/advisories/mfsa2019-2... You need a local webserver. Or bundle everything in one html file.

So that's why I have to keep booting a Windows 7 computer in order to use an html file I saved 10+ years ago? Some dumb shit android app.

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#64

I love the idea of applications which exist in one file which you can run anywhere. I've been working towards this with my serverless platform; you can build complex data-driven apps with just one .html file and mostly declarative HTML markup (thanks to web-components which are loaded from a remote server). With modern browser features, you don't need a bundling system. Once you do away with it; a whole universe is o…

> I implemented the game three times in total: once in C for the i686 Visual C platform using WinAPI, once in C for the x86_64 Linux platform using clang and X11, and once in JavaScript for the browser using HTML5 Canvas.

The OP actually wrote two native applications instead of just instantiating a browser.

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#66
post #51

i wonder if such a mechanism could be "enhanced" to produce a true "universal" binary, using a source-to-source compiled language like Haxe? With Haxe, you can write the application once, target both win32 and linux by compiling to C++ (which then you compile using the platform specific tooling for each paltform), and then target html by compiling to javascript. Then use the same concatenation mechanism and header ab…

[dead]

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#68
post #36

Earlier quoted context omitted.

From that link: Still works on modern PCs! Was able to DL and launch.

Not out of the box, though. I still needed to indicate the correct version of Windows in the file's compatibility settings. Windows XP SP3 worked like a charm.

[deleted]

Re: This game is a single 13 KiB file that runs on Windows, Linux and in the Browser

#70
post #47

The binary relies on the runtime, so yes it is nice. Forma instance, a static compiled and linked "hello world" in C on Linux is around ~785KB

> a static compiled and linked "hello world" in C on Linux is around ~785KB Huh? $ musl-gcc -xc -static -Wl,-z,norelro -Wl,-z,nosectionheader -Wl,-z,noseparate-code -s - int main(void) { static const char s[] = "Hello, World!\n"; fwrite(s, (sizeof s)-1, 1, stdout); } eof $ ./a.out Hello, World! $ ls -l a.out -rwxr-xr-x 1 oguz oguz 4976 Jan 12 09:38 a.out And if that's not enough $ musl-gcc -xc -static -nostdlib -fcf-…

I'm sure that number is using glibc, not musl.
Post reply on HN