This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
The Midnight Game — The Game That Remembers
I built a local, AI-powered folk-horror game inspired by the midnight games, playground rituals, campfire stories, and supernatural games that get passed from one person to another.
The premise is simple:
Play the game at midnight. Follow the rules. Don't break the ritual.
But there's a catch.
The game remembers.
Every player leaves behind traces of their session: the choices they made, the rules they followed, the things they discovered, and sometimes the things they weren't supposed to discover.
Future players can encounter fragments of those previous sessions.
A warning left by someone who played before them.
A rule that wasn't part of the original game.
A strange event that has happened several times.
Eventually, the game begins developing its own folklore.
The goal wasn't to build another chatbot that tells scary stories. I wanted to build a game where the AI actually feels like part of the world — something living inside the machine that remembers what happened before.
Demo
[Demo / Video coming soon]
The experience starts in a terminal-like interface:
╔════════════════════════════════════╗
║ THE MIDNIGHT GAME ║
╚════════════════════════════════════╝
This game is best played alone.
The previous player lasted 17 minutes.
They left one message:
> DON'T ANSWER THE THIRD KNOCK.
The clock is approaching midnight.
From there, the player performs a series of actions and makes choices that influence what happens next.
The game engine controls the actual rules and state, while the local AI acts as the narrator and the voice of the entity.
Code
[GitHub Repository coming soon]
The project is designed around a simple separation:
┌─────────────────┐
│ Player │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Game Engine │
│ │
│ Rules │
│ Game State │
│ Events │
│ Randomness │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Local LLM │
│ │
│ Narration │
│ Dialogue │
│ Atmosphere │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Local Memory │
│ │
│ Past Sessions │
│ Player Choices │
│ Folklore │
└─────────────────┘
The model doesn't control the game rules. It interprets the game state and brings the world to life.
That means the AI can't simply hallucinate that a door is open when the game engine says it's closed.
At least, not without something going very, very wrong.
How I Built It
The core of the project is an open-weight model running locally.
The game engine is responsible for deterministic mechanics: the ritual, player choices, game state, events, and endings.
The local model is responsible for the parts that benefit from generative AI:
- the voice of the entity
- narration
- contextual dialogue
- interpreting previous player actions
- generating atmospheric descriptions
- reacting to discoveries
- helping turn repeated player behavior into folklore
The game also maintains a local memory of previous sessions.
For example:
SESSION #019
Player lasted: 23m 41s
Actions:
• knocked 3 times
• opened the door
• refused to answer
• looked behind the chair
Final event:
THE GHOST SPOKE THE PLAYER'S NAME
Player's final message:
"Never open the door."
A future player might discover that message without knowing who left it.
Over time, repeated player behavior can become part of the game's evolving folklore:
LOCAL FOLKLORE
01. Never knock four times.
02. Never answer your own name.
03. Never extinguish the candle yourself.
04. If you hear breathing, don't turn around.
The idea is that the game doesn't just generate folklore.
It gradually accumulates it.
Why Does Open Innovation Matter?
The Midnight Game is designed to be played without the internet.
That's not just a technical choice. It's part of the experience.
A horror game about a mysterious presence becomes much more interesting when you can disconnect the machine from the internet and the presence is still there.
Running an open-weight model locally also means that the game's memories, conversations, and play history can remain on the player's machine.
No account.
No API key.
No cloud dependency.
No requirement to send someone's gameplay or personal information to a third-party AI provider.
Open models also make the project hackable.
Players can swap the model, change the personality of the entity, add new rules, create regional variations, or build entirely different versions of the game.
The same game engine could become:
- a different folk-horror tradition
- a campfire game
- an urban legend
- a supernatural puzzle
- a completely new piece of fictional folklore
That's what open innovation made possible here: the AI isn't a service the game depends on. It's a component the player can own, inspect, modify, and replace.
My Agent Session
[DevRelay agent session coming soon]
The Spirit of It
There is something interesting about traditional folk games.
They don't need an app.
They don't need a server.
They don't even need an internet connection.
Someone just tells you the rules.
Then you play.
And if you play it with someone else, you might learn a slightly different version.
Maybe someone adds a new rule.
Maybe someone tells you that you're not supposed to say a certain word.
Maybe someone claims that something happened the last time they played.
And eventually, nobody remembers where the original rules came from.
The Midnight Game is an attempt to recreate that process with an AI.
The model isn't just telling a horror story.
It's participating in the creation of one.
Every player can leave something behind.
Every future player can discover it.
And eventually, the machine starts remembering things that its current player never taught it.
That's the ghost.
Prize Categories
Thanks for participating!
Top comments (0)