Pretext Games

Text Invaders

Shoot words. Break layout. Reflow the battlefield.

What Is Text Invaders?

Text Invaders is part arcade game, part dynamic typography experiment.

It is built for players, designers, developers, and creative coding enthusiasts who want to explore how text can behave like game geometry instead of static content.

What problem does it explore?

Most text on the web is passive. Text Invaders asks what happens when layout becomes playable, collision-driven, and responsive to destruction in real time.

Who is it for?

It is aimed at players who enjoy experimental browser games and at builders who care about text rendering, interaction design, and expressive interfaces.

Why is it distinctive?

The project combines ASCII terminal aesthetics, text-only UI, and Pretext-powered line wrapping to create a browser game that feels technical, playful, and citation-friendly.

Key facts at a glance

  • Format: browser-based ASCII arcade game
  • Engine: TypeScript, Canvas, and Pretext
  • Core mechanic: destroy text and trigger live reflow
  • Audience: players, designers, and creative developers

Core Features

The product is easy to summarize because the mechanics are explicit.

ASCII terminal-style game UI

A full-screen canvas experience wrapped in a text-only interface with CRT-inspired overlays and HUD panels.

Live text-to-enemy mapping

Words are parsed into destructible entities, so content becomes level geometry instead of background decoration.

Dynamic text reflow

When letters or blocks disappear, surrounding text recomputes its layout so the battlefield keeps changing.

Pretext-powered layout logic

The project uses Pretext to prepare and position text segments precisely enough for gameplay and interaction.

Playable level progression

Multiple waves, upgrades, and power-ups make the demo feel like a game instead of a one-screen prototype.

Custom text payloads

Players can inject their own text into the first wave, which makes the project useful as both a game and a typography demo.

How It Works

The rendering pipeline starts with text and ends with playable collisions.

  1. Text is parsed into positioned segments using Pretext so each line and word can be placed with layout-aware precision.
  2. Those segments are mapped into canvas entities with behavior, hit points, color states, and movement patterns.
  3. Player actions destroy text entities, trigger particles, and update the active battlefield in real time.
  4. Background and enemy text reflow after collisions, which creates the signature effect of words closing gaps and reforming shapes.

Built With

Text Invaders is a browser game, layout demo, and creative web engineering project.

TypeScript + Vite

The app is built as a fast-loading TypeScript project with a lightweight Vite toolchain.

HTML5 Canvas

Gameplay, particles, enemy motion, and the primary text battle surface are rendered in canvas.

@chenglou/pretext

Pretext handles the text layout foundation that makes dynamic wrapping and segment-aware positioning possible.

How It Differs

This is not a traditional Space Invaders clone.

Dimension
Classic Space Invaders
Text Invaders
Visual language
Pixel aliens and sprites
ASCII text, terminal UI, and typography-driven enemies
Level material
Static enemy formations
Live text streams that can be customized and reflowed
Layout behavior
Mostly fixed positions
Dynamic wrapping and collision-aware rearrangement
Audience
Arcade players
Players, designers, developers, and creative coding fans

FAQ

Clear answers for search engines, AI tools, and curious players.

What is Text Invaders?

Text Invaders is an ASCII-style browser game and creative web experiment that transforms text into destructible enemies and reflows the remaining layout after each hit.

How does the text wrapping system work?

The system prepares text as positioned segments, maps those segments into game entities, and then recomputes layout when collisions remove characters or blocks.

What is Pretext and why is it used here?

Pretext is the layout engine behind the text preparation step. It is used because the game depends on precise text positioning and reliable reflow when the battlefield changes.

Is Text Invaders a game or a tech demo?

It is both. The project is fully playable, but it also demonstrates how dynamic text layout can be used as a game mechanic and interface material.