Skip to content

JustinAlvaran/Garvis

Repository files navigation

Garvis AI — Say Its Name, Play a Game

"Garvis online. What do you want to play?"

A Jarvis-inspired AI desktop assistant for Windows that launches and generates pygame games — fully offline, no internet required. Say "Garvis" or press Ctrl+G to activate.

🔒 Security Policy — Garvis is sandboxed and never accesses your personal files.

Python License Platform Games


What is Garvis?

Garvis is a standalone desktop assistant that lives in your system tray and waits for you to ask it to play a game. It has a glowing, animated UI inspired by Iron Man's Jarvis, understands both game names and natural language descriptions, and generates complete playable games on the fly.

Semantic understanding — Garvis uses ONNX MiniLM sentence embeddings to understand what you mean, not just what you say. Type "peashooter shoots pea at zombie" and it knows you want Plants vs Zombies. Type "chrome dinosaur jump over cactus" and it launches the Dino Game.

Everything runs offline on your machine — no cloud, no API keys, no account needed.


Requirements

  • Python 3.9+Download here (check "Add Python to PATH")
  • Windows 10/11
  • Microphone — optional, for voice activation (Ctrl+G works without it)
  • Git — for cloning the repo

How to Install

git clone https://github.com/YOUR_USERNAME/garvis-ai.git
cd garvis-ai
setup.bat

That's it. setup.bat handles everything:

  1. Creates a Python virtual environment
  2. Installs all dependencies (pygame, vosk, onnxruntime, etc.)
  3. Downloads the Vosk speech model (~40MB, one-time)
  4. Downloads the ONNX MiniLM semantic model (~80MB, one-time)
  5. Adds Garvis to Windows startup (auto-starts on login)
  6. Creates run_garvis.bat for easy launching

If the ONNX model download fails, Garvis automatically falls back to TF-IDF keyword matching. It still works — just less accurate on creative descriptions.


How to Run

Double-click run_garvis.bat — launches silently in system tray, no CMD window.

Or manually:

venv\Scripts\activate
python main.py

Garvis also auto-starts on login after setup. Disable via tray → "Disable auto-start".


How to Build .exe

Want a standalone executable? Double-click build.bat:

build.bat

This builds a folder-based distribution to dist/garvis-ai/garvis-ai.exe using PyInstaller. No console window — runs just like any other Windows app.

Note: Copy the models/ folder into dist/garvis-ai/ for voice and semantic NLP to work in the built version.


How to Use

Activation

Method How
Voice Say "Garvis" into your microphone
Keyboard Press Ctrl+G from anywhere
Tray Right-click system tray icon → "Open Garvis"

Playing a Game

By name:

> chess
> tetris
> snake
> pac man
> plants vs zombies
> geometry dash

With intent prefixes — all of these work:

> play chess
> run tetris
> launch snake
> I want to play sudoku
> can i play battleship

By description (semantic matching understands meaning, not just keywords):

> peashooter shoots pea at zombie             → Plants vs Zombies
> chrome dinosaur jump over cactus            → Dino Game
> cube jumps on beat to avoid spikes          → Geometry Dash
> ball rolls downhill dodge edges             → Slope
> ice cream character in a maze               → Bad Ice Cream
> frog hops across traffic                    → Crossy Road
> slash flying fruits avoid bombs             → Fruit Ninja
> two characters fire and water solve puzzles → Fireboy & Watergirl
> guess a five letter word with color clues   → Wordle
> push boxes onto targets in a warehouse      → Sokoban

Confirmation Flow

If Garvis isn't sure, it asks:

"Did you mean Geometry Dash? Say yes or no."

If you say no, it shows top 3 alternatives.


Full Game List (51 Games)

Classic Arcade

# Game How to Ask
1 Snake "snake", "worm game"
2 Pong "pong", "ping pong"
3 Breakout "breakout", "brick breaker"
4 Pac-Man "pacman", "dot eater"
5 Space Invaders "space invaders", "alien shooter"
6 Flappy Bird "flappy bird", "tap bird"
7 Asteroids "asteroids", "space rocks"
8 Centipede "centipede", "bug shooter"
9 Galaga "galaga", "galaxian"
10 Donkey Kong "donkey kong", "barrel game"
11 Duck Hunt "duck hunt", "shoot ducks"

Puzzle & Logic

# Game How to Ask
12 Tetris "tetris", "falling blocks"
13 2048 "2048", "number merge"
14 Block Blast "block blast", "grid puzzle"
15 Minesweeper "minesweeper", "bomb sweeper"
16 Sudoku "sudoku", "number grid"
17 Wordle "wordle", "five letter word"
18 Picross "picross", "nonogram"
19 Mastermind "mastermind", "code breaker"
20 Lights Out "lights out", "toggle lights"
21 Tower of Hanoi "tower of hanoi", "disk stacking"
22 15 Puzzle "15 puzzle", "sliding puzzle"
23 Sokoban "sokoban", "push boxes"

Strategy & Board

# Game How to Ask
24 Chess "chess", "chess game"
25 Checkers "checkers", "draughts"
26 Tic-Tac-Toe "tic tac toe", "x and o"
27 Connect Four "connect four", "drop discs"
28 Battleship "battleship", "naval battle"
29 Rock Paper Scissors "rock paper scissors", "rps"

Action & Runner

# Game How to Ask
30 Platformer "platformer", "run and jump"
31 Endless Runner "endless runner", "auto runner"
32 Dino Game "chrome dino", "dinosaur game"
33 Geometry Dash "geometry dash", "cube jump"
34 Crossy Road "crossy road", "frogger"
35 Slope "slope", "rolling ball"
36 Run 3 "run 3", "tunnel runner"
37 Stickman Fighter "stickman fighter", "stick fight"

Defense & Shooting

# Game How to Ask
38 Tower Defense "tower defense", "td game"
39 Plants vs Zombies "pvz", "peashooter game"

Reflex & Skill

# Game How to Ask
40 Whack-a-Mole "whack a mole", "hit the mole"
41 Fruit Ninja "fruit ninja", "fruit slice"
42 Typing Speed "typing game", "typing speed"
43 Simon Says "simon says", "color memory"

Card & Matching

# Game How to Ask
44 Memory Cards "memory game", "card flip"
45 Solitaire "solitaire", "klondike"
46 Mahjong Solitaire "mahjong", "tile matching"

Bubble & Color

# Game How to Ask
47 Bubble Shooter "bubble shooter", "bubble pop"
48 Color Switch "color switch", "color ball"

Co-op & Maze

# Game How to Ask
49 Bad Ice Cream "bad ice cream", "ice maze"
50 Fireboy & Watergirl "fireboy watergirl", "fire water"

Word Games

# Game How to Ask
51 Hangman "hangman", "guess the word"

Architecture

garvis-ai/
├── main.py                # Entry point — tray, overlay, voice, hotkey
├── garvis/
│   ├── core.py            # State machine (IDLE → LISTENING → PROCESSING → SPEAKING)
│   ├── ui_overlay.py      # Tkinter Jarvis-style UI with radial waveform
│   ├── voice.py           # TTS via pyttsx3 (offline)
│   ├── wake_word.py       # Vosk wake word detection ("Garvis") + mic auto-detect
│   ├── text_input.py      # Global hotkey (Ctrl+G)
│   ├── nlp.py             # Intent-stripping + alias fast-path + semantic engine
│   ├── semantic_engine.py # ONNX MiniLM embeddings + TF-IDF fallback
│   ├── game_knowledge.py  # 51 games × 15-20 descriptions each
│   ├── game_manager.py    # Game discovery, generation, sandboxed launching
│   ├── game_generator.py  # 8 original pygame game templates
│   ├── games_extra.py     # 12 additional pygame game templates
│   ├── games_phase3.py    # 11 phase 3 game templates
│   ├── games_phase4a.py   # 10 phase 4 game templates (chess, wordle, sudoku...)
│   ├── games_phase4b.py   # 10 phase 4 game templates (galaga, sokoban, mahjong...)
│   └── sandbox.py         # Path restriction, rate limiting, subprocess isolation
├── games/                 # Auto-generated standalone game folders
├── models/                # Downloaded by setup.bat (NOT committed)
│   ├── vosk-model-small-en-us-0.15/  # Vosk speech model (~40MB)
│   └── minilm/            # ONNX MiniLM model (~80MB)
├── garvis.spec            # PyInstaller build configuration
├── build.bat              # One-click .exe build
├── setup.bat              # One-click setup (downloads models, sets auto-start)
├── run_garvis.bat          # One-click silent launch (generated by setup.bat)
├── SECURITY.md            # Security architecture documentation
├── requirements.txt
├── test_verify.py         # NLP + game verification test suite
└── LICENSE

NLP Engine

Garvis uses a three-pass intent matching system:

Pass 0: Intent Stripping

Removes prefixes like "play", "run", "launch", "I want to play" before matching. "I want to play chess""chess" → instant match.

Pass 1: Alias Matching (fast, exact)

Checks if the user's input matches any game alias directly.

Pass 2: Semantic Matching (smart, conceptual)

If no alias matches, Garvis uses ONNX MiniLM (all-MiniLM-L6-v2) to understand the meaning of the user's description:

  • Pre-computes 384-dimensional sentence embeddings for all game descriptions
  • Computes cosine similarity between the user's input and all descriptions
  • Returns the best match if confidence ≥ 0.45
  • Asks for confirmation if confidence is 0.30–0.45
  • Falls back to "describe it more" if confidence < 0.30

Fallback: If the ONNX model isn't available, Garvis uses scikit-learn TF-IDF with cosine similarity (keyword-based, less accurate but always works).


Troubleshooting

Issue Fix
python not found Reinstall Python and check "Add Python to PATH"
Ctrl+G doesn't work Run as Administrator
Voice doesn't activate Check microphone in Windows settings — Garvis auto-detects any mic
ONNX model not downloaded Re-run setup.bat or delete models/minilm/ and retry
"Semantic model unavailable" TF-IDF fallback is active — still works, less accurate
Game window doesn't appear Check pygame: pip install pygame
Tray icon not visible Check Windows system tray overflow area
"Rate limited" Wait 60 seconds (max 5 launches/min)
Want to stop auto-start Right-click tray → "Disable auto-start"
"chess" launches wrong game Update to latest version — fixed in Phase 4
Build .exe fails Run pip install pyinstaller in venv first

Security

Garvis runs entirely offline and sandboxed. See SECURITY.md for details:

  • All file access is restricted to the garvis-ai/ directory
  • Games run in isolated subprocesses with minimal environment
  • No eval(), exec(), or shell=True anywhere
  • All user input is sanitized before processing
  • Game launches are rate-limited (5/min)
  • ONNX model is read-only, never executed as code

License

MIT — see LICENSE

About

A jarvis ai but for games and it is offline too

Topics

Resources

License

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors