Skip to content

Multiplayer Wavelength-style guessing game with real-time sync, Firebase state management, and smooth animated UI.

Notifications You must be signed in to change notification settings

SeanChiuGit/Wavelength

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

50 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Wavelength Game ๐ŸŽฎ

A Chinese-language web-based party game inspired by the board game "Wavelength". Play with friends online or challenge yourself in single-player mode!

Live Demo: wavelength-game.netlify.app

๐Ÿ“– About

Wavelength is a social guessing game where players try to read each other's minds. One player gives a clue based on a spectrum (like "hot" to "cold"), and the other player guesses where on that spectrum the clue falls.

Features

  • ๐ŸŽฒ Multiplayer Mode: Create rooms and play with friends remotely
  • ๐Ÿง  Single-Player Mode: Challenge yourself against AI creators
  • ๐ŸŒ Bilingual Support: Switch between Chinese and English
  • ๐ŸŽจ Multiple Creators: Each with unique question styles
  • ๐Ÿ’ฌ Player-Generated Content: Create and share your own questions
  • ๐ŸŽ‰ Interactive Feedback: Visual and audio effects for perfect hits

๐Ÿ—‚๏ธ Project Structure

Wavelength/
โ”œโ”€โ”€ public/                      # Deployable files
โ”‚   โ”œโ”€โ”€ index.html              # Multiplayer mode
โ”‚   โ”œโ”€โ”€ singleplayer.html       # Single-player mode
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ”‚   โ”œโ”€โ”€ audio/              # Sound effects (partypop.mp3, tick.mp3)
โ”‚   โ”‚   โ”œโ”€โ”€ images/             # Images (loading.gif)
โ”‚   โ”‚   โ””โ”€โ”€ fonts/              # Custom fonts
โ”‚   โ””โ”€โ”€ data/
โ”‚       โ”œโ”€โ”€ question_bank.json  # Single-player questions
โ”‚       โ””โ”€โ”€ wordbank.json       # Word bank for hints
โ”‚
โ”œโ”€โ”€ src/                         # Source code
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ”‚   โ”œโ”€โ”€ multiplayer.js      # Multiplayer game logic
โ”‚   โ”‚   โ”œโ”€โ”€ singleplayer.js     # Single-player game logic
โ”‚   โ”‚   โ””โ”€โ”€ lang.js             # i18n translations
โ”‚   โ””โ”€โ”€ css/
โ”‚       โ””โ”€โ”€ style.css           # Styles
โ”‚
โ”œโ”€โ”€ docs/                        # Documentation
โ”‚   โ”œโ”€โ”€ en/                     # English docs
โ”‚   โ””โ”€โ”€ zh/                     # Chinese docs
โ”‚
โ”œโ”€โ”€ .env.example                # Firebase config template
โ”œโ”€โ”€ .gitignore                  # Git ignore rules
โ”œโ”€โ”€ package.json                # Project metadata
โ””โ”€โ”€ README.md                   # This file

๐Ÿš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • Internet connection (for Firebase and CDN resources)

Local Development

  1. Clone the repository

    git clone <your-repo-url>
    cd Wavelength
  2. Serve the files

    Using Python:

    python -m http.server 8080

    Using Node.js (http-server):

    npm start
  3. Open in browser

    http://localhost:8080/public/index.html
    

Deployment

The project is a static website and can be deployed to any static hosting service:

  • Netlify (current deployment)
  • Vercel
  • GitHub Pages
  • Firebase Hosting

For Netlify, set the publish directory to public/.

๐ŸŽฏ How to Play

Multiplayer Mode

  1. Host: Click "ๅˆ›ๅปบๆˆฟ้—ด" (Create Room) and share the room number
  2. Guest: Enter the room number and click "ๅŠ ๅ…ฅ" (Join)
  3. Take Turns:
    • One player sees the spectrum and gives a hint
    • The other player guesses where on the spectrum the hint falls
  4. Score: Try to land in the green zone for points!

Single-Player Mode

  1. Choose a creator (Sean, Charles, Brus) or play player-created questions
  2. Read the question and the spectrum endpoints
  3. Guess where the answer falls on the spectrum
  4. Get instant feedback and try to improve your guessing skills!

๐Ÿ› ๏ธ Technology Stack

  • Frontend: Pure HTML, CSS, JavaScript (no frameworks)
  • Backend: Firebase Realtime Database
  • Styling: Custom CSS with gradients and animations
  • Fonts:
    • Google Fonts (Noto Sans SC, ZCOOL XiaoWei)
    • Custom fonts (Source Han Sans CN, Zaio)
  • Libraries:
    • Firebase SDK 8.10.0
    • Canvas Confetti 1.6.0

๐Ÿ“ Configuration

Firebase Setup

The project uses Firebase for:

  • Real-time multiplayer synchronization
  • Storing player-created questions
  • Game analytics

โš ๏ธ Security Note: Firebase credentials are currently hardcoded in the JavaScript files. For production use, implement proper Firebase Security Rules and consider using environment variables.

To use your own Firebase:

  1. Create a Firebase project at console.firebase.google.com
  2. Copy .env.example to .env
  3. Update the Firebase config in:
    • src/js/multiplayer.js
    • src/js/singleplayer.js

๐ŸŽจ Customization

Visual Question Editor

The easiest way to manage questions is using the built-in visual editor:

  1. Open http://localhost:8080/public/question-editor.html
  2. Add, edit, or delete questions with a user-friendly interface
  3. Export the updated JSON file
  4. Replace public/data/question_bank.json

Features:

  • โœ๏ธ Visual form for adding/editing questions
  • ๐ŸŽจ Color-coded topic pairs
  • ๐Ÿ“Š Interactive position slider
  • ๐Ÿ” Search and filter by creator
  • ๐Ÿ’พ Export/import JSON with one click

See docs/en/QUESTION_EDITOR_GUIDE.md for detailed instructions.

Manual JSON Editing

Alternatively, edit public/data/question_bank.json directly:

{
  "id": "unique_id",
  "topic_pair": "ๅทฆ็ซฏ็‚น โ†” ๅณ็ซฏ็‚น",
  "target_position": 45,
  "question_text": "ไฝ ็š„้—ฎ้ข˜"
}

Adding Words to Hint Bank

Edit public/data/wordbank.json:

{
  "words": [
    "ๆ–ฐ่ฏ1",
    "ๆ–ฐ่ฏ2",
    "ๆ–ฐ่ฏ3"
  ]
}

Adding Hints to Multiplayer

Edit public/data/hintlist.json:

{
  "hints": [
    {
      "left": "ๅ†ท",
      "right": "็ƒญ",
      "category": "ๅฝขๆ€ไธŽ็‰นๅพ"
    }
  ]
}

๐Ÿ› Known Issues

  1. Large Font File: Source Han Sans CN font is 8MB. Consider subsetting or using WOFF2 format
  2. Exposed Firebase Credentials: Implement Firebase Security Rules for production
  3. No Build Process: No minification or bundling. Consider adding Vite or webpack for optimization

๐Ÿ“Š Performance

  • Total Size: ~16MB (8MB is the Chinese font)
  • Load Time: 2-4 seconds on fast connections
  • Code Size: ~2,800 lines of JavaScript

๐Ÿค Contributing

Contributions are welcome! Areas for improvement:

  • Optimize font files (subset, WOFF2 conversion)
  • Add build process for minification
  • Implement proper environment variable handling
  • Add more question creators
  • Improve mobile responsiveness
  • Add sound effect toggles
  • Implement leaderboards

๐Ÿ“„ License

MIT License - feel free to use this project for your own purposes!

๐Ÿ™ Acknowledgments

  • Inspired by the board game "Wavelength" by Cmyk Games
  • Thanks to all players who contributed questions
  • Built with โค๏ธ for friends and family

๐Ÿ“ง Contact

For questions, issues, or suggestions, please open an issue on GitHub.


Have fun playing Wavelength! ๐ŸŽ‰

About

Multiplayer Wavelength-style guessing game with real-time sync, Firebase state management, and smooth animated UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 51.1%
  • JavaScript 37.2%
  • CSS 11.7%