Inspiration

The best daily games on Reddit (r/HotAndCold, r/ColorPuzzleGame, r/syllo, and r/Place) share one magical trait: everyone faces the exact same bite-sized challenge, then immediately compares strategies in the community.

We wanted to bring that daily ritual to tactile spatial intuition—no walls of text, no trivia, and no generic clone mechanics. Just an archival drafting board right inside the Reddit feed where you drag a single straight cut across a geometric shape to hit a target area ratio, and immediately see how your cut compares to the rest of the subreddit.

What it does

Slice Craft is a daily interactive post game built natively for Reddit Devvit Web:

  • 2-Second Onboarding & Feed Hook: The inline splash card displays today's Puzzle #NNN, a crisp Round 1 silhouette, live player count, your current daily streak, and the reigning 👑 Leader to beat before you even tap play.
  • Calibrated 3-Round Daily Challenge (~40 seconds):
    • Round 1 (Warm-Up): Clean convex polygon targeting 50% / 50%
    • Round 2 (Precision): Asymmetric polygon targeting 30/70 to 40/60
    • Round 3 (Master Cut): Distinct concave/notched silhouettes (L-Block, Keystone, Anvil, Crest, Chevron, Kite Notch, Arrow, Pennant) targeting 25/75 to 38/62
  • Tactile Risograph Studio & Procedural Audio: While dragging, live edge-crossing dots and a cut-angle badge confirm a valid crossing without spoiling the area. On release, synthesized Web Audio plays a scissor snip (plus a harmonic marimba chord on 95%+ Razor cuts), the two halves spring apart with exact Shoelace-computed percentages, and a gold dashed Optimal Cut ghost line shows how close you were along your exact angle.
  • Reddit-Native Social Loops:
    • Live Crowd Cut Overlays: Translucent vermilion ink lines reveal where up to 40 other Redditors cut the exact same round.
    • Subreddit Benchmark & Flair: View your exact #rank, percentile, median score, Top 5 leaderboard, personal best (★ NEW BEST), UTC countdown, one-tap + Join r/subreddit prompt, and automatic rank flair (✂️ Master Drafter · 🔥3d).
    • One-Tap Spoiler Comment Sharing: Post a spoiler-safe scorecard (>! ... !<) directly to the thread as your user, or copy it to the clipboard.
    • Craft & Post a Shape (UGC Mode): Place 4–8 points on the drafting grid (or pick a preset / Randomize), dial a target split (20/80–50/50), and publish a new playable interactive post directly to the subreddit.

How we built it

  • Platform & Stack: Built on Devvit Web (@devvit/web/server, @devvit/web/client) with React 19, Vite, Tailwind CSS 4, Hono, TypeScript, and Devvit Redis.
  • Shared Computational Geometry Engine (src/shared/geometry.ts):

    • Normalizes polygons to a [0, 1000] × [0, 1000] coordinate space so cuts scale identically across mobile and desktop.
    • Uses exact edge-intersection splitting with Simulation-of-Simplicity perturbation (handling both convex and concave polygons cleanly while rejecting multi-piece or incomplete cuts).
    • Computes exact piece areas via the Shoelace formula:

    $$A = \frac{1}{2} \left| \sum_{i=0}^{n-1} (x_i y_{i+1} - x_{i+1} y_i) \right|$$

    • Evaluates order-independent split error and round score:

    $$\text{error} = \left| \min(p_1, p_2) - p_{\text{target}} \right|, \qquad \text{score} = \max\left(0,\; 100 - 2.5 \cdot \text{error}\right)$$

    • Runs an 18-step binary search along the player's normal vector (findOptimalParallelCut) to render the post-cut optimal parallel ghost line in under 0.2ms.
  • Zero-Dependency Risograph Aesthetic & Audio: To stay 100% compliant with Reddit's strict webview CSP, we load zero external fonts, images, or audio files—using inline SVG <feTurbulence> paper grain, CSS blueprint dot grids, and a procedural Web Audio API synthesizer (src/client/utils/sound.ts).

  • Server Authority & Automation (src/server/): All cuts are re-verified server-side (/api/submit-round, /api/complete), scores are ranked in Redis sorted sets (lb:{postId}), crowd cuts are stored in timestamp-capped sorted sets (cuts:{postId}:{roundIndex}), and fresh daily posts are automated via a 0 0 * * * cron scheduler (/internal/scheduler/daily-post) and moderator menu action (/internal/menu/post-daily).

Challenges we ran into

  • Concave Polygon Slicing & Interior Labels: Splitting notched silhouettes like L-Blocks and Keystones can place a naive geometric centroid outside the severed piece. We solved this by implementing horizontal chord scanning (computeLabelPoint) so percentage badges always land cleanly inside each piece, and enforcing strict 2-piece Jordan Curve Theorem crossing validation.
  • Zero-Scroll Mobile & Desktop Fit: Fitting the Splash, Drafting Board, 3-pane End Card (Round Splits, Community Cut Map, and Top 5 Leaderboard), and UGC Shape Editor into Reddit's tall post iframe (375×600 mobile and desktop) with zero scrollbars required careful flex/viewport budgeting and adaptive mobile tabs.
  • Devvit runAs: 'USER' UGC Post Creation: During live testing on r/slice_craft_dev, our UGC creator initially failed with HTTP 500 because reddit.submitCustomPost({ runAs: 'USER' }) enforces a runtime requirement for userGeneratedContent. Adding userGeneratedContent alongside textFallback resolved it cleanly and verified end-to-end UGC posting on Reddit.

Accomplishments that we're proud of

  • Zero-Clutter Archival Craft: An unmistakable Risograph drafting aesthetic with tactile spring separation, live edge-crossing dots, optimal ghost cuts, and synthesized Web Audio—all under strict CSP with zero external assets.
  • 13/13 Automated Geometry & Daily Generator Unit Tests: Mathematically verifying convex/concave slicing, diagonal through-vertex cuts, multi-piece rejection, optimal parallel cut search, UGC 2KB postData compliance, and 60 consecutive UTC days of deterministic daily puzzles.
  • Full End-to-End Community Loop: Live daily posts, crowd cut overlays, subreddit leaderboards, automatic rank flair, spoiler-safe comment sharing, and working user-created challenge posts right inside the subreddit feed.

What we learned

  • Designing for Reddit's feed means the inline splash card is your first impression—showing live player counts, streaks, and the reigning leader turns passive scrolling into immediate play.
  • Keeping a shared, unit-tested TypeScript geometry module (src/shared/) makes server-side anti-cheat verification effortless because the server and client execute the exact same math.
  • Testing live inside r/slice_craft_dev early catches real Devvit runtime constraints (like userGeneratedContent on user-attributed custom posts and Redis sorted-set option shapes) that unit tests alone cannot reveal.

What's next for Slice Craft

  • Weekly Subreddit Tournaments & Archives: Browse and replay past daily puzzles with separate archival leaderboards.
  • Multi-Cut & Precision Modifiers: Special weekend master puzzles featuring 2-cut 3-way splits (33% / 33% / 34%) and blindfold precision modes.
  • Community Curated Packs: Let moderators pin top-upvoted UGC shapes from the subreddit into featured weekly challenges.

Built With

Share this project:

Updates

Submission history