main
Web Adventure - Community RPG
Disclaimer: 99% of this repository is vibe-coded. Check code & read what follows with discretion.
A multiplayer web-based RPG where players collaborate to defeat a boss monster within a time limit before the world resets.
Features
Core Gameplay
- Multiplayer World: All logged-in players share the same game world on a large grid
- Player Attributes: Level, Health, Experience, Action Points, Attack, Defense, Movement Range
- Inventory System: Gather wood and stone from resources
- Structure Building: Place houses, farms, and guard towers for bonuses
- Combat System: Fight monsters and bosses with attack/defense mechanics
- Time-Limited Rounds: 30-minute game sessions with boss as final objective
- Action Point System: Limited actions per minute (starts at 20, regenerates 1 per minute)
Game Mechanics
Player Progression
- Gain experience by defeating monsters
- Level up to increase max action points and strength
- Objective: Reach sufficient level to help defeat the boss
Monster System
- Monsters spawn randomly on the map
- Each has health, attack, and defense stats
- Varied difficulty levels
- Boss appears when conditions are met (high player levels, enough players online)
Building System
- House: Basic structure, provides max health bonus
- Farm: Increases action point regeneration rate
- Guard Tower: Provides defense bonus to nearby players
Resource Gathering
- Trees provide wood
- Mountains provide stone
- Limited gathering capacity per action
- Resources regenerate over time
Victory Condition
- Players must defeat the boss before 30 minutes elapse
- Requires coordination, high levels, and strategic structures
- On victory: Players gain major experience rewards
- On failure: World resets, players return to level 1
Installation
Prerequisites
- Python 3.8+
- pip
Setup
- Navigate to the project directory:
cd /Users/luka/dev/me/web-adventure
- Install dependencies:
pip install -r requirements.txt
- Start the backend server:
python -m uvicorn backend:app --reload --host 0.0.0.0 --port 8000
- Open a browser and navigate to:
file:///Users/luka/dev/me/web-adventure/index.html
How to Play
Login
- Enter your username (1-30 characters)
- Choose your player color
- Click "Enter the World"
Movement
- Use the directional buttons (⬆ ⬇ ⬅ ➡) to move up to 5 tiles
- Each move costs 1 action point
Gathering
- Click the 🌳 Gather button to collect resources from nearby trees/mountains
- Gathered items go into your inventory
Combat
- Click the ⚔️ Attack button to attack nearby monsters or the boss
- Damage = your attack - monster's defense + random variance
- Each attack costs 1 action point
Building
- Click 🏠 House, 🌾 Farm, or 🛡️ Tower to build structures
- Each structure requires resources and 1 action point
- Structures provide bonuses:
- House (+20 max health): Increases survivability
- Farm (+2 action regeneration): Generates action points faster
- Guard Tower (+2 defense): Improves defense stats
Action Points
- Start with 20 action points per session
- Regenerate 1 per minute naturally
- Farms nearby increase regeneration rate
- Every action (move, attack, gather, build) costs 1 action point
- Higher levels increase your max action points
Winning
- Reach the boss level (requires level 10+ by default)
- Coordinate with other players to attack the boss
- Defeat the boss before time runs out
- Earn major experience rewards
Game Configuration
Edit the constants in backend.py to customize:
GAME_DURATION: Game round length (seconds)GRID_SIZE: Map dimensions (tiles)ACTION_POINTS_MAX: Starting action pointsBOSS_SPAWN_DISTANCE: Distance boss spawns from playersMONSTER_SPAWN_RATE: Frequency of monster spawning
Architecture
Backend (FastAPI + WebSockets)
- RESTful API for login, movement, and actions
- WebSocket connection for real-time game state updates
- In-memory game world state
- Automatic game tick system for respawning and regeneration
Frontend (HTML5 + Three.js)
- 3D game world visualization using Three.js
- Real-time UI showing player stats and game status
- Responsive control panel for all game actions
- Smooth camera following player movement
Files
backend.py: FastAPI server with game logicindex.html: Complete frontend with 3D renderingrequirements.txt: Python dependenciesmain.py: Placeholder (not used)
Future Enhancements
- Persistent player profiles and statistics
- More structure types with unique abilities
- Trading between players
- PvP combat
- Quests and achievements
- More sophisticated AI for monsters
- Player guilds/teams
- Seasonal leaderboards
- Mobile app version
Description
Web adventure prototype. Disclaimer: this is vibe-coded using my company's tokens
243 KiB
Languages
HTML
60.7%
Python
38.8%
Shell
0.5%