Skip to content

Repository files navigation

RPS Lane War

A real-time multiplayer browser game where two players battle by spawning Rock, Paper, Scissors units into three horizontal lanes. Units automatically move toward the opponent's base, colliding and resolving with standard RPS rules (Rock beats Scissors, Scissors beats Paper, Paper beats Rock). The goal is to get units past defenses to damage the opponent's base 20 times.

Features

  • Real-time gameplay with Socket.io
  • Optimistic UI with rate limiting
  • Visual feedback for blocked lanes
  • Spectator mode for extra players

Tech Stack

  • Frontend: Vanilla JavaScript, Canvas API, Socket.io-client
  • Backend: Node.js, Express, Socket.io
  • Rendering: Emoji-based units on HTML5 Canvas

How to Run Dev Server

Quick Start

  1. Install dependencies: ./install-deps.sh
  2. Start servers: ./run-dev.sh
  3. Open http://localhost:5173 in two browser windows/tabs.

Manual Setup

  1. Install root dependencies: npm install
  2. Install client dependencies: cd client && npm install && cd ..
  3. Start dev servers: npm run dev
  4. Access at http://localhost:5173.

The server runs on port 3000, client on 5173 with proxy.

How to Play

  1. Join Game: Open the page; first two players are assigned P1/P2, extras spectate.
  2. Select Unit: Click "Select Rock/Paper/Scissors" to choose spawn type.
  3. Spawn Units: Click a lane (top/middle/bottom) to spawn the selected unit.
  4. Strategy: Units cost 3 energy (regens over time). Spawns in same lane blocked for 0.25s, shown by grey overlay.
  5. Win Condition: Reduce opponent's HP to 0 by reaching their base. Game ends with full-screen winner message.

Controls

  • Select buttons: Choose unit type (persistent until changed).
  • Lane clicks: Spawn in vertical position (top/middle/bottom).
  • Reset: Restart game after win.

Enjoy battling with RPS strategy! README.md

About

Nothing beats rock. Except paper.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages