Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 GitHub - llm4s/szork: Voice-controlled Zork-style adventure demo using LLM4S: speech, image, tools, and agentic gameplay.
Nothing Special   »   [go: up one dir, main page]

Skip to content
/ szork Public

Voice-controlled Zork-style adventure demo using LLM4S: speech, image, tools, and agentic gameplay.

License

Notifications You must be signed in to change notification settings

llm4s/szork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

43 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Szork ๐Ÿง™โ€โ™‚๏ธ๐ŸŽฎ - AI-Powered Text Adventure Game

Szork is an innovative voice-controlled, AI-powered text adventure game that reimagines the classic Zork experience for the modern era. Built with LLM4S, it demonstrates the power of combining Large Language Models with real-world tools to create immersive, dynamic gaming experiences.

๐ŸŒŸ Features

Core Gameplay

  • ๐Ÿง  AI Dungeon Master: An LLM agent acts as your DM, creating dynamic narratives and managing game state
  • ๐ŸŽ™๏ธ Voice Control: Speak your commands naturally (Speech-to-Text integration)
  • ๐Ÿ—ฃ๏ธ Narrated Adventures: Responses are spoken aloud (Text-to-Speech)
  • ๐ŸŽจ AI-Generated Scenes: Each location is illustrated with AI-generated artwork
  • ๐Ÿ’ฌ Natural Language: No need to remember specific commands - just speak naturally
  • ๐Ÿ’พ Auto-Save: Game state is automatically saved and can be resumed anytime

Technical Features

  • ๐Ÿ”„ Hot Reload Development: Changes to code automatically restart the server
  • ๐ŸŒ Web-Based Interface: Modern Vue.js frontend with WebSocket real-time communication
  • ๐ŸŽญ Multiple Themes: Choose from various adventure themes and art styles
  • ๐Ÿบ Persistent State: Game state, inventory, and progress are maintained
  • ๐ŸŽต Dynamic Music: AI-generated background music that adapts to the scene mood
  • ๐Ÿ–ผ๏ธ Smart Caching: Images and audio are cached for improved performance

๐ŸŽฎ How It Works

  1. Start Your Adventure: Launch the game and choose your theme
  2. Explore Naturally: Speak or type commands like "look around", "go north", or "pick up the sword"
  3. Experience the Story: The AI DM describes scenes, manages inventory, and responds to your actions
  4. See Your World: AI generates images for each new location you discover
  5. Hear Your Tale: Text-to-speech narrates the adventure as it unfolds

๐Ÿš€ Quick Start

Prerequisites

  • Java 17+
  • Scala 2.13
  • sbt 1.8+
  • Node.js 18+ (for frontend)
  • API Keys for:
    • OpenAI (GPT-4 for DM, DALL-E for images, Whisper for speech)
    • OR Anthropic (Claude for DM)

Environment Setup

Copy .env.example to .env and fill in your local values. Never commit .env.

cp .env.example .env
# Edit .env and add your keys (OPENAI_API_KEY/ANTHROPIC_API_KEY, etc.)

Running the Game

Backend Server

# Clone the repository
git clone https://github.com/llm4s/szork.git
cd szork

# Start the server (default port 8090)
sbt szorkStart

# Or with hot reload for development
sbt "~szorkStart"

Frontend (Optional - for web interface)

# In a new terminal
cd frontend
npm install
npm run dev

Open your browser to http://localhost:3090

API / Protocol

  • Primary interface: WebSocket ws://localhost:9002 (typed JSON messages).
  • Selected HTTP endpoints remain for utility:
    • GET /api/health โ€“ health check
    • GET /api/feature-flags โ€“ capability discovery (LLM/image/music/tts/stt availability)
    • GET /api/games, GET /api/game/list โ€“ list saved games
    • POST /api/game/save/:sessionId, GET /api/game/load/:gameId โ€“ persistence helpers

See frontend/src/types/WebSocketProtocol.ts for the client protocol and src/main/scala/org/llm4s/szork/protocol/WebSocketProtocol.scala for server types.

๐Ÿ—๏ธ Architecture

Technology Stack

  • Backend: Scala 2.13 with Cask web framework
  • AI Integration: LLM4S library for LLM orchestration
  • Frontend: Vue 3 + Vuetify 3 + TypeScript
  • Real-time: WebSockets for streaming responses
  • Build Tool: sbt with hot reload support

Key Components

szork/
โ”œโ”€โ”€ src/main/scala/org/llm4s/szork/
โ”‚   โ”œโ”€โ”€ SzorkServer.scala         # Main server with all endpoints
โ”‚   โ”œโ”€โ”€ GameEngine.scala          # Core game logic and LLM integration
โ”‚   โ”œโ”€โ”€ StreamingAgent.scala      # Streaming LLM responses
โ”‚   โ”œโ”€โ”€ GameTools.scala           # Tool definitions for the AI agent
โ”‚   โ”œโ”€โ”€ ImageGeneration.scala     # AI image generation
โ”‚   โ”œโ”€โ”€ TextToSpeech.scala        # TTS integration
โ”‚   โ”œโ”€โ”€ MusicGeneration.scala     # Dynamic music generation
โ”‚   โ””โ”€โ”€ GamePersistence.scala     # Save/load game state
โ”œโ”€โ”€ frontend/                      # Vue.js web interface
โ””โ”€โ”€ talk/                         # Presentation materials

๐Ÿ› ๏ธ Development

Hot Reload Development

# Start with file watching - automatically restarts on code changes
sbt "~szorkStart"

Available Commands

  • sbt szorkStart - Start the server
  • sbt szorkStop - Stop the server
  • sbt szorkRestart - Restart the server
  • sbt szorkStatus - Check server status
  • sbt compile - Compile the project
  • sbt test - Run tests

Feature Flags & Perโ€‘Session Overrides

The server exposes capabilities and allows perโ€‘session overrides.

  • Backend configuration (env vars):
    • SZORK_IMAGE_GENERATION_ENABLED, SZORK_TTS_ENABLED, SZORK_STT_ENABLED, SZORK_MUSIC_ENABLED
  • Capability discovery (frontend):
    • GET /api/feature-flags โ†’ { llm, image, music, tts, stt }
    • The selection screen shows capability chips from this endpoint.
  • WebSocket protocol (perโ€‘session):
    • Client โ†’ Server newGame (optional overrides): { tts?: boolean, stt?: boolean, music?: boolean, imageGeneration?: boolean }
    • Server โ†’ Client gameStarted (effective flags): { ttsEnabled, sttEnabled, imageEnabled, musicEnabled }
  • UI behavior:
    • When a capability is disabled by server, related controls are disabled (e.g., mic button when STT is off, TTS/mute toggle when TTS is off, image/music toggles when disabled).
    • Validation errors from server are surfaced as a toast and also appear in the chat stream.

Configuration Options

The game supports extensive configuration through environment variables:

  • SZORK_PORT - Server port (default: 8090)
  • SZORK_AUTO_SAVE - Enable auto-save (default: true)
  • SZORK_CACHE_ENABLED - Enable caching (default: true)
  • SZORK_IMAGE_GENERATION_ENABLED - Enable image generation (default: true)
  • SZORK_TTS_VOICE - TTS voice selection
  • SZORK_MUSIC_ENABLED - Enable background music

๐Ÿ“š Documentation

For additional design documents and historical information, see the docs/ directory.

๐ŸŽค About

This project was created as a demonstration for the talk "Scala Meets GenAI: Build the Cool Stuff with LLM4S":

  • ๐Ÿ“… Scala Days 2025 - August 21, 2025
  • ๐Ÿ“ SwissTech Convention Center, EPFL, Lausanne ๐Ÿ‡จ๐Ÿ‡ญ
  • ๐Ÿ”— Talk Details

๐Ÿ‘ฅ Contributors

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

๐Ÿ”— Related Projects

  • LLM4S - The Scala toolkit powering Szork's AI capabilities
  • Original Zork - The classic text adventure that inspired this project

Experience the magic of text adventures reimagined with the power of AI! ๐Ÿš€

About

Voice-controlled Zork-style adventure demo using LLM4S: speech, image, tools, and agentic gameplay.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0