Inspiration

We were inspired by old Chinese tradition where scholars settled disputes with words, not weapons. In history and folklore, 舌戰 shé zhàn — "tongue battles" — were real: literati and scholars faced off in debates at courts, inns, and academies; victory came from rhetoric and wit, not blades. Imperial examinations tested candidates on argument and eloquence; the best could "defeat" others with logic and style. We wanted to bring that idea to Reddit: a battle of wits in the comments, where the community decides who wins and the top replies earn recognition — like scholar duels, but on a subreddit. Comment Duel is our take on that: one post is the 擂台 lèi tái (the arena); each comment is an argument; upvotes are the verdict.

What it does

Comment Duel turns a Reddit post into a single-round comment competition. A user creates a duel (Roast, Debate, or Open) with a topic and a time limit (e.g. 24 hours). Others submit one top-level comment each. When the deadline hits, the app ranks entries by upvotes (ties broken by earlier comment), awards points (10 / 5 / 3 for top 3, +1 for participation), updates persistent leaderboards (Roast, Debate, Overall), sets user flair for winners, and posts a stickied results comment. So: one post = one arena; the community votes; the best arguments rise and earn points.

How I built it

  • Duel lifecycle: Users create a duel from the subreddit menu (mode + topic + duration). The app posts to the subreddit and stores metadata and deadline in Redis. A scheduled job runs at the deadline: it fetches comment scores from the Reddit API, ranks by score (earlier comment wins ties), awards points, updates per-user stats and leaderboards, sets flair for winners, and posts a stickied results comment.
  • Rules: Only top-level comments count; one entry per user (tracked in Redis); deleted or removed comments are disqualified; only comments before the deadline are eligible.
  • Stack: Devvit (Reddit platform) for serverless backend, Hono for API routes, Redis for duel metadata, entries, results, and leaderboards. React 19, Tailwind CSS 4, and Vite for the client; a light splash view in the feed and an expanded game view for duel details, countdown, and leaderboards. Shared TypeScript types keep client and server in sync.

Challenges I ran into

  • Finalization reliability: The "finalize at deadline" step had to run exactly once per post. We added a Redis lock and a transitional "judging" state so scheduler retries don’t double-award points or double-post results.
  • Reddit API edge cases: Missing or deleted comments had to be handled when snapshotting scores. We filter by removed and body text like [deleted] so disqualified entries don’t break ranking.
  • Keeping the feed fast: The inline (splash) view had to stay minimal; we put richer duel UI and leaderboards in the expanded view.
  • Scoping for the hackathon: We focused on a clear MVP and deferred ideas like weekly resets or hall-of-fame posts so we could ship something solid.

Accomplishments that I'm proud of

  • Shipping a fully Reddit-native game: create duel, comment, auto-finalize, leaderboards, and flair without leaving the platform.
  • Idempotent finalization with a lock and "judging" state so finalization is safe under retries.
  • Three leaderboards (Roast, Debate, Overall) and per-user stats (points, wins, streaks) that persist across duels.
  • Theming the product around 舌戰 and scholar duels — battles of wits, not fists.

What I learned

  • Devvit’s serverless model: Designing for triggers, scheduled jobs, and menu actions instead of a single long-running server.
  • Reddit as the arena: Using Reddit for comments and upvotes, and our app for structure, rules, and persistence (points, leaderboards, flair).
  • Safe distributed steps: Using Redis locks and state transitions so critical steps (like finalization) run once and can be retried safely.

What's next for Comment Duel

  • Comment Colosseum-style mode: Daily prompt or "challenge a user"; two comments duel; an AI judge ("the Elder") picks the winner for a more narrative, 判官-style experience.
  • Optional argument styles (e.g. Logic / Wit / Roast) for tiebreaker or flavor, inspired by debate minigames.
  • Weekly or monthly leaderboard resets and a Hall of Fame for top scholars.
  • Richer flair and titles (e.g. 才子 / Scholar ranks) to lean further into the folklore theme.

Built With

Share this project:

Updates