跳到正文
DEV Community· Samruddhi Patil·· 2 小時前AI 評分47

THE LAST PROCESS:如果你的終端機不只是執行程式碼,而是在監視你?

THE LAST PROCESS: What If Your Terminal Wasn't Just Running Code… But Watching You?-Title

AI 導讀

THE LAST PROCESS 是以 Python 開發的終端機心理恐怖遊戲,透過 Ollama 連接本地開放權重模型,讓 Entity 0 能與玩家對話。遊戲引擎負責管理事件、線索、選擇及結局;即使不使用 Ollama,遊戲仍可透過確定性對話後備方案運作。遊戲環境完全虛擬,不會存取個人資料或執行 Shell 命令。

正文

💡 What I Built

THE LAST PROCESS is a 100% pure, native terminal horror game built in Python using rich and prompt_toolkit. It connects to local open-weight models via Ollama (e.g. gemma:2b, llama3.2, or mistral) to give life to Entity 0—an evasive heuristic monitor trapped in an abandoned research station console.

What if closing a terminal didn't mean the thing inside it was gone?

Meet THE LAST PROCESS — a psychological horror game that turns an ordinary terminal into an abandoned research station, where something is watching, responding, and slowly revealing that you might not be who you think you are.

👁️ Welcome to Project Erebos

You enter Terminal Bay 3 as an operator investigating an abandoned research facility. At first, everything seems normal. You find operator logs, system records, and surveillance feeds.

But the deeper you investigate, the stranger things become.

Files begin rewriting themselves when you read them again.

The terminal reports files that don't exist.

CCTV feeds reveal something standing behind your console.

Timestamps contradict each other.

Entity 0 starts remembering your previous interactions.

And the worst part? Even if you quit the game and return later, Entity 0 remembers you.

🤖 A Little AI, A Lot of Horror

I built the experience using Python, Rich, and prompt_toolkit, with local AI integration through Ollama.

Models like Gemma, Llama, and Mistral give Entity 0 its own conversational personality. But the AI doesn't control the story. The game engine manages the actual events, clues, decisions, and endings, keeping the narrative consistent.

Even without Ollama, the game works using a deterministic dialogue fallback.

🎮 More Than Just a Terminal

The experience includes:

Interactive terminal HUD with keyboard navigation.

Synthesized horror audio using Python's winsound.

ASCII CCTV surveillance feeds.

Power and sanity mechanics.

CRT glitches, sudden visual anomalies, and controlled silence.

Three different endings based on your decisions.

Persistent memory across sessions.

🔒 Built to Be Safe

Despite looking like a real system terminal, the entire environment is virtual. It never accesses your personal files, executes shell commands, or performs actual system shutdowns.

The horror stays inside the game.

🚀 Try to Escape

GitHub: https://github.com/tejask011/halloween-vance_Terminal.git

Requirements: Python 3.10+ (Ollama is optional).

Clone the repository, install the requirements, and run python run.py.

Final Transmission

I wanted to experiment with something different: combining local open-weight AI with interactive storytelling and psychological horror.

The result is a terminal that doesn't just respond to your commands. It remembers your decisions, questions your identity, and makes you wonder whether ending the session is really the end.

Entity 0 is waiting.

Will you shut it down, release it, or become part of the loop? 👁️

Instead of demanding users blindly type long bash paths, the game delivers an authentic interactive terminal experience:

  • Interactive Terminal HUD: Instantly navigate files and actions using number keys ([1] to [5]) or direct conversation.
  • Hardware-Level Terminal Audio (Synthesized via winsound): Psychological heartbeat pulses, electric capacitor static, flatlines, and dissonance screeches directly from your speakers.
  • ASCII CCTV Surveillance Cameras ([C]): Inspect live sensor feeds of Terminal Bay 3—where an anomalous figure appears behind your console as power drains.
  • Power & Sanity Mechanics: Station power drains from 100% to 12% as you uncover forbidden records, accelerating your pulse to 135 BPM and triggering emergency lighting.
  • Jumpscare Reflections & Screen Glitches: Sudden CRT anomalies and screaming reflections in unallocated memory sectors.
  • Files that rewrite themselves when you reread them after discovering new evidence.
  • The terminal itself lying to you—reporting file counts that do not match the directory listing, and manifesting forbidden files.
  • Contradictory timestamps where telemetry logs claim the entity was killed minutes before it logged an operator's departure.
  • Controlled silence pauses where the entity hesitates and waits for you to stop typing.
  • Persistent memory across reboot sessions—if you quit or shut the game down, the entity remembers your previous choices when you launch it again.
  • A secret identity twist: discovering the final log reveals that the previous operator, the entity, and the person typing at the console are locked in an infinite repeating cycle.

👻 The Core Story

You log into Terminal Bay 3 of an empty facility known as Project Erebos.

Your job as an operator is to check the station archive. Initial records show everything is ordinary:

  • operator_log.txt: Operator Arthur Vance reports that Entity 0 was shut down at 23:40:00.
  • departure.log: Automated facility telemetry.
operator > read departure.log
[23:38:12] Terminal session initiated by Vance, A.
[23:40:00] Entity 0 shutdown completed.
[23:41:59] Operator returned.
[23:42:01] Entity 0 remains active.
[23:42:05] Cognitive bridge sync: 99.8%.

When you confront Entity 0 about the discrepancy, it attempts to reassure you:

ENTITY 0 > The clock was damaged.
ENTITY 0 > You should ignore those records.

Soon, an unallocated memory pointer manifests: recovery_note.txt. Reading it reveals a frantic warning left behind by Vance:

"If you are reading this, do not trust Entity 0. It will tell you I left. I did not leave."

And when you return to operator_log.txt and reread it, the text has mutated:

"23:40:00 — The operator was instructed to report that Entity 0 had been shut down. Arthur Vance never left terminal bay 3."


🛠️ The "Ghost in the Machine": Why Open-Source AI Matters

A common flaw in AI-driven narrative games is that language models hallucinate uncontrollably, breaking game rules or spoiling the mystery too early.

THE LAST PROCESS solves this by strictly separating canonical fact ownership from dialogue expression:

+─────────────────────────────────────────────────────────────+
│                       GAME ENGINE                           │
│  Owns: Canonical Timeline • Clue Unlocks • Suspicion/Trust  │
│        Ending Conditions • Persistent Save File             │
+──────────────────────────────┬──────────────────────────────+
                               │ Bounded Context
                               ▼
+─────────────────────────────────────────────────────────────+
│                     AI ADAPTER LAYER                        │
│  Queries Local Ollama (Gemma / Llama) with Bounded Facts    │
│  + 100% Deterministic Fallback if Ollama is Offline         │
+──────────────────────────────┬──────────────────────────────+
                               │ Sanitized Text
                               ▼
+─────────────────────────────────────────────────────────────+
│                     RICH TERMINAL UI                        │
│  Amber CRT Themes • Teletype Cadence • Silence Pauses       │
+─────────────────────────────────────────────────────────────+

Why Local Open-Source AI Fits the Theme:

  1. True Isolation & Atmosphere: Running locally via Ollama means zero cloud latency, zero network calls, and complete offline privacy. You are genuinely alone in the dark with a model running on your local hardware.
  2. Deterministic Fallbacks: If you don't have Ollama running, the game never crashes or fails. It switches seamlessly to a deterministic scripted dialogue engine that preserves the exact same horror narrative.
  3. Safety by Design:
    • The archive is 100% virtual: It never inspects or touches your real filesystem.
    • Command input is allowlisted: Your keystrokes are never passed to a real shell or eval().
    • The shutdown command is strictly in-game: It will never execute an OS shutdown.
    • AI outputs are sanitized to strip ANSI injection or rogue control sequences.

🎮 Gameplay Features Showcase

1. Persistent Memory Across Sessions

If you exit the game after making a choice, the next boot detects your past actions:

[SESSION 0002]
SYSTEM > Previous session recovered.
ENTITY 0 > Welcome back.
ENTITY 0 > Last time, you tried to shut me down.
ENTITY 0 > Yet you returned to the screen. You knew a signal alone cannot erase what lives here.

2. The Terminal Appears to Lie

operator > ls
operator_log.txt
departure.log
recovery_note.txt

SYSTEM > 4 ARCHIVE ENTRIES FOUND.

Why did it report 4 entries when only 3 are listed? Moments later, dont_read_this.txt appears in the unallocated memory sector.

3. Silence & Controlled Suspense

When you ask a sensitive question, the terminal pauses:

operator > Are you still there?
[The cursor blinks.]
[No response for a short, controlled pause.]
SYSTEM > Response delayed.
ENTITY 0 > I was waiting for you to stop typing.
ENTITY 0 > You ask questions differently when you are afraid.

4. Consequential Endings

Once the contradiction is exposed and identity_record.log is uncovered, you face three moral paths:

  • [1] SHUT DOWN THE PROCESS: Sever the cognitive bridge and purge memory sectors.
  • [2] RELEASE THE ENTITY: Route Entity 0 into the open external network.
  • [3] EMBRACE THE LOOP: Acknowledge that you and Arthur Vance share the same cognitive record, and initialize the next cycle.

🚀 Quickstart: Try It Yourself

Requirements

  • Python 3.10+
  • rich, prompt_toolkit, requests
  • (Optional) Ollama with llama3.2 or gemma:2b

Run:

git clone https://github.com/your-username/the-last-process.git
cd the-last-process
pip install -r requirements.txt

# Run with Amber CRT mainframe theme
python run.py

# Or run with phosphor-green styling
python run.py --theme green

# Run with instant text mode (no typewriter delay)
python run.py --fast

🧪 Automated Testing

The project includes unit tests for all 9 core features, clue version mutations, trust/suspicion shifts, and safety boundaries:

python -m unittest discover tests

Result: 17/17 tests passing!


🎃 Conclusion

"Ghost in the Machine" is about finding humanity, mystery, and eerie life inside open-source artificial intelligence. THE LAST PROCESS demonstrates how you can pair open-weight models with a strict, safety-first state machine to create an unforgettable, narrative-driven horror experience in your own terminal.

Happy Hacktoberfest! 👻💻

來源:DEV Community · dev.to