Inspiration

I grew up on classic dig-and-collect arcade games like Boulder Dash and Dig Dug, where one wrong move sends a boulder crashing down on your head. I wanted to capture that "just one more run" tension in a format that fits a Reddit post — something you can pick up in a single tap, play for 60 seconds, and immediately want to beat your friends at. Rockey the Miner is that itch made real.

## What it does

You control Rockey, a pixel-art miner racing a 60-second clock:

  • Mine dirt and ore by walking or tapping into them — each block takes a few hits, with cracking animations as it breaks.
  • Collect rubies (+10 points, +1 second) and golden rubies (+50 points, +3 seconds) to keep your run alive.
  • Watch your head — digging under stone makes it fall. Get crushed, or take a long fall, and you lose a life. Three lives and you're out.
  • Compete on a global leaderboard tied to your Reddit username, so every subreddit becomes its own mining contest.

## How I built it

  • Phaser 4 powers the game itself — a 50×50 tile grid with a custom gravity engine that drops stones and gems one row at a time, crack-stage mining, particle dust/debris, and a camera that follows Rockey at a zoomed-in 7×7 view.
  • React 19 wraps the game as a UI shell: the main menu, pause/game-over/victory screens, settings, rules, and the live HUD (score, timer, lives). Phaser and React talk to each other through a lightweight custom-event bridge on window.
  • Hono + Redis on Devvit's server handle persistence — a Redis sorted set stores each player's best score for the leaderboard.
  • Web Audio API generates all sound effects procedurally (jump, mining, gem pickup, hurt, victory) — no audio files, just oscillators for an authentic 8-bit feel.
  • Reddit Devvit ties it together so the whole thing runs natively inside a Reddit post, with a moderator menu action to create new game posts.

## What I learned

  • Bridging two rendering paradigms — Phaser's canvas game loop and React's declarative UI — without them fighting over input and state.
  • Writing a deterministic, row-by-row gravity simulation that feels physical but stays predictable enough to be fair.
  • Making a single layout scale cleanly across Reddit's desktop and mobile webviews using responsive clamp()/vmin sizing and on-screen touch controls.

## Challenges I ran into

  • Falling-block physics: getting stones to fall, crush the player, and let gems be auto-collected on the way down — all without race conditions in the grid — took several iterations.
  • Input across devices: unifying keyboard, on-screen D-pad, and tap-to-mine into one control path that feels responsive on both desktop and phone.
  • Fitting the UI: Reddit post webviews come in many sizes, so every menu had to shrink to fit instead of overflowing.

## What's next

Daily leaderboards, power-ups (dynamite!), deeper procedural cave layouts, and special event ores.

Built With

Share this project:

Updates