Skip to content

About

Browser 3D random defense game in the style of Warcraft III custom maps, built with React Three Fiber

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

Loop Randy

A small 3D random defense game that runs in the browser. Monsters run laps around a square lane, you summon random units to stand inside it, merge duplicates into stronger ones, and walk your army across a bridge to fight a boss every fifth wave.

Jinwoo and I started it in November 2025 as something to play with friends, inspired by the "random defense" custom maps from Warcraft III (원랜디, 나랜디). The first build wasn't the defense game I had in mind, so I sketched the map and we planned it again; two days later we dropped the Phaser 2D version for the React Three Fiber test scene. Most of the work went into RTS-style controls (box selection, right-click orders, control groups) and skinned characters with several animations each.

Play in your browser: https://jayyo.github.io/loop-randy/ (desktop, mouse and keyboard; about 4.5 MB of models load first)

Gameplay

Status: playable single-player game, about 10 minutes per run. Desktop browser with mouse and keyboard. No sound, no multiplayer.

How to play

  • Monsters walk around the lane until they die. If 40 are on the lane for three seconds, you lose.
  • Summon a random unit for 25 gold (R). Kills pay 2 gold, each new wave 15.
  • Select a unit and press M to merge it with two others of the same kind and tier. A tier 2 unit hits 3.5 times as hard as a tier 1, and you only have 20 unit slots.
  • Waves 5, 10, 15 and 20 put a boss on the platform across the bridge. Send units over (B moves the camera there) and kill it within 60 seconds. The lane keeps running while you're away.
  • Clear wave 20 to win.
Input Action
Left click / drag Select units (Shift adds to the selection)
Double click Select every unit of that kind and tier
Right click Move the selected units
R / M / Q / S Summon / merge / use skill / stop
Ctrl+1-9, 1-9 Save / recall a control group
Ctrl+A Select all units
Wheel, Ctrl+wheel Zoom, tilt
Middle drag, arrow keys Pan
B / H Look at the boss platform / home
P / F Pause / 2x speed

There are two units. The Striker attacks quickly and sometimes lands a spinning kick for 1.8x damage; its skill is a flying kick on the nearest enemy. The Vanguard hits harder and more slowly; its jump attack damages everything in range.

Selected unit and the lane

Boss fight on the platform

Running it

Requires Node.js 22.13 or newer (CI uses Node 24).

cd client
npm ci
npm run dev        # http://localhost:3000

Other scripts in client/:

npm run build      # type check + production build into client/dist
npm run preview    # serve the production build
npm test           # unit tests for the game rules
npm run lint

With Docker instead: docker compose up for the dev server, or docker compose --profile production up client-prod for the nginx build on http://localhost:8080.

Every push to main builds the client and publishes it to GitHub Pages (.github/workflows/pages.yml). The site lives under /loop-randy/, so the workflow passes that path to Vite as --base. To check a build under the same path locally:

npm run build -- --base=/loop-randy/
npm run preview -- --base=/loop-randy/   # http://localhost:4173/loop-randy/

firebase.json also works for Firebase Hosting if you prefer it: firebase deploy --only hosting --project <your-project-id>.

How it works

  • Rendering: React Three Fiber with a few drei helpers. The arena, lane, bridge and boss platform are built from primitives in client/src/game/terrain.
  • Game state: a small zustand store (client/src/game/store.ts) holds the wave, gold, selection and the lists of units and monsters. Units and monsters are plain mutable objects, so a hit changes a number instead of re-rendering the scene. React only re-renders when something spawns, dies or the HUD changes.
  • Game clock: GameDirector advances one clock per frame and runs the wave rules (spawns, timers, win and loss). Cooldowns, spawns and boss timers all read that clock, so pausing or 2x speed affects them equally, and a background tab (which gets no frames) simply stops the game.
  • Units: each unit runs its own small state machine in useFrame: move along waypoints (the bridge has ramps, so there's a tiny path finder), pick the nearest monster in range, play the attack clip and apply damage at the impact point. On the boss platform they close in on the boss.
  • Models: three Mixamo characters. Mixamo exports one file per animation with a full copy of the mesh, which added up to 240 MB. tools/pack-models.mjs merges each character into one GLB with named clips and WebP textures, about 4.5 MB in total. See docs/assets.md.
client/src/game/
  GameScene.tsx      Canvas, lights and HUD layout
  GameDirector.tsx   per-frame clock and wave rules
  store.ts           game state and player commands
  gameData.ts        unit stats, wave scaling, economy
  entities/          units and monsters
  controllers/       camera, selection, keyboard shortcuts
  terrain/           arena, lane, bridge, boss platform
  ui/                HUD panels and overlays
tools/               model packing scripts

Known limitations

  • Mouse and keyboard only; it doesn't work on phones.
  • Balance is a first pass. It was tuned with scripted playthroughs: a player that summons and merges but never uses skills usually falls between waves 13 and 18.
  • Only two unit types and one monster model.
  • The JavaScript bundle is about 350 KB gzipped, mostly three.js.

Credits

Made by Jay Cho (@Jayyo) and Jinwoo Choung (@vpsxkqktm). Characters and animations are from Adobe Mixamo.


한국어

워크래프트3 랜덤 디펜스(원랜디, 나랜디)를 웹 3D로 옮겨 본 사이드 프로젝트입니다. 2025년 11월 진우와 지인들끼리 하려고 시작했고, 첫 빌드가 생각한 디펜스와 달라 맵을 그려서 다시 기획한 뒤 Phaser 2D 버전을 접고 3D 테스트 장면을 본편으로 삼았습니다. 몬스터가 사각 레인을 계속 돌고, 골드로 무작위 유닛을 소환해 막습니다. 같은 유닛 3개를 합치면 한 단계 위 유닛이 되고, 5웨이브마다 다리 건너 보스 플랫폼에 보스가 나와 60초 안에 잡아야 합니다. 레인 위 몬스터가 40마리 이상인 상태로 3초가 지나면 패배하고, 20웨이브의 마지막 보스와 레인에 남은 몬스터를 모두 잡으면 승리입니다.

브라우저에서 바로 하기: https://jayyo.github.io/loop-randy/ (PC 브라우저)

실행: cd client && npm ci && npm run dev 후 http://localhost:3000 에 접속합니다. 마우스와 키보드가 필요하며 모바일은 지원하지 않습니다.

About

Browser 3D random defense game in the style of Warcraft III custom maps, built with React Three Fiber

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages