Skip to content

bjoyce/zcipher

Repository files navigation

Word Cipher - Multiplayer Word Guessing Game

A real-time multiplayer word guessing game built with Ruby on Rails 8, ActionCable, Hotwire (Turbo + Stimulus), and Tailwind CSS.

Game Description

Word Cipher is a team-based guessing game where players compete to guess words within a time limit. Players join either the Red or Blue team, and teams alternate turns. During each turn, one player becomes the "clue-giver" who can see a list of words that other players cannot see. The clue-giver gives verbal clues to help their teammates guess the words before time runs out!

Features

  • Real-time multiplayer using ActionCable WebSockets
  • Team-based gameplay (Red Team vs Blue Team)
  • Turn-based system with automatic rotation
  • 60-second timer for each turn
  • Live scoring and point tracking
  • Word visibility control (only clue-giver sees the word list)
  • Instant guess validation and feedback
  • Room code system for easy game joining
  • Modern, responsive UI with Tailwind CSS

Tech Stack

  • Backend: Ruby on Rails 8
  • Database: SQLite (development)
  • Real-time: ActionCable (WebSockets)
  • Frontend: Hotwire (Turbo + Stimulus.js)
  • Styling: Tailwind CSS (CDN)

Installation

  1. Clone the repository

  2. Install dependencies:

    bundle install
  3. Set up the database:

    bin/rails db:migrate
    bin/rails db:seed
  4. Start the Rails server:

    bin/rails server
  5. Visit http://localhost:3000 in your browser

How to Play

  1. Create or Join a Game

    • Create a new game from the homepage
    • Share the room code with other players
    • Or join an existing game by entering a room code
  2. Choose Your Team

    • Select either Red Team or Blue Team
    • Wait for players on both teams
  3. Start the Game

    • Once both teams have players, click "Start Game"
  4. Playing a Turn

    • One player from the active team becomes the clue-giver
    • The clue-giver sees a list of 10 words
    • Other teammates type guesses in real-time
    • Correct guesses award 1 point to both the player and team
    • Each turn lasts 60 seconds
  5. Winning

    • Teams alternate turns
    • The game continues until manually ended
    • The team with the most points wins!

Game Models

  • Game: Manages game state, scores, and settings
  • Player: Represents each connected player
  • Word: Master list of words (99 words across 10 categories)
  • GameWord: Words assigned to a specific game turn
  • Guess: Tracks all guess attempts

Real-time Features

The game uses ActionCable to broadcast:

  • Player joins/leaves
  • Game state changes
  • Turn transitions
  • Guess submissions (correct/incorrect)
  • Score updates
  • Timer synchronization

Word Categories

The game includes 99 words across 10 categories:

  • Animals
  • Food
  • Sports
  • Objects
  • Places
  • Actions
  • Professions
  • Nature
  • Entertainment
  • Technology

Development

To add more words, edit db/seeds.rb and run:

bin/rails db:seed

To reset the database:

bin/rails db:reset

Architecture Highlights

Service Objects

  • GameService: Handles game flow, turn management, and clue-giver selection
  • GuessService: Processes guesses, validates matches, awards points

Real-time Communication

  • GameChannel: ActionCable channel for broadcasting game events
  • game_controller.js: Stimulus controller handling WebSocket messages and UI updates

Key Features Implementation

  • Timer: Server-authoritative with client-side display
  • Word Visibility: Conditional rendering based on player role
  • Guess Matching: Normalized string comparison (case-insensitive)
  • Session Management: UUID-based player sessions

Future Enhancements

Potential features to add:

  • Sound effects and animations
  • Player avatars
  • Chat functionality
  • Game history and statistics
  • Difficulty levels
  • Custom word lists
  • Mobile app version
  • Tournament mode

License

This project is open source and available under the MIT License.

About

Vibe coded scipher clone

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors