Lymphatus/flag-game

โ˜… 0Forks 0TypeScriptGitHub โ†—Compare

README

๐Ÿšฉ Flag Game - Multiplayer Flag Guessing Game

A real-time multiplayer game where players compete to identify world flags as quickly as possible!

๐ŸŽฎ How to Play

Joining a Game

  1. Create a Room: Enter your name and click "Create Room" to start a new game room. You'll receive a room code to share with friends.
  2. Join a Room: Enter your name and the room code shared by a friend, then click "Join Room".

Game Rules

  • Each room can have a maximum of 10 players
  • The game consists of 10 rounds
  • Each round, a random world flag is displayed
  • Players have 20 seconds to guess the country
  • Use the autocomplete search to select your answer from the list of countries
  • Scoring:
    • ๐Ÿฅ‡ First correct answer: 10 points
    • ๐Ÿฅˆ Second correct answer: 9 points
    • ๐Ÿฅ‰ Third correct answer: 8 points
    • And so on... (11 - position = points)
    • โŒ Wrong answer or no answer: 0 points
  • The player with the highest score at the end wins!

Tips

  • Be quick! Speed matters as much as accuracy
  • Use the autocomplete feature to quickly find countries
  • Watch out for similar-looking flags!

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v18 or higher recommended)
  • npm (comes with Node.js)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd flag-game
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev

    This will start both the backend server and the frontend client concurrently:

Available Scripts

Command Description
npm run dev Start both server and client in development mode
npm run client Start only the Vite frontend
npm run server Start only the backend server
npm run build Build the project for production
npm run preview Preview the production build
npm run lint Run ESLint to check for code issues

๐Ÿ› ๏ธ Tech Stack

  • Frontend: React 19, TypeScript, Vite
  • Backend: Express.js, Socket.IO
  • Real-time Communication: Socket.IO
  • Styling: CSS

๐Ÿ“ Project Structure

flag-game/
โ”œโ”€โ”€ server/          # Backend server code
โ”‚   โ””โ”€โ”€ index.ts     # Socket.IO server & game logic
โ”œโ”€โ”€ src/             # Frontend React application
โ”‚   โ”œโ”€โ”€ components/  # React components
โ”‚   โ”‚   โ”œโ”€โ”€ Game/    # Game-related components
โ”‚   โ”‚   โ”œโ”€โ”€ Lobby/   # Lobby component
โ”‚   โ”‚   โ””โ”€โ”€ shared/  # Shared/reusable components
โ”‚   โ”œโ”€โ”€ context/     # React context for game state
โ”‚   โ”œโ”€โ”€ data/        # Static data (countries list)
โ”‚   โ”œโ”€โ”€ services/    # Socket.IO client service
โ”‚   โ””โ”€โ”€ types/       # TypeScript type definitions
โ””โ”€โ”€ public/          # Static assets

๐ŸŽฏ Features

  • Real-time multiplayer gameplay
  • Room-based matchmaking with shareable codes
  • Autocomplete country search
  • Live score updates
  • Round-by-round results
  • Final leaderboard

Have fun playing! ๐ŸŒ๐Ÿ†

Contributors

Lymphatus

Issues