honestliar-game/eb Game
A realtime multiplayer web version of the social deduction party game **HonestLiar**, where players compete to deceive the judge or be the honest player.
## 🎮 Game Overview
**HonestLiar** is a social deduction game for 3-15 players:
- Each round has 1 **Judge**, 1 secret **Honest** player, and remaining **Liars**
- The Honest player sees the real explanation of a term, while Liars must improvise
- All players explain the term, and the Judge must identify the Honest player
- Scoring rewards good deception and correct judgments
## 🏗️ Project Structure
honestliar-game/ ├── backend/ # Node.js + TypeScript + Socket.IO server │ ├── src/ │ │ ├── index.ts # Main server entry point │ │ ├── types.ts # TypeScript interfaces │ │ ├── constants.ts # Game constants and scoring │ │ ├── RoomManager.ts # Game state management │ │ ├── CardDeck.ts # Topic card handling │ │ └── cards.json # Topic cards dataset (20 cards) │ ├── package.json │ └── tsconfig.json │ └── frontend/ # React + TypeScript + Vite ├── src/ │ ├── main.tsx # React entry point │ ├── App.tsx # Main app component │ ├── App.css # Styling │ ├── types.ts # TypeScript interfaces │ ├── socketService.ts # Socket.IO client wrapper │ └── components/ # React components │ ├── Landing.tsx │ ├── Lobby.tsx │ ├── RoleReveal.tsx │ ├── DarkPhase.tsx │ ├── Discussion.tsx │ ├── Judging.tsx │ ├── RoundResultScreen.tsx │ └── GameOver.tsx ├── package.json ├── vite.config.ts └── index.html
## 🚀 Getting Started
### Prerequisites
- Node.js 18+ and npm installed
- Modern web browser
### Installation & Running
#### 1. Install Backend Dependencies
```bash
cd backend
npm install
cd ../frontend
npm installcd backend
npm run devThe server will start on http://localhost:3001
cd frontend
npm run devThe app will be available at http://localhost:3000
- Create/Join Room: One player creates a room and shares the room code with others
- Lobby: Wait for at least 3 players to join, then the host starts the game
- Role Assignment: Each player receives their role (Judge/Honest/Liar)
- Dark Phase: The Honest player reads the real explanation (15 seconds)
- Discussion: Each non-judge player explains the term in turn (45 seconds each)
- Judging: The Judge selects who they think is the Honest player
- Scoring: Points are awarded based on correct/incorrect judgments
- Next Round: Continue for the configured number of rounds
- Game Over: Winner(s) with highest score are announced
- ✅ Realtime multiplayer with WebSocket (Socket.IO)
- ✅ Server-authoritative game logic (no cheating!)
- ✅ Role-based information hiding
- ✅ Automatic phase transitions with timers
- ✅ Scoring system with condemn rule option
- ✅ 20 topic cards in Traditional Chinese
- ✅ Reconnection support
- ✅ Mobile-responsive design
- ✅ Beautiful gradient UI with animations
Default settings (configurable in lobby):
- Max Rounds: 5
- Speaking Time: 45 seconds per player
- Dark Phase: 15 seconds for Honest to read
- Condemn Rule: Enabled (Judge can condemn suspected Liars)
- Language: Traditional Chinese (zh-Hant)
- Judge correct: +2 points
- Honest picked: +2 points
- Liar fools Judge: +3 points
- Judge wrong: -1 point
- Judge condemns Liar correctly: +1 point (Judge), -1 point (Liar)
- Judge condemns Honest: -3 points (Judge)
- Node.js + TypeScript
- Express.js
- Socket.IO (WebSocket)
- In-memory room management
- React 18
- TypeScript
- Vite (build tool)
- Socket.IO Client
- CSS3 with animations
create_room- Create a new game roomjoin_room- Join existing roomstart_game- Start the game (host only)judge_decision- Submit judge's decisionupdate_settings- Update game settingsrequest_next_round- Start next game
room_created- Room creation confirmationroom_joined- Join confirmationroom_state- Current room stategame_started- Game has startedround_started- New round infoyour_role- Player's role (private)topic_public- Topic title (public)phase_changed- Game phase transitionspeaker_changed- Current speakerjudge_prompt- Judge decision timeround_result- Round scoring resultsgame_over- Game endederror- Error message
Edit backend/src/cards.json:
{
"id": "card-021",
"title": "新詞彙",
"explanation": "這個詞彙的真正解釋..."
}Edit backend/src/constants.ts for default values:
export const DEFAULT_SETTINGS = {
maxRounds: 5,
enableCondemnRule: true,
language: "zh-Hant" as const,
speakingTimeSec: 45,
darkPhaseSec: 15,
};Edit frontend/src/App.css to customize colors, animations, and layout.
Port already in use?
- Backend: Change
PORTinbackend/src/index.ts - Frontend: Change port in
frontend/vite.config.ts
Connection refused?
- Make sure backend is running on port 3001
- Check
frontend/src/socketService.tsconnects to correct URL
TypeScript errors?
- Run
npm installin both backend and frontend directories
We welcome contributions! Please see our Contributing Guide for details on:
- Code of conduct
- Development setup
- Coding standards
- Pull request process
- Adding new topic cards
See QUICKSTART.md for local development setup.
Deploy to production with Docker containers:
- Docker Compose: Local or EC2 deployment
- AWS ECS: Serverless containers on Fargate
- AWS EKS: Kubernetes on AWS
- EC2: Direct Docker deployment
📖 Full Guide: DOCKER_DEPLOYMENT.md
Quick Start with Docker:
# Copy environment configuration
cp .env.docker .env
# Start all services
docker-compose up -d
# Access: http://localhost:3000- In-Memory (default): Fast, no persistence
- MongoDB: Persistent storage, survives restarts
See Storage Guide for MongoDB setup.
This project is licensed under the MIT License - see the LICENSE file for details.
✅ You can:
- Use this software for personal or commercial purposes
- Modify and create derivative works
- Distribute copies
- Use privately
❌ You must:
- Include the original license and copyright notice
- State changes made to the code
- Software is provided "as is" without warranty
- Authors are not liable for damages
Please read our full DISCLAIMER before using this software. Key points:
- Educational Purpose: For entertainment and learning only
- Content: Topic cards are for reference; verify information from authoritative sources
- Privacy: No personal data collected by default; server operators are responsible for data protection
- Age Rating: Recommended for ages 13+
- User Responsibility: Follow online safety guidelines; don't share personal information
- Server Security: If self-hosting, you're responsible for security and compliance
- Quick Start Guide - Get up and running in 5 minutes
- Storage Configuration - In-Memory vs MongoDB setup
- Contributing Guide - How to contribute
- Disclaimer - Important legal information
Game Inspiration: Inspired by social deduction party games involving bluffing and truth-telling mechanics.
Contributors: Thanks to all who have contributed to this project!
Open Source Libraries:
- Node.js - JavaScript runtime
- React - UI framework
- Socket.IO - Real-time communication
- TypeScript - Type safety
- Vite - Build tool
- Express - Web framework
If you find this project useful:
- ⭐ Star this repository
- 🐛 Report bugs via GitHub Issues
- 💡 Suggest features via GitHub Discussions
- 🤝 Contribute code or documentation
- 📢 Share with friends!
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Enjoy playing HonestLiar! Have fun deceiving your friends! 🎭
Made with ❤️ by the open-source community