Skip to content

Topo1995/risk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Local Multiplayer Mission Game

A real-time multiplayer mission game built with Flask-SocketIO and React. Players join on the same WiFi network to complete missions, draw event cards, and compete in a shared lobby managed by an admin who also participates as a player.

๐ŸชŸ Windows Users - Quick Start!

Download the project and double-click start.bat - that's it!

For detailed Windows instructions, see WINDOWS_SETUP.md

โœจ Features

  • Local Multiplayer: Up to 6 players can join on the same WiFi network
  • Admin Player System: First player becomes admin with full player capabilities plus game management controls
  • Mission System: Each player draws 4 unique missions from a shared deck
  • Event Cards: Admin can draw and expire event cards visible to all players
  • Real-time Sync: All game actions synchronized via WebSockets
  • Mobile-Optimized UI: Large buttons and text, perfect for smartphone gameplay

๐Ÿš€ Quick Start

Windows (Easiest!)

  1. Install Prerequisites (one-time):

  2. Run the Game:

See WINDOWS_SETUP.md for detailed Windows instructions!

Mac/Linux

  1. Install Dependencies:
pip install -r requirements.txt
cd frontend
npm install
cd ..
  1. Run the Game:
cd frontend && npm run build && cd .. && python main.py

Then open: http://localhost:5000

๐Ÿ“ฑ WiFi Multiplayer

To play with friends on the same WiFi:

On Your Host Computer:

  1. Start the server (use methods above)
  2. Find your IP address:
    • Windows: Run ipconfig in Command Prompt
    • Mac: Run ifconfig in Terminal
    • Linux: Run ip addr in Terminal
  3. Look for your local IP (e.g., 192.168.1.100)

On Other Devices:

  1. Connect to the same WiFi network
  2. Open browser to: http://YOUR_IP:5000
    • Example: http://192.168.1.100:5000

Everyone must be on the same WiFi network!

๐ŸŽฎ How to Play

Joining the Game

  1. Open the game URL in your browser
  2. Enter your name to join the lobby
  3. First player to join becomes the Admin (but also plays normally)
  4. Wait for all players to join (max 6 players)
  5. Admin (player named "Stephan") clicks "Spiel Starten" to begin

Playing Missions

  1. Each player automatically draws 4 unique missions when the game starts
  2. View your current mission (only you can see it)
  3. When you complete a mission:
    • Click "Mission Erfรผllt" to reveal it to all players
    • Admin reviews and either Approves or Rejects
    • If approved, you move to your next mission
    • If rejected, you try the same mission again

Event Cards

  • Admin can draw event cards that affect gameplay
  • Events are visible to all players
  • Events add fun challenges and rule changes
  • Admin can manually expire events when done

Admin Controls

The admin player (must be named "Stephan") has additional controls:

  • Spiel Starten: Begin the mission game
  • Genehmigen/Ablehnen: Approve or reject completed missions
  • Event ziehen: Draw new event cards
  • Beenden: Remove active events
  • Reset: Start a new game

Winning

  • Complete all 4 of your missions
  • Player with most completed missions wins!

๐Ÿ“ Project Structure

project/
โ”œโ”€โ”€ start.bat              # ๐ŸชŸ Windows quick start (double-click this!)
โ”œโ”€โ”€ start.ps1              # ๐ŸชŸ PowerShell alternative
โ”œโ”€โ”€ WINDOWS_SETUP.md       # ๐ŸชŸ Detailed Windows guide
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”œโ”€โ”€ main.py                # Main server entry point
โ”œโ”€โ”€ app.py                 # Flask application & game logic
โ”œโ”€โ”€ cards/                 # Game data
โ”‚   โ”œโ”€โ”€ missions.json      # Mission cards
โ”‚   โ””โ”€โ”€ events.json        # Event cards
โ””โ”€โ”€ frontend/              # React application
    โ”œโ”€โ”€ src/               # Source code
    โ”œโ”€โ”€ dist/              # Built files (auto-generated)
    โ””โ”€โ”€ package.json       # Frontend dependencies

๐Ÿ› ๏ธ Tech Stack

  • Backend: Python 3.11, Flask, Flask-SocketIO, Eventlet
  • Frontend: React, Vite, TailwindCSS, Socket.IO Client
  • Data: JSON files for missions and events
  • Storage: In-memory (resets on server restart)

๐ŸŽจ Mobile Design

The app is optimized for smartphone use:

  • Large, easy-to-tap buttons (minimum 56px height)
  • Big, readable text (20-32px base size)
  • Generous spacing between elements
  • Touch-friendly interactions
  • Beautiful gradient designs

๐Ÿ”ง Customization

Adding Missions

Edit cards/missions.json:

{
  "id": 25,
  "Kategorie": "Hauptmann",
  "Zeitpunkt": "Jederzeit",
  "Name": "Your Mission Title",
  "Beschreibung": "What players need to do"
}

Adding Events

Edit cards/events.json:

{
  "id": 11,
  "Name": "Your Event Title",
  "Beschreibung": "Event rules or effects"
}

โ— Troubleshooting

Windows: "Python is not recognized"

  • Python not installed or not in PATH
  • Reinstall Python and check "Add Python to PATH"

Windows: "Node is not recognized"

"Verbindung zum Server..." (Can't Connect)

  • Server is not running - start it first!
  • Use the correct URL: http://localhost:5000 for local
  • Check firewall isn't blocking port 5000

WiFi Multiplayer Not Working

  • Everyone on same WiFi network?
  • Use actual IP address (not localhost) when sharing
  • Check firewall/router settings
  • Disable "AP Isolation" if enabled on router

Port 5000 Already in Use

  • Close other programs using port 5000
  • Or edit main.py to use different port

๐Ÿ“š Documentation

๐Ÿ› Development

Running in Dev Mode

Backend (Terminal 1):

python main.py

Frontend (Terminal 2):

cd frontend
npm run dev

Frontend dev server runs on port 5173. Update socket connection if needed.

Building for Production

cd frontend
npm run build
cd ..
python main.py

๐Ÿ“ License

This project is open source and available for personal and educational use.


Need help? Check WINDOWS_SETUP.md for Windows-specific instructions!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published