Skip to main content

Gravitype

A terminal typing game where words fall from the sky. Type them before they hit the bottom — miss one and you lose a life.

Built with Textual.

 ██████╗ ██████╗  █████╗ ██╗   ██╗██╗████████╗██╗   ██╗██████╗ ███████╗
██╔════╝ ██╔══██╗██╔══██╗██║   ██║██║╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝
██║  ███╗██████╔╝███████║██║   ██║██║   ██║    ╚████╔╝ ██████╔╝█████╗
██║   ██║██╔══██╗██╔══██║╚██╗ ██╔╝██║   ██║     ╚██╔╝  ██╔═══╝ ██╔══╝
╚██████╔╝██║  ██║██║  ██║ ╚████╔╝ ██║   ██║      ██║   ██║     ███████╗
 ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚═╝   ╚═╝      ╚═╝   ╚═╝     ╚══════╝

Features

  • Falling-word gameplay with difficulty that ramps up as you score
  • Two word categories: Tech and General
  • 7 colour themes (Dracula, Nord, Tokyo Night, Gruvbox, Catppuccin, Cyberspace, 80s After Dark)
  • Configurable starting lives (3 / 5 / 8) and bell-on-miss sound
  • Persistent high score
  • Pause, in-game help and keybind reference

Requirements

Python 3.9+ (developed on 3.12). Any terminal with 256-colour support.

Install

The quickest way, which puts gravitype on your PATH in an isolated environment:

uv tool install gravitype

Or with pipx, or plain pip:

pipx install gravitype
pip install gravitype

Then launch it:

gravitype

python -m gravitype works too, if you'd rather not rely on the script being on your PATH.

Running from source

git clone https://github.com/kanakOS01/gravitype.git
cd gravitype
uv sync
uv run gravitype

How to play

Words spawn at the top of the board and drift down. Type a word and it disappears the moment the text matches — no Enter needed. Points are 10 × word length, and every 150 points bumps you up a level, which makes words fall faster, spawn more often and get longer.

If a word reaches the bottom you lose a life. At zero lives the run ends and your score is checked against the high score.

The input box flashes on a hit, and turns red the moment what you have typed is no longer the prefix of any word on screen.

Keybinds

Menu

Key Action
ctrl+p / escape Play / back to menu
ctrl+s Settings
ctrl+h Help
ctrl+a About
ctrl+q Quit

In game

Key Action
escape Pause / resume
ctrl+g Quit to menu (run is not scored)
ctrl+w Clear the word being typed

Configuration

Settings are edited in-game (ctrl+s) and stored in ~/.gravitype/, so your high score follows you regardless of which directory you launch from:

~/.gravitype/
  config.json            your settings and high score
  theme_active.tcss      generated stylesheet, safe to delete

Set GRAVITYPE_HOME to relocate that directory — handy for keeping separate profiles, or for trying things out without touching your real save:

GRAVITYPE_HOME=/tmp/gravitype-test gravitype

config.json is plain JSON, so you can edit it by hand if you prefer:

{
    "high_score": 1790,
    "theme": "dracula",
    "sound_enabled": true,
    "starting_lives": 5
}

Unknown keys are ignored and a corrupt file falls back to defaults, so it is safe to delete the file to reset everything.

Versions before 0.3 kept this as a .gravitype_config.json dotfile in the working directory. If ~/.gravitype/config.json does not exist yet, Gravitype reads that dotfile once and migrates your settings forward, leaving the original where it is. An existing ~/.gravitype/config.json always takes precedence.

Project layout

gravitype/
  cli.py                     console entry point
  __main__.py                enables `python -m gravitype`
  core/
    config.py                config load/save + theme compilation
    paths.py                 per-user config and cache locations
    words.py                 word pools and level-based word picking
  tui/
    app.py                   app, screens and game loop wiring
    widgets/
      game_board.py          falling words, collision, scoring
      header.py              in-game score/level/lives bar
      main_header.py         banner and nav tabs
      screens.py             settings, help, about
      table.py               keybind table
    styles/
      base.tcss              layout and component styles
      themes/*.tcss          colour variables per theme

Themes work by concatenation: on startup generate_theme_file() writes the selected theme's variables plus base.tcss into ~/.gravitype/theme_active.tcss, and hands that path to Textual as the app's stylesheet. It is written outside the package so an installed, read-only copy still works, and it is safe to delete — it regenerates on next launch. Adding a theme means dropping a new .tcss of variables into themes/ and adding it to the Settings dropdown.

Contributing

See CONTRIBUTING.md.

Credits

Colour themes are inspired by and adapted from Smassh.

License

MIT © Kanak Tanwar

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gravitype-1.0.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gravitype-1.0.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file gravitype-1.0.0.tar.gz.

File metadata

  • Download URL: gravitype-1.0.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gravitype-1.0.0.tar.gz
Algorithm Hash digest
SHA256 30d85cbc30a737c5eaf39314e298a85fa1a3995835ceae9c915ac322fde8c146
MD5 ed0480336759d051fbe468ae1ea268e5
BLAKE2b-256 fc65d322bec487e5f1d81c61f46850f64cd744c236fdf45e54b8c9b757f36d9d

See more details on using hashes here.

File details

Details for the file gravitype-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gravitype-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gravitype-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c98c963648d9f19991a665ce54e84f865b034ce31c3fa3974d4d5b4dfbefa832
MD5 b291ef2bcaf639b6b40e2503c191641e
BLAKE2b-256 63f4d992a9aeea835361be096621aa9709fe7c38939b0fe0f76ac7d7137426fa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page