Skip to content

About

An agar.io-style game built on @chenglou's pretext library

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Pretext Arena

Multiplayer browser game where you ARE your text. Sign in with X, eat word pellets, eat other players, absorb their handles. Built with @chenglou/pretext.

Built in 2 days. 100% Claude Code. 0 lines written by hand.

Play now at pretextarena.io

Stack

  • Rendering: @chenglou/pretext for real-time text layout on canvas
  • Client: Vite + TypeScript, canvas-based rendering
  • Server: Bun WebSocket server, authoritative physics at 30 ticks/sec
  • Deploy: Fly.io (game server) + Vercel (static client)
  • Auth: X/Twitter OAuth with PKCE
  • Video: Launch video rendered by the game engine via Remotion

How it works

Text is the game mechanic, not a label on a sprite. Every blob is real text rendered by pretext. The more you eat, the more text you carry. Eat another player and their handle becomes part of you.

Run locally

# Install dependencies
bun install

# Run both in separate terminals
bun run dev           # Vite client on :5173
bun run dev:server    # Bun game server on :3001

# Build for production
bun run build

# Run tests
bun test server/__tests__

Copy .env.example to .env and fill in your Twitter API credentials for auth.

Architecture

src/
  main.ts              — Entry point, screen router (Landing → Game → Death)
  screens/             — Landing, Game, Death screen classes
  game/                — Renderer, Camera, Input, HUD, Blob drawing, Rain, Pellets
  net/                 — WebSocket client + state interpolation
  auth.ts              — X/Twitter OAuth (PKCE flow)
server/
  index.ts             — Bun.serve with HTTP routes + WebSocket handler
  simulation.ts        — Game loop (physics, eating, broadcasting)
  room.ts              — Room + RoomManager (capacity, pellets, leaderboard)
  bot.ts               — Bot AI (wander, flee, chase)
  spatial.ts           — Spatial hash grid for collision detection
shared/
  protocol.ts          — Message types, PlayerState, helpers
  constants.ts         — All game tuning constants
video/
  src/                 — Remotion composition (launch video rendered by game engine)

License

MIT

About

An agar.io-style game built on @chenglou's pretext library

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages