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

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

Описание и применение

Trick or Take – это быстрый многопользовательский браузерный квест, реализованный полностью на Cloudflare Workers и D1, с голосовым чатом Agora и 12 языками, при этом фронтенд весит менее 45 КБ.

Задача

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

Результат

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.

Рабочий процесс

  • 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.

Доказательства

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.

Источник

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

Источник

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

Источник

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

Источник

  • Дата записи: 2026-11-01T23:59:01.895Z