A real-time multiplayer implementation of the popular party game Spyfall. In this game, players are assigned roles at a specific location, except for one player who is the spy. The spy's goal is to figure out the location, while other players try to identify the spy through careful questioning.
- Create and join game lobbies with unique codes
- Real-time multiplayer gameplay
- Multiple locations and roles
- Timer for each round
- Voting system to identify the spy
- Multiple rounds with different locations
- Added session persistence to prevent disconnects on page refresh
- Added 1 minute grace period to rejoin after closing page
- Added host controls (remove players, assign new host)
- Added ability for players to leave party and change name
- Improved mobile responsiveness and party joining flow
- Various bug fixes and UI improvements
The project is divided into two main parts:
client/: Vue.js frontend applicationserver/: Node.js backend server
- Vue 3 with Composition API
- Vue Router
- Vite
- TypeScript
- Socket.io client
- Node.js
- Express
- Socket.io
- JavaScript
- Node.js (v14 or higher)
- npm
-
Clone the repository:
git clone https://github.com/yourusername/spyfall.git cd spyfall -
Install dependencies for both client and server:
# Install server dependencies cd server npm install # Install client dependencies cd ../client npm install -
Start the development servers:
In one terminal, start the backend server:
cd server npm run devIn another terminal, start the frontend development server:
cd client npm run dev -
Open your browser and navigate to the URL shown in the client terminal (typically http://localhost:5173)
- Create a Party: The first player creates a party and gets a unique party code
- Invite Friends: Share the party code with friends so they can join
- Start the Game: Once everyone is ready, the host starts the game
- Gameplay:
- Everyone except the spy sees the location and their role
- Players take turns asking each other questions about the location
- The spy tries to blend in without revealing they don't know the location
- Other players try to identify the spy without giving away the location
- Voting: After the timer ends, players vote on who they think is the spy
- Results: The spy is revealed, and points are awarded
- Next Round: Play multiple rounds with different locations and a new spy each time
The game includes several location packs:
- Basic Locations: Common everyday locations like School, Hospital, Restaurant, etc.
- Advanced Locations: More unique and challenging locations like Space Station, Submarine, Casino, etc.
- Tourist Attractions: Famous landmarks and tourist destinations like Eiffel Tower, Pyramids of Giza, etc.
The host can select which location packs to use for the game.
The game includes a script to generate images for all locations using OpenAI's DALL-E API. To generate the images:
-
Navigate to the scripts directory:
cd scripts -
Install dependencies:
npm install -
Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here -
Run the script:
npm run generate-images
See the scripts README for more details.
This project is licensed under the MIT License - see the LICENSE file for details.