Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building Trick or Take: An Open-Source Multiplayer Halloween Web Game on Cloudflare Workers & Agora RTC

Description and use

Trick or Take is a fast, multiplayer browser game built entirely on Cloudflare Workers and D1, featuring Agora voice chat and 12 languages, with a front‑end under 45 KB.

Problem

Develop a fast‑paced, low‑latency multiplayer browser game that can be played instantly on any device without heavy frameworks or splash screens.

Outcome

Trick or Take demonstrates that a lightweight, instant‑play multiplayer game can be built entirely on serverless edge infrastructure with real‑time voice, 12‑language support, and a sub‑45 KB front‑end, all open‑source under MIT.

Workflow

  • 1. Use vanilla HTML5 Canvas 2D with fixed 800x600 resolution and devicePixelRatio scaling for crisp graphics.
  • 2. Implement a lightweight particle engine and floating score system via object pooling.
  • 3. Apply client‑side linear interpolation (lerp) across tick states for 60 fps animation.
  • 4. Deploy the backend as Cloudflare Workers with Cloudflare D1 (Serverless SQLite) across 300+ edge locations.
  • 5. Manage room state with versioned snapshots and atomic SQLite transactions to avoid race conditions.
  • 6. Perform optimistic client prediction for immediate movement and interaction feedback.
  • 7. Issue short‑lived Agora RTC tokens from Workers for in‑browser voice chat, using audio‑only profiles (32 kbps).
  • 8. Broadcast lobby state and voice mute indicators via Agora RTM.
  • 9. Provide 12 built‑in languages and RTL support for global accessibility.
  • 10. Open‑source all code under MIT license and allow local deployment with wrangler dev.

Evidence

Trick or Take is a real‑time multiplayer browser party game where up to 6 players enter a haunted mansion, collect candy corn, cast spectral curses, and steal candy from rival players in frantic 60‑second rounds.

Source

The entire front‑end client—including sprites, UI overlays, audio synthesizers, and multiplayer networking—weighs under 45KB uncompressed.

Source

Trick or Take is engineered natively on Cloudflare Workers and Cloudflare D1 (Serverless SQLite) deployed across 300+ global edge locations.

Source

When a player joins a lobby, the Cloudflare Worker issues a short‑lived Agora RTC token scoped to the specific roomId.

Source

  • Record date: 2026-11-01T23:59:01.895Z