Hidden Hack: Building a Revolutionary Cybersecurity Social Deduction Game

The Inspiration 🎯

The idea for Hidden Hack emerged from a fascinating intersection of three passions: cybersecurity education, social psychology, and game design. As someone deeply interested in both the technical aspects of cybersecurity and the psychological dynamics of social deduction games like Mafia and Werewolf, I saw an opportunity to create something truly innovative.

The traditional social deduction genre, while entertaining, often relies on generic themes like vampires, werewolves, or abstract concepts. I realized that cybersecurity—with its natural adversarial dynamics between attackers and defenders—provided the perfect thematic foundation for a modern social deduction experience. The field is inherently about hidden threats, information warfare, and strategic thinking, making it an ideal match for the psychological gameplay these games require.

What truly inspired me was the educational potential. Cybersecurity concepts like DDoS attacks, malware deployment, packet interception, and social engineering could be transformed from abstract technical concepts into engaging gameplay mechanics. Players would learn real cybersecurity terminology and strategies while experiencing the thrill of deception and deduction.

The final catalyst was discovering Reddit's Devvit platform. The ability to create games that run natively within Reddit posts, requiring no downloads or external accounts, opened up possibilities for truly accessible multiplayer gaming. I envisioned a game that could be shared as easily as a Reddit link, bringing social deduction to a massive, built-in audience.

The Learning Journey 📚

Building Hidden Hack became an intensive learning experience across multiple domains:

Mastering the Devvit Platform

Devvit was relatively new when I started this project, which meant learning its architecture from first principles. The platform's unique approach—running games within Reddit posts using a client-server architecture—required understanding:

  • Dual-interface design: Creating both lobby posts for game management and individual game server posts
  • Reddit's hosting constraints: Working within serverless limitations, payload size restrictions, and execution time limits
  • Authentication integration: Leveraging Reddit's built-in user authentication system
  • Real-time synchronization: Implementing WebSocket-like functionality within Devvit's constraints

Advanced TypeScript Architecture

The project demanded sophisticated TypeScript patterns to maintain type safety across a complex client-server boundary:

// Shared type definitions ensuring client-server consistency
export interface GameState {
  phase: GamePhase;
  players: Player[];
  currentDay: number;
  phaseEndTime: number;
  eliminatedPlayers: Player[];
}

// Complex ability system with type-safe interactions
export interface AbilityDefinition {
  type: AbilityType;
  cooldown: number;
  usageLimit: number;
  targetType: TargetType;
  phaseRestrictions: GamePhase[];
}

Game Theory and AI Development

Creating intelligent AI bots required diving deep into game theory and behavioral modeling:

  • Decision trees: Implementing strategic thinking for different bot personalities
  • Probability calculations: Bots evaluate suspicion levels using Bayesian inference
  • Team coordination: AI agents communicate through private channels and coordinate strategies
  • Difficulty scaling: Mathematical models for adjusting bot decision quality from 30% (Easy) to 90% (Hard)

Real-time Multiplayer Systems

Synchronizing game state across multiple clients presented complex challenges:

  • Heartbeat systems: Detecting disconnected players and handling reconnection
  • Phase management: Server-side timers with client-side countdown synchronization
  • Conflict resolution: Handling simultaneous actions and maintaining consistency
  • Session management: Supporting unlimited concurrent games without interference

The Technical Architecture 🏗️

System Design Philosophy

The architecture follows a monorepo pattern with clear separation of concerns:

src/
├── client/     # Three.js frontend with TypeScript
├── server/     # Express.js backend with Devvit integration  
├── shared/     # Common types and utilities
└── tests/      # Comprehensive test suites

Key Technical Innovations

1. Unified Communication System Instead of traditional popup-heavy interfaces, I designed a single chat panel that integrates:

  • Public discussion
  • Private team channels (/mod for security, /hacker for hackers)
  • Ability notifications and effects
  • System messages and phase transitions

2. Advanced Ability System The ability system uses a sophisticated interaction model:

// Abilities can conflict, be blocked, or create cascading effects
const abilityInteractions = {
  ddos: { blocks: ['all_abilities'], duration: 'phase' },
  malware: { corrupts: ['voting', 'messaging'], target: 'player' },
  shadowBan: { filters: ['public_chat'], invisible: true }
};

3. Multi-Session Architecture Each game creates its own Reddit post, enabling:

  • Unlimited concurrent games
  • Permanent, shareable URLs
  • Independent session management
  • Scalable resource allocation

4. Intelligent Bot System Bots use sophisticated decision-making algorithms:

// Bot decision quality scales with difficulty
const calculateBotDecision = (analysis: BotAnalysis, difficulty: Difficulty) => {
  const baseAccuracy = difficulty === 'Easy' ? 0.3 : 
                      difficulty === 'Medium' ? 0.6 : 0.9;

  return Math.random() < baseAccuracy ? 
    analysis.optimalChoice : analysis.randomChoice;
};

The Development Challenges 💪

Challenge 1: Real-time Synchronization

The Problem: Keeping 15+ players synchronized across multiple game phases with precise timing.

The Solution: Implemented a dual-timer system where the server runs authoritative timers with 1-second buffers, while clients display countdown timers that end 1 second early. This prevents race conditions while maintaining smooth user experience.

// Server-side authoritative timing
const PHASE_TIMERS = {
  DAY_PHASE: (DEBUG_MODE ? 30000 : 120000) + 1000,  // +1s buffer
  VOTING_PHASE: (DEBUG_MODE ? 30000 : 60000) + 1000,
  NIGHT_PHASE: (DEBUG_MODE ? 30000 : 30000) + 1000
};

Challenge 2: Complex Ability Interactions

The Problem: Creating 10+ unique abilities that could interact, conflict, and create emergent gameplay without breaking the game state.

The Solution: Developed a priority-based ability resolution system with comprehensive conflict detection:

// Ability execution with conflict resolution
export class AbilityExecutor {
  async executeAbility(ability: AbilityUse): Promise<AbilityResult> {
    // Check for DDoS blocks
    if (this.isDDoSActive() && ability.type !== 'ddos') {
      return { success: false, reason: 'DDoS attack in progress' };
    }

    // Resolve conflicts and cascading effects
    return this.resolveAbilityChain(ability);
  }
}

Challenge 3: AI Bot Intelligence

The Problem: Creating bots that feel human-like while being strategically competent across three difficulty levels.

The Solution: Implemented personality-driven AI with probabilistic decision-making:

// Bots have personality traits affecting behavior
interface BotPersonality {
  aggressiveness: number;    // 0-1, affects voting patterns
  suspicion: number;         // 0-1, affects trust levels  
  communication: number;     // 0-1, affects chat frequency
  teamwork: number;         // 0-1, affects coordination
}

Challenge 4: Mobile Optimization

The Problem: Creating a complex multiplayer interface that works seamlessly on mobile devices.

The Solution: Designed a responsive two-column layout with touch-friendly controls:

  • Left Column: Player list and action buttons
  • Right Column: Game status and unified chat
  • Dynamic scaling: Interface adapts to screen size and orientation
  • Touch optimization: Large tap targets and gesture-friendly interactions

Challenge 5: Session Management at Scale

The Problem: Supporting unlimited concurrent games without resource conflicts or data corruption.

The Solution: Implemented a sophisticated session registry system:

// Multi-session architecture with automatic cleanup
export class SessionManager {
  private sessions = new Map<string, GameSession>();

  async createSession(postId: string): Promise<GameSession> {
    const session = new GameSession(postId);
    this.sessions.set(postId, session);

    // Automatic cleanup scheduling
    this.scheduleCleanup(session);
    return session;
  }
}

The Mathematical Foundations 🔢

Game Balance Calculations

The game uses mathematical models to ensure balanced gameplay:

Role Distribution Formula: $$\text{Security Team} = \lceil 0.75 \times \text{PlayerCount} \rceil$$ $$\text{Hacker Team} = \lfloor 0.25 \times \text{PlayerCount} \rfloor$$

Ability Cooldown Scaling: $$\text{Cooldown} = \text{BaseCooldown} \times (1 + 0.1 \times \text{PlayerCount})$$

Bot Decision Probability: $$P(\text{Optimal Decision}) = \text{Difficulty} \times (0.7 + 0.3 \times \text{GameProgress})$$

Performance Optimization

Memory Management:

  • Session cleanup algorithms prevent memory leaks
  • Efficient data structures minimize Redis operations
  • Lazy loading reduces initial bundle size

Network Optimization:

  • Batched updates reduce API calls by ~60%
  • Compressed payloads stay under Devvit's 4MB limit
  • Heartbeat system optimizes connection monitoring

The User Experience Design 🎨

Atmospheric Immersion

The Three.js cyberpunk atmosphere creates immersion through:

  • Particle Systems: Matrix-style code rain and floating geometric shapes
  • Dynamic Lighting: Ambient and directional lighting with green/cyan themes
  • Camera Movement: Subtle animations that respond to game events
  • Audio-Visual Feedback: Ability effects and phase transitions

Accessibility Features

  • Color-blind friendly: High contrast ratios and shape-based indicators
  • Mobile optimization: Touch-friendly controls and responsive layouts
  • Clear typography: Readable fonts and appropriate sizing
  • Intuitive navigation: Consistent interaction patterns

Progressive Disclosure

The interface reveals complexity gradually:

  1. New players: Simple join/ready buttons and basic chat
  2. Active players: Role abilities and team coordination
  3. Advanced players: Strategic timing and complex interactions

The Impact and Innovation 🚀

Educational Value

Hidden Hack successfully gamifies cybersecurity education:

  • Terminology: Players learn authentic cybersecurity terms through gameplay
  • Concepts: DDoS attacks, malware, social engineering become interactive mechanics
  • Strategy: Understanding attack/defense dynamics through role-playing
  • Awareness: Experiencing social engineering and deception tactics firsthand

Technical Innovation

The project pushes boundaries in several areas:

Platform Innovation: First complex multiplayer game built entirely on Reddit's Devvit platform

AI Integration: Sophisticated bot system that enhances rather than replaces human interaction

Communication Design: Revolutionary unified chat system that eliminates popup clutter

Accessibility: Zero-download gaming accessible to Reddit's massive user base

Community Building

The game creates unique social dynamics:

  • Cross-community play: Reddit users from different subreddits can play together
  • Persistent URLs: Games can be bookmarked and revisited
  • Viral sharing: Easy sharing through Reddit's existing social mechanisms
  • Educational discussions: Games often spark conversations about real cybersecurity

Lessons Learned and Future Vision 🔮

Key Insights

  1. Platform Constraints Drive Innovation: Devvit's limitations forced creative solutions that ultimately improved the user experience

  2. AI Enhancement vs. Replacement: Bots work best when they enhance human interaction rather than replacing it

  3. Unified Interfaces Reduce Cognitive Load: Consolidating multiple communication channels into one interface dramatically improves usability

  4. Educational Gaming Requires Authenticity: Players engage more deeply when game mechanics mirror real-world concepts

Future Enhancements

Advanced AI Features:

  • Machine learning models trained on player behavior
  • Dynamic difficulty adjustment based on player skill
  • Personality-driven bot communication patterns

Expanded Role System:

  • Additional cybersecurity roles (Forensic Analyst, Penetration Tester, etc.)
  • Custom role creation tools for communities
  • Seasonal events with special abilities

Community Features:

  • Tournament systems with leaderboards
  • Clan/team formation across multiple games
  • Spectator mode for learning and entertainment

Educational Integration:

  • Partnerships with cybersecurity education programs
  • Detailed post-game analysis and learning resources
  • Integration with cybersecurity certification curricula

Conclusion: The Art of Technical Storytelling 📖

Building Hidden Hack taught me that the best technical projects are fundamentally about storytelling. Every line of code, every architectural decision, and every user interface element contributes to the narrative experience we create for players.

The game succeeds not just because of its technical sophistication, but because it tells compelling stories—stories of trust and betrayal, of hidden threats and heroic defenders, of technical mastery and social manipulation. These stories emerge naturally from the intersection of solid technical foundations and thoughtful game design.

The project demonstrates that innovation often comes from combining existing concepts in novel ways. Social deduction games have existed for decades, cybersecurity is a well-established field, and web technologies are mature—but bringing them together in the unique context of Reddit's platform created something genuinely new.

Most importantly, Hidden Hack proves that technical complexity doesn't have to come at the expense of accessibility. By building on Reddit's existing infrastructure and focusing on intuitive design, we created a sophisticated multiplayer experience that anyone can enjoy with just a click.

The future of gaming lies not in increasingly complex downloads and installations, but in seamlessly integrated experiences that meet users where they already are. Hidden Hack represents a step toward that future—a world where the most engaging games are just a link away.


Hidden Hack continues to evolve as a living project, with new features, roles, and capabilities being added regularly. The game serves as both an entertaining social experience and a practical demonstration of what's possible when we combine technical innovation with thoughtful design and educational purpose.

Built With

Share this project:

Updates