Files

159 lines
4.8 KiB
Markdown

# 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
1. Navigate to the project directory:
```bash
cd /Users/luka/dev/me/web-adventure
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Start the backend server:
```bash
python -m uvicorn backend:app --reload --host 0.0.0.0 --port 8000
```
4. Open a browser and navigate to:
```
file:///Users/luka/dev/me/web-adventure/index.html
```
## How to Play
### Login
1. Enter your username (1-30 characters)
2. Choose your player color
3. 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 points
- `BOSS_SPAWN_DISTANCE`: Distance boss spawns from players
- `MONSTER_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 logic
- `index.html`: Complete frontend with 3D rendering
- `requirements.txt`: Python dependencies
- `main.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