League of Legends Quartett
A web-based card game inspired by the classic German "Quartett" game, featuring League of Legends champions with dynamic stat comparisons.
š® Game Overview
Compare champion stats in head-to-head battles! Each round, players choose one of four stats to compare at a randomly generated level. The player with the higher stat wins both cards. The game continues until one player has all the cards.
Stats Compared
- Attack Damage āļø
- Health ā¤ļø
- Armor š”ļø
- Magic Resist āØ
š Features
- Three Game Modes:
- vs AI: Single player with 3 difficulty levels (Easy/Medium/Hard)
- Local Multiplayer: Pass-and-play on same device
- Online Multiplayer: Real-time matches across the internet
- Training Grounds: Interactive tutorial accessible via help icon (?)
- Pre-Game Settings: Configure your game before starting
- Deck Size: Choose 10 (Quick), 15 (Normal), or 20 (Extended) cards per player
- AI Difficulty: Select Easy, Medium, or Hard before AI battles
- Dynamic Levels: Random level (1-18) each round for varied gameplay
- Smart AI Opponent:
- Easy (random choices)
- Medium (strategic stat selection)
- Hard (pattern recognition with 15% fallibility for balanced gameplay)
- Smooth Round Results: Auto-advancing toast notifications with skip option
- Real-time Online Play: Firebase-powered multiplayer with room codes
- Synchronized Multiplayer: Identical game state across all devices
- Turn-based Online Control: Proper turn management with real-time updates
- Enterprise Security: Production-grade Firebase security rules
- Real-time Scoreboard: Track wins, percentages, and game progress
- Champion Data: All ~160 LoL champions with official Riot stats
- Responsive Design: Works on desktop and mobile
- Offline Caching: Champion data cached locally for fast gameplay
š ļø Technology Stack
- Frontend: Svelte 5 + Vite
- Styling: Tailwind CSS
- Data Source: Riot Games Data Dragon API
- State Management: Svelte stores
- Caching: localStorage
- Online Multiplayer: Firebase Realtime Database
- Deployment: Firebase CLI + Hosting
- Security: Firebase Security Rules
š¦ Installation
# Clone the repository
git clone <repository-url>
cd lol-quartett
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
šÆ How to Play
Single Player / Local Multiplayer:
- Choose Game Mode: Select "AI Duel", "Local Clash", or "Online Arena" (use ? icon for tutorial)
- Configure Settings: Choose deck size (10/15/20 cards) and AI difficulty
- Your Turn: Click on a stat you think will be higher than your opponent's
- Comparison: Stats are calculated at the random level and compared
- Round Result: Toast shows winner, auto-advances after 2.5s (or click Skip)
- Win Cards: Higher stat wins both cards, lower stat loses their card
- Continue: Winner goes first in the next round
- Victory: Game ends when one player has all cards
Online Multiplayer:
- Create Room: Click "Online Arena" ā "Create Room" ā Share room code
- Join Room: Enter room code from another player
- Ready Up: Both players ready up to start
- Synchronized Gameplay:
- Both players see identical cards and levels
- Turn-based play (host goes first as Player 1)
- Real-time synchronization of all moves
- Only current player can select stats
- Victory: Winner takes all cards across both devices!
šļø Project Structure
src/
āāā components/
ā āāā ChampionCard.svelte # Individual champion card display
ā āāā GameBoard.svelte # Main game interface
ā āāā GameSettings.svelte # Pre-game settings (deck size, AI difficulty)
ā āāā RoundResultToast.svelte # Auto-advancing round result notification
ā āāā Scoreboard.svelte # Win tracking and progress
ā āāā OnlineMenu.svelte # Online multiplayer menu
ā āāā OnlineLobby.svelte # Room creation/joining with settings
ā āāā Onboarding.svelte # Tutorial system
āāā services/
ā āāā championService.js # Data Dragon API integration
ā āāā firebaseConfig.js # Firebase configuration
ā āāā onlineGameService.js # Online multiplayer logic
āāā stores/
ā āāā gameStore.js # Game state + settings management
ā āāā onlineGameStore.js # Online game state
āāā utils/
ā āāā statCalculator.js # Level-based stat calculations
ā āāā statConfig.js # Stat labels, icons, and colors
ā āāā aiOpponent.js # AI strategy and difficulty
āāā App.svelte # Root component
# Configuration Files
āāā firebase.json # Firebase project config
āāā database.rules.json # Security rules
āāā .firebaserc # Project mapping
āāā .env # Environment variables
š¤ AI Difficulty Levels
- Easy: Random stat selection with quick response time
- Medium: Strategic stat selection based on advantage calculations
- Hard: Advanced strategy with player pattern recognition (15% chance of suboptimal choice for balanced gameplay)
š Champion Stats Calculation
Stats are calculated using Riot's formula:
finalStat = baseStat + (perLevelStat Ć (level - 1))
šØ Design Features
- Dark theme with League of Legends inspired colors
- Animated stat comparisons and transitions
- Champion portraits from official Riot CDN
- Progressive win rate visualization
- Responsive card layouts
š§ Development Commands
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
# Firebase Deployment
npm run firebase:deploy:rules # Deploy security rules only
npm run firebase:deploy:hosting # Deploy hosting only
npm run firebase:deploy # Deploy everything
š Game Rules
- Each player starts with half the champion deck
- A random level (1-18) is generated each round
- Active player chooses which stat to compare
- Higher stat wins both cards
- Ties result in each player keeping their card
- Winner of each round goes first next round
- Game ends when one player has all cards
š Security & Production Ready
- Enterprise-grade Firebase security rules
- Data validation and structure enforcement
- Access control and permission management
- Production deployment with Firebase CLI
- Environment variable security
- Real-time game state synchronization
- Automatic room cleanup service
š® Online Multiplayer Features
- Perfect Synchronization: Both players see identical cards, levels, and game state
- Turn-based Control: Host (Player 1) and Guest (Player 2) alternate turns
- Real-time Updates: Every move instantly synchronized across devices
- Room Management: Automatic cleanup of abandoned rooms every 5 minutes
- Reconnection Handling: Game state persists if players reconnect
š Future Enhancements
- Tournament brackets
- Champion filtering and selection
- Custom stat weights
- Game replay system
- Player profiles and statistics
- Mobile app version
- Spectator mode
- Sound effects and music
Built with ā¤ļø using Svelte and the Riot Games API