Skip to content

emlynoregan/orcsimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸงŒ Orc Simulator

๐ŸŽฎ Play Live Game | Status: โœ… Complete & Deployed

A browser-based AI chat game where you interact with Munch, an angry orc who guards a magic amulet. The entire game runs client-side using WebAssembly and a 500M parameter language model - no servers required!

๐ŸŽฏ Game Overview

Chat with Munch, an angry orc who doesn't trust humans. He guards a precious magic amulet and won't let anyone near it... unless you know how to talk to him. Try different approaches - threats, offers, questions, or food bribes!

๐ŸŽฎ Try it now at emlynoregan.com/orcsimulator

โœจ Key Features

  • ๐Ÿค– True AI Conversations: Powered by Qwen2-0.5B-Instruct (500M parameters)
  • ๐ŸŒ 100% Browser-based: No backend servers, API keys, or data collection
  • โšก WebAssembly Performance: High-speed AI inference in your browser
  • ๐Ÿ”„ Universal Deployment: Smart CDN fallback works everywhere
  • ๐Ÿ“ฑ Mobile Ready: Responsive design for all devices
  • ๐Ÿ”’ Privacy First: All interactions happen locally in your browser
  • ๐Ÿ’พ Offline Capable: Works without internet after initial model download

๐Ÿš€ Quick Start

Play Online (Recommended)

Just visit: emlynoregan.com/orcsimulator

Local Development

# Clone the repository
git clone https://github.com/yourusername/orcsimulator.git
cd orcsimulator

# Start local servers with CDN proxy
python run_game.py

# Game opens automatically at http://localhost:8000

๐ŸŽฎ How to Play

  1. ๐ŸŒ Visit: Go to emlynoregan.com/orcsimulator
  2. โณ Wait: Game downloads 120MB AI model on first load (1-5 minutes)
  3. ๐Ÿ’ฌ Chat: Type messages to interact with Munch the orc
  4. ๐Ÿงช Explore: Try different approaches - threats, offers, questions, food
  5. ๐Ÿ”„ Restart: Use restart button to begin fresh conversations

๐Ÿ› ๏ธ Technical Innovation

๐Ÿ”„ Universal CDN Fallback

Revolutionary deployment system that works everywhere:

  • ๐ŸŒ GitHub Pages: Loads directly from CDN (https://cdn.jsdelivr.net/npm/@wllama/wllama@2.3.2/esm/index.js)
  • ๐Ÿ  Local Development: Automatically falls back to proxy (http://localhost:8001/wllama/index.js)
  • ๐Ÿ”„ Automatic Detection: Seamlessly switches based on environment
  • โšก Zero Configuration: No build process or manual setup

๐Ÿ—๏ธ Architecture

  • Frontend: HTML5, CSS3, Vanilla JavaScript (ES6+)
  • AI Model: Qwen2-0.5B-Instruct (quantized GGUF format)
  • Runtime: wllama (WebAssembly)
  • Threading: SharedArrayBuffer via coi-serviceworker
  • Deployment: GitHub Pages with custom domain

๐Ÿ“ File Structure

orcsimulator/
โ”œโ”€โ”€ index.html              # Landing page with browser check
โ”œโ”€โ”€ game.html               # Main game interface
โ”œโ”€โ”€ coi-serviceworker.min.js # Service worker for WebAssembly
โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ style.css           # Global styles
โ”‚   โ”œโ”€โ”€ landing.css         # Landing page styles
โ”‚   โ””โ”€โ”€ game.css            # Game interface styles
โ”œโ”€โ”€ js/
โ”‚   โ”œโ”€โ”€ main.js             # Landing page logic
โ”‚   โ””โ”€โ”€ game.js             # Game logic with CDN fallback
โ”œโ”€โ”€ docs/                   # Technical documentation
โ”œโ”€โ”€ cdn_proxy.py            # Local development proxy
โ”œโ”€โ”€ run_game.py             # Development server launcher
โ””โ”€โ”€ DEPLOYMENT.md           # Deployment guide

๐ŸŽญ Meet Munch

Munch is an angry orc who:

  • ๐Ÿฐ Guards a precious magic amulet
  • ๐Ÿ˜  Distrusts humans by default
  • โš”๏ธ Responds aggressively to threats
  • ๐Ÿ– Might soften when offered food
  • ๐Ÿ—ฃ๏ธ Speaks in short, brutal sentences
  • ๐Ÿง  Has genuine AI personality (not scripted responses)

๐Ÿ“Š System Requirements

Minimum Requirements

  • Browser: Chrome 91+, Firefox 89+, Safari 16.4+, iOS 16.4+
  • Memory: 500MB RAM available
  • Storage: 120MB for AI model download
  • Connection: Broadband internet for initial download

Browser Compatibility

Browser Min Version Status
Chrome 91+ โœ… Full support
Firefox 89+ โœ… Full support
Safari 16.4+ โœ… Full support
Edge 91+ โœ… Full support
iOS Safari 16.4+ โœ… Mobile support

โšก Performance

  • First Load: Model download takes 1-5 minutes depending on connection
  • Subsequent Loads: Game starts instantly (model cached locally)
  • Memory Usage: ~500MB RAM during gameplay
  • Response Time: 1-3 seconds per AI response on modern hardware
  • Mobile Performance: Optimized for smartphones and tablets

๐ŸŒ Deployment Options

GitHub Pages (Production)

  1. Fork/Clone: This repository
  2. Enable Pages: Repository Settings โ†’ Pages โ†’ Deploy from main branch
  3. Custom Domain: Optional - set up your own domain
  4. Access: https://yourusername.github.io/orcsimulator

Local Development

# Quick start with auto-proxy
python run_game.py

# Manual setup
python -m http.server 8000    # Game server
python cdn_proxy.py           # CDN proxy (separate terminal)

๐Ÿ”ง Troubleshooting

Model Won't Download

  • Check internet connection and firewall
  • Disable ad blockers temporarily
  • Try incognito/private browsing mode
  • Clear browser cache and reload

Poor Performance

  • Close other browser tabs to free memory
  • Ensure browser supports SharedArrayBuffer
  • Try on a different device with more RAM
  • Check available system memory

Game Won't Load

  • Verify browser compatibility
  • Enable JavaScript in browser settings
  • Check browser console for errors (F12)
  • Try a different browser

Firefox Users (Important!)

Firefox has stricter security policies that can prevent the AI model from loading. To fix this:

Option A - Use a different browser:

  • Chrome, Edge, or Safari work best

Option B - Run on local server:

  1. Open terminal/command prompt in the game folder
  2. Run: python -m http.server 8000 (Python 3) or python -m SimpleHTTPServer 8000 (Python 2)
  3. Open http://localhost:8000 in Firefox
  4. DO NOT open the HTML file directly

Option C - Firefox CORS fix:

  1. Type about:config in Firefox address bar
  2. Search for security.fileuri.strict_origin_policy
  3. Set it to false
  4. Restart Firefox

๐ŸŽฏ Development Status

โœ… Completed Features

  • AI-powered orc character with personality
  • Responsive web interface
  • WebAssembly integration
  • CDN fallback mechanism
  • Mobile compatibility
  • GitHub Pages deployment
  • Custom domain setup

๐Ÿš€ Future Enhancements

  • Multiple characters and personalities
  • Save/load conversation history
  • Voice input/output
  • Achievements and unlockables
  • Character customization
  • Multiplayer chat rooms

๐Ÿ“„ License

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

๐Ÿ™ Credits

๐Ÿ”— Links


๐ŸŽฎ Built with โค๏ธ and AI. No servers harmed in the making of this game.

โ–ถ๏ธ Play Orc Simulator Now

About

A browser based LLM game, Orc Simulator, using in-browser LLMs

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors