DEV Community

Nitu Bathyal
Nitu Bathyal

Posted on Edited on

IT'S PLAYTIME: Every House Has a Secret

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission đŸ‘»đŸŒŒ

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

IT's Playtime Hero Showcase

What I Built

IT's Playtime is an advanced, offline-first horror gaming ecosystem inspired by classic midway dread, abandoned sewer mysteries, floating crimson balloons, and supernatural puzzles.
Unlike static concept mockups, IT's Playtime is a 100% functional, real-world gaming platform featuring seven fully implemented games, procedural Web Audio sound design, persistent progression saved via IndexedDB, and genuine open-source AI inference.

Interpreting the Theme: "Ghost in the Machine"

In today's AI landscape, intelligence is usually locked behind distant proprietary servers, charging fees for every token and enforcing sanitized corporate filters.
For Week 4's "Ghost in the Machine" challenge, I interpreted the theme literally: the ghost should reside directly inside the player’s personal hardware.
By pairing an open-weight local model (Qwen 2.5 3B Instruct) with Ollama, the AI is resurrected locally on the player's own CPU and GPU. It requires zero cloud APIs, zero internet connection, and zero subscription costs. When the local model generates a chilling, branching horror novel, the ghost isn't streaming from a remote corporate data center—it is haunting your local silicon.

Choose you Game Grid

The Seven Playable Game Modes

1.🎈 The Red Balloon (Signature Feature): Follow a drifting crimson balloon through an abandoned town. Search derelict locations, manage your inventory (flashlight, municipal keys, crowbar), solve environmental riddles, and unlock the flooded storm drain to escape Derrybrook.
2.🏰 Haunted Mansion: A room-by-room gothic exploration adventure through Ravenscroft Manor. Search for hidden keys, inspect cursed heirlooms, uncover hidden passages, and lift an ancestral curse.

  1. đŸŽȘ The Lost Carnival: A midway survival test. Navigate the Hall of Mirrors, spin the Wheel of Torment, conquer reflex challenges, collect brass carnival tokens, and unlock the rusted gates.
  2. đŸ‘» Ghost Party: A local pass-and-play multiplayer party game for 1–4 players on a single device. Features horror trivia, bluffing duels, and ghost riddles with real-time scoring.
  3. đŸŒŒ Day of the Dead: A warm, respectful DĂ­a de los Muertos digital ofrenda builder. Place glowing virtual candles, scatter vibrant cempasĂșchil marigolds, write personal remembrance tributes, and preserve memories locally.
  4. 📖 Ghost Story Teller (Core AI Game): A multi-paragraph branching interactive horror novel generated in real time by the local Qwen model. Players choose intensity, genre, and protagonist, and make branching narrative decisions that lead to distinct endings.
  5. đŸ—ïž The Lost Key: A dedicated cryptographic escape room. Solve mathematical cipher sequences, decode word riddles, utilize a multi-tier progressive hint engine, and crack the locked mortuary chest.

Demo

Live Application (Render):

https://its-playtime-frontend.onrender.com/

Live Mirror (GitHub Pages):

https://nitu-bathyal.github.io/its-playtime/

Demo video:

https://www.youtube.com/watch?v=yg05OKoRWGE&t=18s

Code

https://github.com/Nitu-Bathyal/its-playtime

Full-Stack Architecture

  • Frontend: React 18, Vite, Tailwind CSS, Lucide Icons, Canvas Confetti.
  • Audio Synthesis: Native Web Audio API procedural sound engine (zero external audio asset downloads)
  • PWA & Offline Persistence: Custom Service Worker (sw.js) and IndexedDB (its_playtime_db)
  • Backend: Python 3.13, Flask, Gunicorn WSGI, Flask-CORS
  • Open-Source AI: Qwen 2.5 3B Instruct running locally via Ollama

How I Built It

Ghost Story teller AI Engine

1. Genuine Open-Source AI Integration

The core generative mechanics are powered by the open-weight Qwen 2.5 3B Instruct model via the Ollama local daemon (http://localhost:11434).

The Python Flask backend is split into modular service handlers:

  • story_service.py: Employs structured multi-turn prompting to produce rich, atmospheric prose with dialogue, pacing, and two branching choice prompts.
  • riddle_service.py & puzzle_service.py: Generates cryptic town clues and verifies mathematical/cipher logic.

2. The Dual-Tier Offline Guarantee

To ensure the game is genuinely offline-first and never fails if Ollama is not installed or offline:

  • The client checks /api/health with a 2.5-second TTL timeout.
  • If the local AI daemon is active, it streams generative output from Qwen.
  • If Ollama is offline or the user is disconnected from the internet, the game automatically falls back to handcrafted horror branches, cryptographic cipher banks, and procedural question tables. The user experience never crashes or stalls.

3. Procedural Web Audio Engine (Zero Megabyte Footprint)

Instead of forcing players to download 50MB of static MP3 sound files over slow connections, I developed a custom procedural sound synthesizer using the browser's native Web Audio API:

  • Atmospheric Drone: Low-frequency sine oscillators (48Hz and 51.5Hz) generate binaural beats creating real psychological tension.
  • Music Box Melodies: High-frequency sine waves shaped by exponential decay envelopes mimic an antique, detuned carnival music box.
  • Balloon Pops & Jump Scares: White noise bursts shaped by bandpass filters provide tactile feedback when clicking floating balloons.

Why Does Open Innovation Matter?

Open innovation is what made IT's Playtime possible:

1.Freedom from Sanitized Content Restrictions: Commercial proprietary AI APIs (OpenAI, Anthropic, Google Cloud) have heavy moderation filters that frequently flag or reject horror themes, intense dread, creepy clowns, and gothic suspense. Open-weight models like Qwen 2.5 let creators explore darker literary themes without arbitrary censorship.
2.Zero Cost for Indie Creators & Players: A branching interactive novel burns through tokens quickly. Proprietary APIs turn games into expensive subscription traps. Running open-source models on local hardware makes generative gameplay 100% free with unlimited replayability.
3.True Software Longevity & Privacy: When a company shuts down an API, games that rely on it break forever. Because IT's Playtime runs open-weight models on local silicon and caches its assets via PWA Service Workers, this game can still be played 20 years from now on a laptop in airplane mode.

The Spirit of it

Day of the Dead Ofrenda

While the platform embraces classic horror tropes—creepy clowns, haunted carnival rides, and locked sewer vaults—the emotional soul of the project lies in Game 5: Day of the Dead (Día de los Muertos).

  • The "ghost in the machine" does not always have to be malevolent. In DĂ­a de los Muertos traditions, spirits are celebrated, remembered, and welcomed home.
  • In this mode, players can light digital candles, scatter cempasĂșchil petals, and type memorial tributes to loved ones they have lost. The data is saved locally to their browser's IndexedDB—a private, sacred digital ofrenda that stays on their own device. It transforms technology from a cold, distant machine into a vessel for human memory and love.

Prize Categories

Ghost in the Machine (Week 4 Focus Track):

Best integration of horror, mystery, spirit, and local AI intelligence.

Best Offline-First Architecture:

Exceptional use of PWA Service Workers, IndexedDB, and Web Audio synthesis for zero-dependency execution.

Best UI/UX & Atmosphere:

High-polish thematic design with original artwork, smooth animations, and responsive controls.

Top comments (0)