new file: Dockerfile new file: README.md new file: app.py new file: index.html new file: projekte des/PROJECT_DESCRIPTION.txt new file: projekte des/WEBSITE_DESCRIPTION.md new file: projekte des/website_project_description_en.txt new file: requirements.txt new file: script.js new file: static/css/styles.css new file: static/js/script.js new file: styles.css new file: templates/about.html new file: templates/base.html new file: templates/contact.html new file: templates/index.html new file: templates/minecraft.html new file: templates/project_detail.html new file: templates/projects.html
160 lines
7.0 KiB
Plaintext
160 lines
7.0 KiB
Plaintext
# Hearts of Iron IV ELO Discord Bot
|
|
|
|
## Project Overview
|
|
|
|
A sophisticated Discord bot designed specifically for Hearts of Iron IV multiplayer communities, featuring a complete ELO rating system similar to chess rankings. This bot helps organize competitive matches, track player performance, and maintain fair gameplay through advanced statistical analysis.
|
|
|
|
## 🎮 Key Features
|
|
|
|
### ELO Rating System
|
|
- **Dual Rating Modes**: Separate ELO ratings for Standard and Competitive gameplay
|
|
- **Chess-like Algorithm**: Uses proven ELO formula with HOI4-specific modifications
|
|
- **T-Level System**: Country tier-based multipliers (T1: 0.8x, T2: 1.0x, T3: 1.2x points)
|
|
- **Draw Support**: Intelligent draw handling with ELO adjustments based on team strength differences
|
|
- **Starting Rating**: 800 ELO for all new players
|
|
|
|
### Game Management
|
|
- **Match Creation**: `/hoi4create` - Set up Standard or Competitive games
|
|
- **Player Setup**: `/hoi4setup` - Add players with team assignments and T-levels
|
|
- **Game Completion**: `/hoi4end` - Process results and calculate ELO changes automatically
|
|
- **Live Tracking**: Real-time game status and player management
|
|
|
|
### Statistics & Analytics
|
|
- **Player Profiles**: Comprehensive stats with ELO rankings and percentiles
|
|
- **Win/Draw/Loss Records**: Complete match history tracking
|
|
- **Leaderboards**: Ranked player lists with detailed performance metrics
|
|
- **Match History**: Searchable game archive with filtering options
|
|
|
|
### Advanced Features
|
|
- **Hybrid Commands**: All commands work as both slash (/) and text (!) commands
|
|
- **Permission System**: Owner-only administrative commands
|
|
- **Error Handling**: Robust error management with detailed logging
|
|
- **Database Integration**: MySQL support with automatic table creation
|
|
|
|
## 🛠 Technical Implementation
|
|
|
|
### Architecture
|
|
- **Framework**: Discord.py 2.3.2 with hybrid command system
|
|
- **Database**: MySQL with aiomysql for async operations
|
|
- **Deployment**: Docker containerization with Coolify support
|
|
- **Environment**: Python 3.10+ with comprehensive dependency management
|
|
|
|
### Database Schema
|
|
```sql
|
|
-- Players table with dual ELO ratings
|
|
players (discord_id, username, standard_elo, competitive_elo, timestamps)
|
|
|
|
-- Games with JSON player data and match metadata
|
|
games (game_name, game_type, status, players, winner_team, timestamps)
|
|
|
|
-- Detailed match results for statistical analysis
|
|
game_results (game_id, discord_id, team_info, elo_changes, result_type)
|
|
```
|
|
|
|
### ELO Calculation Algorithm
|
|
```python
|
|
# Standard ELO formula with HOI4 modifications
|
|
expected_score = 1 / (1 + 10^((opponent_avg - player_elo) / 400))
|
|
elo_change = K_FACTOR * (actual_score - expected_score) * t_level_multiplier
|
|
|
|
# Result scoring: Win=1.0, Draw=0.5, Loss=0.0
|
|
# K-Factor: 32 (standard competitive value)
|
|
```
|
|
|
|
## 🚀 Deployment & Infrastructure
|
|
|
|
### Docker Configuration
|
|
- **Base Image**: Python 3.10-slim for optimal performance
|
|
- **Dependencies**: Automated installation with requirements.txt
|
|
- **Environment Variables**: Secure configuration through Coolify
|
|
- **Health Checks**: Built-in monitoring and error reporting
|
|
|
|
### Coolify Integration
|
|
- **One-Click Deployment**: Seamless integration with Coolify platform
|
|
- **Environment Management**: Secure handling of tokens and database credentials
|
|
- **Scaling Support**: Ready for multi-server Discord communities
|
|
- **Backup Compatible**: Database-driven design supports easy backups
|
|
|
|
### Security Features
|
|
- **Owner Verification**: ID-based permission system (253922739709018114)
|
|
- **Input Validation**: Comprehensive parameter checking and sanitization
|
|
- **Error Isolation**: Graceful handling of edge cases and database issues
|
|
- **Rate Limiting**: Discord API compliance with proper request management
|
|
|
|
## 📊 Command Reference
|
|
|
|
### Core Commands
|
|
- `/hoi4create <type> <name>` - Create new match (standard/competitive)
|
|
- `/hoi4setup <game> <@user> <team> <t-level>` - Add player to match
|
|
- `/hoi4end <game> <winner/draw>` - Complete match and process ELO
|
|
- `/hoi4stats [@user]` - View detailed player statistics
|
|
- `/hoi4leaderboard [type] [limit]` - Display ranked player lists
|
|
- `/hoi4history [filters]` - Browse completed matches
|
|
- `/hoi4games` - Show active matches in setup phase
|
|
|
|
### Administrative
|
|
- `/reload` - Sync commands and restart bot functions (Owner only)
|
|
|
|
## 🎯 Use Cases
|
|
|
|
### Competitive Communities
|
|
Perfect for established HOI4 multiplayer groups wanting to:
|
|
- Track long-term player improvement and skill development
|
|
- Create balanced teams based on statistical performance
|
|
- Organize tournaments with proper seeding and brackets
|
|
- Maintain historical records of community achievements
|
|
|
|
### Casual Gaming Groups
|
|
Ideal for friends who want to:
|
|
- Add competitive elements to regular gaming sessions
|
|
- See progression over time with visual feedback
|
|
- Settle debates about who's actually the best player
|
|
- Encourage consistent participation through gamification
|
|
|
|
### Content Creators
|
|
Valuable for streamers and YouTubers to:
|
|
- Create engaging tournament-style content
|
|
- Provide viewers with statistical context during matches
|
|
- Build narrative around player rivalries and comebacks
|
|
- Generate data-driven content about community performance
|
|
|
|
## 🔮 Future Enhancement Possibilities
|
|
|
|
### Advanced Analytics
|
|
- **Performance Trends**: ELO progression graphs and trend analysis
|
|
- **Country Statistics**: Track performance by nation selection
|
|
- **Team Synergy**: Analyze optimal team compositions
|
|
- **Seasonal Resets**: Periodic ranking resets with historical preservation
|
|
|
|
### Integration Options
|
|
- **Web Dashboard**: Comprehensive statistics portal
|
|
- **Match Scheduling**: Calendar integration for planned games
|
|
- **Streaming Integration**: OBS overlays with live statistics
|
|
- **API Endpoints**: Third-party tool integration capabilities
|
|
|
|
### Community Features
|
|
- **Achievement System**: Unlock rewards for milestones
|
|
- **Clan Support**: Team-based rankings and competitions
|
|
- **Tournament Brackets**: Automated tournament management
|
|
- **Mentorship Matching**: Pair experienced players with newcomers
|
|
|
|
## 💡 Technical Highlights
|
|
|
|
This project demonstrates proficiency in:
|
|
- **Asynchronous Programming**: Efficient handling of concurrent Discord interactions
|
|
- **Database Design**: Normalized schema with performance optimization
|
|
- **API Integration**: Discord.py library mastery with modern best practices
|
|
- **DevOps Practices**: Containerization and deployment automation
|
|
- **Mathematical Algorithms**: Implementation of proven rating systems
|
|
- **User Experience**: Intuitive command design with comprehensive error handling
|
|
|
|
## 🏆 Project Impact
|
|
|
|
The HOI4 ELO Bot transforms casual gaming communities into structured competitive environments while maintaining the fun and social aspects that make multiplayer gaming enjoyable. By providing objective performance metrics and historical tracking, it helps players improve their skills and creates lasting engagement within gaming communities.
|
|
|
|
---
|
|
|
|
**Developer**: simolzimol
|
|
**Project Type**: Discord Bot / Community Management Tool
|
|
**Technology Stack**: Python, Discord.py, MySQL, Docker, Coolify
|
|
**Status**: Production Ready |