This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
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.
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.
- đȘ 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.
- đ» 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.
- đŒ 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.
- đ 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.
- đïž 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
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
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)