A classroom game demonstrating the tragedy of the commons concept.
cd server
npm install
npm startThe server runs on port 4001 by default.
cd client
npm install
npm run devThe client runs on port 3001 by default.
- Multiple ponds with 4 students per pond
- 5 rounds total
- Starts with 20 fish per pond
- Each student can catch 0-5 fish per round
- After each round, remaining fish double (capped at 40)
- At game end, uncaught fish are split proportionally among players
- Goal: Catch the most fish by the end of the game
- Instructor creates a session and shares the code
- Students join with the session code
- Once students have joined, the instructor starts the game (AI players fill to groups of 4)
- Each round, students decide how many fish to catch
- After 5 rounds, the game ends and shows the final results
- Push your code to GitHub
- Go to Render Dashboard
- Click "New +" → "Blueprint"
- Connect your GitHub repository
- Select the
commons-gamedirectory - Render will automatically detect
render.yamland deploy
Your backend will be available at: https://commons-game-server.onrender.com
- Go to Vercel Dashboard
- Click "Add New" → "Project"
- Import your GitHub repository
- Configure the project:
- Framework Preset: Vite
- Root Directory:
client - Build Command:
npm run build - Output Directory:
dist
- Add Environment Variable:
- Name:
VITE_SOCKET_URL - Value:
https://commons-game-server.onrender.com(your Render backend URL)
- Name:
- Click "Deploy"
Your frontend will be available at: https://your-project.vercel.app
To test the game locally with automated browsers:
npm run automateTo enable auto-submission with 5 students:
npm run automate -- -a 5To test the online/production version:
npm run automate -- -oTo test online with auto-submission and 3 students:
npm run automate -- -a 3 -oFlags:
-aor--auto: Enable automatic fish submission (optionally followed by number of students)-oor--online: Test against production URLs (https://commons-game.vercel.app)