✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: January 17, 2026
  • 8 min read

Ultra‑Compact 13 KB Polyglot Snake Game Bridges Windows, Linux, and Browsers

The 13 KB polyglot Snake game runs natively on Windows, Linux, and modern web browsers from a single executable file, demonstrating how a tiny codebase can power a full‑featured cross‑platform experience.

A Tiny Giant: 13 KB Snake Game Takes the Spotlight

In an era where games often demand gigabytes of assets, Kamila Szewczyk’s 13 KB Snake polyglot proves that elegance and efficiency can coexist. By packing three distinct implementations—Windows PE, Linux ELF, and HTML5/JavaScript—into one file, the project shatters the myth that cross‑platform games must be bulky. The original announcement can be read in full here.

This breakthrough is not just a novelty; it offers a practical blueprint for developers who crave minimalism, rapid deployment, and maximum reach. Below we dissect the game’s architecture, gameplay mechanics, and why it matters for the broader software community.

13KB Snake game across platforms

Overview of the 13 KB Polyglot Snake Game

At its core, the game is a faithful recreation of the classic Snake arcade title. Players steer a growing line of pixels, gobble food, and avoid colliding with walls or their own tail. What sets this version apart is its polyglot nature: the same file behaves as a valid Windows executable, a Linux ELF binary, and a web page—all without any external dependencies.

  • File size: 13,312 bytes (≈13 KB)
  • Supported platforms: Windows (PE), Linux (ELF64), and any modern browser (HTML5 Canvas)
  • Three independent codebases (C for Windows, C for Linux, JavaScript for browsers) concatenated into a single container
  • All three implementations are under 5 KB each after compression/minification

The game’s distribution model is also noteworthy: a single download link provides the same file for every platform, eliminating the need for separate installers or package managers.

Technical Implementation Details

The magic lies in how the file is structured. Below is a MECE breakdown of the three layers:

1. Windows PE Stub with Embedded Shell Script

The Windows portion starts with a custom PE header that leaves a large, controllable region after the MZ signature. This region houses a Bash‑style shell script that is ignored by the Windows loader but executed on Unix‑like systems. The script simply skips over the PE payload, allowing the same file to be interpreted as a valid shell script on Linux.

When run on Windows, the PE stub decompresses a tiny 3‑KB payload that contains the actual game logic written with the WinAPI. The decompression stub is triggered via the apphelp compatibility shim, which tolerates the unconventional header.

2. Linux ELF64 Segment with LZMA Decompression

Following the Windows stub, the file contains an LZMA‑compressed ELF binary. A minimal shell dropper extracts this segment, writes it to /tmp, marks it executable, and launches it. The ELF binary itself is a compact C program that uses X11 for rendering and input handling.

The dropper is designed to ignore any preceding data (the Windows stub) and only process the bytes after a specific marker, ensuring clean execution on Linux.

3. HTML5/JavaScript Canvas Section

The final part of the file is a standard HTML document wrapped in a <style> block that hides all preceding garbage bytes from the browser’s parser. Modern browsers ignore any characters before the <!DOCTYPE html> or <html> tag, allowing the page to render correctly.

The JavaScript implementation is heavily minified and leverages the Canvas API for drawing, while CSS ensures the stray bytes remain invisible. This approach makes the same file serve as a fully functional web app without any server‑side processing.

Why This Works

The technique exploits the fact that each operating system reads the file format differently:

  • Windows reads the PE header and ignores any trailing data.
  • Linux treats the file as a script if executed directly, using the shebang‑like shell stub.
  • Browsers parse HTML after discarding any leading non‑HTML bytes.

By aligning these expectations, the same binary can satisfy all three runtimes simultaneously.

Gameplay Mechanics and Features

While the underlying code is minimal, the game offers a surprisingly rich set of features:

  • Responsive Controls: Arrow keys or WASD for movement; Space to start, P to pause, R to reset, Esc to quit.
  • Scoring System: Regular food grants 10 points; a rare yellow fruit (15 % spawn chance) awards 20 points.
  • Dynamic Levels: After consuming ten pieces of food, the maze layout randomizes while guaranteeing a solvable path.
  • Speed Scaling: Snake speed increases with length, making later levels more challenging.
  • Cross‑Platform Consistency: Identical graphics, controls, and scoring across Windows, Linux, and browsers.

The game also includes subtle quality‑of‑life touches, such as a visible timer for fruit despawn and a minimalistic UI that adapts to the window size.

Why This Matters: Significance and Real‑World Use Cases

The 13 KB Snake polyglot is more than a clever hack; it illustrates a set of principles that can reshape how developers think about distribution, performance, and maintainability.

Reduced Distribution Overhead

By delivering a single file, developers eliminate the friction of platform‑specific installers, version mismatches, and update pipelines. This is especially valuable for internal tools, demos, or educational resources where simplicity is paramount.

Showcase of Polyglot Programming

The project demonstrates that polyglot techniques—writing code that can be interpreted in multiple languages or runtimes—are viable beyond academic exercises. Teams can adopt similar patterns for utilities that need to run on both server and client environments.

Inspiration for Low‑Resource Environments

Edge devices, IoT gadgets, and legacy systems often lack the storage or processing power for large binaries. A sub‑15 KB solution can be the difference between feasibility and abandonment.

Educational Value

The source code serves as a compact case study for students learning about binary formats, compression, and cross‑platform compatibility. It can be dissected in a single classroom session, offering hands‑on insight into low‑level programming.

For SaaS providers and AI platform builders, the underlying concept aligns with the UBOS platform overview, where modular, lightweight services are assembled into powerful applications without unnecessary bloat.

Building Your Own Polyglot Apps with UBOS

If the 13 KB Snake game sparked your curiosity, UBOS offers a suite of tools that make creating ultra‑compact, cross‑platform solutions straightforward:

  • Use the Web app editor on UBOS to prototype HTML/JS front‑ends that can be bundled with native back‑ends.
  • Automate build pipelines with the Workflow automation studio, which can compress, sign, and concatenate binaries automatically.
  • Jump‑start projects with UBOS templates for quick start, including a “Minimal Polyglot” starter kit.
  • Deploy to multiple environments—cloud, on‑prem, or edge—using the Enterprise AI platform by UBOS, ensuring consistent performance across OS boundaries.
  • Explore real‑world examples in the UBOS portfolio examples to see how other teams have leveraged lightweight binaries for AI agents and micro‑services.

Whether you’re a startup looking to showcase a proof‑of‑concept or an SMB aiming to reduce deployment costs, UBOS’s UBOS solutions for SMBs provide the flexibility you need.

Take the Next Step

Ready to experiment with ultra‑compact, cross‑platform development? Start by exploring the UBOS homepage and sign up for a free trial. Our UBOS pricing plans are designed for developers at every stage—from hobbyists to enterprise teams.

Join the UBOS partner program to collaborate with other innovators and gain early access to new polyglot tooling. If you’re interested in AI‑driven marketing, check out our AI marketing agents that can automatically generate copy, analyze performance, and even create assets like the AI SEO Analyzer or the AI Article Copywriter.

For developers focused on conversational AI, the OpenAI ChatGPT integration and the ChatGPT and Telegram integration showcase how to embed large language models into lightweight services—perfect for extending the polyglot concept into AI assistants.

Finally, explore our marketplace for ready‑made AI applications such as the Talk with Claude AI app, the AI YouTube Comment Analysis tool, or the AI Video Generator. These templates illustrate how a few kilobytes of code can power sophisticated AI workflows.

Conclusion

The 13 KB Snake polyglot is a testament to the power of clever engineering, minimalism, and cross‑platform thinking. By compressing three full implementations into a single file, Kamila Szewczyk has opened a door for developers to rethink how they package and distribute software.

Whether you aim to build tiny games, lightweight utilities, or AI‑enhanced micro‑services, the principles demonstrated here—strategic use of binary formats, compression, and platform‑specific stubs—are directly applicable. Leveraging platforms like UBOS can accelerate that journey, providing the scaffolding, templates, and automation you need to turn a 13 KB concept into a production‑ready solution.

“Small code, big impact.” – A guiding mantra for modern developers.

Dive in, experiment, and let the next generation of ultra‑compact applications redefine what’s possible.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.