Finlay Laidlaw

Embedding Games in QR Codes

09 May 2026

Project hosted on GitHub Pages

Introduction

QR codes are a type of 2D barcode, with wide support across mobile devices. QR codes typically store web URLs, but they can be used for any kind of data. As a data storage format, QR codes are both cheap to produce, and supported on mobile. They are not typically used for directly storing media because their maximum capacity is only three kilobytes. In the past games have used formats with similarly small sizes, many Atari 2600 games used only two or four kilobyte cartridges. Given this precedent, it seems possible that QR codes could be used for game distribution and would be particularly interesting as an alternative to online distribution that works on mobile devices and connects the game to a physical location.

Aim

QR codes are a promising avenue for game distribution, but it is not clear to what extent their use is technically feasible. The aim of this project is to evaluate the technical feasibility of QR codes as a distribution medium for games by creating a cross-platform mobile application which enables the creation and playing of games that are embedded in QR codes. The application is evaluated in terms of its feature set, performance, and the compression ratio achieved on game data.

Research Question

To what extent can QR codes be used as a medium for offline mobile game distribution?

Method

Platform

The application is built as a progressive web app (PWA). This allows it to both function as a website and be downloaded to use offline. QR Code The game data is formatted as a URL so that any QR code scanner which reads it will link to the website or web app as appropriate. The game data is encoded in Base64 as a URL query parameter. This has 75% efficiency, making a maximum capacity of 2192 bytes of game data.

Graphics

Image data typically requires a lot of space. To avoid this, text-based graphics are used. Sprites for Latin text, emoji, and symbols are taken from Unifont, which is a bitmap Unicode font. These sprites are included in the engine and can be used by any game. Sprites are batch rendered with WebGL.

Level

A tilemap of Unicode characters is used for the level. The tilemap is divided into patches which are reused to reduce the amount of level data. This is a similar approach to that used in The Legend of Zelda for the NES (NovaSquirrel, 2023). Compression Scripts and level data are compressed using PPMd. PPMd implements prediction by partial matching, a context modeling compression technique which works well on text. PMMd is ideal because it maximises compression ratio and its package size is lightweight.

Audio

The size limitations are too small for normal audio data. Instead, a scripting API allows sound effects be generated procedurally. Support for text-to-speech and writing melodies as strings is also included. Evaluation The feature set and install size are evaluated by comparing to other web-based game engines. The compression algorithm is compared against alternatives in terms of compression ratio.

Evaluation

The evaluation compared the project with existing platforms: Scratch, PICO-8, and Godot. They were compared in terms of feature set and page weight. The compression ratio was also evaluated, comparing the PPMd solution with the more popular compressors: Deflate (zlib), Brotli, LZMA.

Results

Features

The feature set comparison showed the application is less like Godot more like platforms such as Scratch and fantasy consoles like PICO-8. Though unlike these, it includes a physics engine and lacks any built-in graphics or sound editing tools. Overall, it has the necessary features to function as a game engine for a variety of 2D games.

Page Weight

This project has the lowest page weight out of those tested, it is half the weight of PICO-8 and 30 times smaller than Scratch. According to Ofcom data, at this size nearly every 4G connection should be able to load the application in less than 5 seconds.

Compression

The algorithms are tested on six demo projects, and an average compression ratio is calculated. The three comparison algorithms are taken from the npm Registry and are all based on dictionary compression, whereas PPMd relies entirely on a byte-level context model. PPMd performs the best, with a compression ratio of 3.39x, albeit Brotli comes a close second at 3.28x. However, considering that Brotli’s package size is more than one megabyte and PPMd is only 80 kilobytes, it is clear that PPMd is superior for this projects purposes.

Discussion

PPMd performs well but could be improved by “priming” its context model with sample script data before compressing. A more specialised algorithm could be used for level data, one that considers a 2D context and better handles multi-byte characters.

Limitations

PWA support is inadequate across platforms, particularly iOS. A native app should be provided alongside the PWA for better compatibility.

Practical Applications

The ease with which QR code games can be copied means they cannot be monetised conventionally. To use them commercially they can be integrated into an existing experience, for example a museum could create small games to add an interactive element to exhibits. They may also fit into an activity like geocaching, where the user can collect games that they find in the environment. The application has no server-side logic so it can be deployed on GitHub Pages for free and used by anyone for any purpose.

Conclusion

This project demonstrates how QR codes can be used as a medium for games. It shows novel methods for coping with the size constraint. Future work could evaluate the user experience, integrate procedural generation or use NFC stickers in the place of QR codes.