rustnake 1.3.0

Production-grade terminal Snake in Rust with decoupled core/render design, non-blocking input, and persistent settings
rustnake-1.3.0 is not a library.

Production-grade terminal Snake in Rust with deterministic ticks, decoupled core/render architecture, non-blocking input, localization, and persistent settings.

Compatibility

  • Rust: 1.85+ (Edition 2024).
  • Primary tested target: Linux x86_64-unknown-linux-gnu.
  • Crate distribution: crates.io/crates/rustnake
  • Terminal requirements:
    • Unicode-capable font (for box-drawing and symbols).
    • ANSI escape sequence support.

Install

Option 1: Install from crates.io (recommended)

cargo install rustnake --locked

Update to the latest published crate version:

cargo install rustnake --locked --force

By default, Cargo installs binaries to ~/.cargo/bin (or your configured Cargo bin directory).

Option 2: Download a prebuilt release binary (GitHub Releases)

curl -fL https://github.com/MiguelRegueiro/rustnake/releases/latest/download/rustnake -o rustnake
chmod +x rustnake

Release assets include platform-specific binaries (Linux, macOS, Windows) generated by CI.

Option 3: Build from source

git clone https://github.com/MiguelRegueiro/rustnake.git
cd rustnake
cargo build --release --locked

--locked ensures dependency resolution matches Cargo.lock exactly.

Run

From a crates.io install:

rustnake

From a downloaded release binary:

./rustnake

From source tree:

cargo run --release --locked

Helper script:

./run.sh           # release mode (default)
./run.sh --dev     # debug mode
./run.sh --help

Gameplay

Controls

Action Key
Move WASD or Arrow Keys
Pause P
Mute M
Confirm menu option ENTER or SPACE
Select menu option directly 1-6
Quit Q

Features

  • Wrap-around movement (Nokia style).
  • Four difficulty levels: Easy, Medium, Hard, Extreme.
  • Power-ups for speed, score, and size effects.
  • Dynamic pace scaling by score and difficulty.
  • Per-difficulty high scores.
  • Localized UI: en, es, ja, pt, zh.
  • Responsive layout with terminal resize support.

Base Tick Rates

Difficulty Horizontal Tick Vertical Tick
Easy 150ms 300ms
Medium 100ms 200ms
Hard 60ms 120ms
Extreme 35ms 70ms

Configuration and Data

Config file location:

  • Primary: ~/.rustnake.toml
  • Fallback: ./.rustnake.toml (if HOME is unavailable)

Persisted data includes:

  • high_scores by difficulty
  • user settings (language, pause on focus loss, sound, default difficulty)
  • config_version for migration handling

Development

Quality Commands

cargo fmt --all --check
cargo check --all-targets --all-features --locked
cargo clippy --all-targets --all-features --locked -- -D warnings
cargo test --all-targets --all-features --locked

Repository Layout

Path Responsibility
src/core/ Game state, movement, collisions, scoring, power-ups
src/i18n/ Localization and text width helpers
src/input/ Keyboard, focus, and resize event translation
src/layout/ Terminal-size validation and centered layout
src/render/ Terminal rendering and HUD drawing
src/storage/ Config persistence and migration
src/utils/ Shared constants and enums

Release Operations

  1. Ensure all quality commands pass locally.
  2. Update CHANGELOG.md.
  3. Commit and push to main.
  4. Create and push a semver tag (vX.Y.Z).
  5. GitHub Actions release workflow validates the tag/changelog, publishes GitHub release notes from CHANGELOG.md, uploads platform binaries, and publishes to crates.io via Trusted Publisher.

Troubleshooting

  • Terminal too small: resize until the warning clears (minimum baseline 40x25; some languages require wider terminals).
  • Display artifacts after resize: resize once more to force a full redraw.
  • Missing bell/sound cue: terminal bell may be disabled by local settings.

Changelog

License

MIT. See LICENSE.