Play now: nntin.xyz/gSnake
Gravity Snake reimagines the classic Snake game by introducing gravity physics and strategic, turn-based movement.
Unlike traditional Snake games that rely on reflexes, Gravity Snake is a puzzle game where you must think several moves ahead. The snake only moves when you act, and after each move, gravity pulls it downward until it hits an obstacle or the floor.
- ๐ฎ Controls: Use arrow keys or WASD to move
- ๐ฏ Goal: Collect all food, then reach the exit
โ ๏ธ Rules:- Avoid hitting walls, obstacles, or yourself
- You cannot reverse direction (no 180ยฐ turns)
- Gravity pulls you down after each move
- ๐ Restart: Press
Rto restart the current level - ๐ Menu: Press
Qto return to level 1
- ๐งฉ Puzzle-focused gameplay with gravity physics
- ๐ Progressive difficulty across multiple levels
- ๐จ Clean, minimalist design
- ๐ Built with Rust + WebAssembly for performance
- โ Comprehensive contract testing ensures reliability
This is a monorepo containing several submodules:
- gsnake-core - Rust game engine (part of root repo, not a submodule)
- gsnake-web - Svelte web UI (git submodule)
- gsnake-editor - Level editor (git submodule)
- gsnake-levels - Level definitions and renderer (git submodule)
- gsnake-specs - Documentation and specifications (git submodule)
Each submodule can build and test independently using git branch dependencies.
Dependency ownership, update cadence, and security-audit triage are documented in
docs/dependency-maintenance-policy.md.
Automated npm/cargo audits run from .github/workflows/dependency-audit.yml on a weekly schedule and can be run manually with:
act -W .github/workflows/dependency-audit.yml -j npm-audit --container-architecture linux/amd64
act -W .github/workflows/dependency-audit.yml -j cargo-audit --container-architecture linux/amd64- gsnake-web (Vite dev server): http://localhost:3000
- gsnake-editor (Vite dev server): http://localhost:3003
- gsnake-editor test-level API (Express): http://localhost:3001 (
/api/test-level)
The repository supports two modes:
- Root repository mode (this repo with submodules)
- Standalone submodule mode (each submodule cloned independently)
gsnake-web and gsnake-editor now synchronize UI through gsnake-web-ui:
gsnake-webis an npm workspace with:packages/gsnake-web-uipackages/gsnake-web-app
gsnake-editordepends ongsnake-web-uivia an auto-detection preinstall script.
gsnake-web-appuses localgsnake-coreWASMgsnake-editoruses local../gsnake-web/packages/gsnake-web-ui- shared style/sprite/component changes can be validated across both apps immediately
gsnake-webvendors prebuilt WASM automaticallygsnake-editorvendors agsnake-web-uisnapshot fromNNTin/gsnake-webmainand builds it locally for precompiled consumption- standalone CI jobs force this mode with
FORCE_GIT_DEPS=1
When changing shared art style:
- edit
gsnake-web/packages/gsnake-web-ui - run
npm --prefix gsnake-web run dev(UI watch + web app dev) - run
npm --prefix gsnake-editor run devto verify editor parity - build/test both packages before merge
Breaking gsnake-web-ui changes are allowed, but editor compatibility must be updated quickly to keep standalone CI green.
Root repository:
# Clone with submodules
git clone --recurse-submodules https://github.com/nntin/gSnake.git
# Build WASM
python3 scripts/build_wasm.py
# (Regenerates gsnake-core/engine/core/data/levels.json from gsnake-levels first)
# Build web UI
cd gsnake-web
npm install
npm run buildStandalone submodules:
Each submodule can be cloned and built independently. See the README.md in each submodule for instructions.
Use exactly one package-level command per package:
gsnake-web:npm run coveragegsnake-editor:npm run coveragegsnake-core:./scripts/coverage.shgsnake-levels:./scripts/coverage.sh
Coverage report output locations are standardized:
gsnake-web/packages/gsnake-web-app/coverage/gsnake-editor/coverage/gsnake-core/target/llvm-cov/lcov.infogsnake-levels/target/llvm-cov/lcov.info
All submodule CI workflows are designed to be compatible with nektos/act, a tool for running GitHub Actions locally.
macOS:
brew install actLinux:
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bashWindows:
choco install act-cliTest individual workflows in any submodule:
gsnake-core (Rust):
cd gsnake-core
act -j build # Test build job
act -j test # Test test job
act -j wasm # Test WASM build jobgsnake-web (TypeScript/Svelte):
cd gsnake-web
act -j build # Test build job
act -j typecheck # Test typecheck job
act -j test # Test test jobgsnake-levels (Rust):
cd gsnake-levels
act -j build # Test build job
act -j test # Test test jobgsnake-editor (TypeScript/Svelte):
cd gsnake-editor
act -j build # Test build job
act -j typecheck # Test typecheck job
act -j test # Test test jobgsnake-specs (Markdown docs):
cd gsnake-specs
act -j markdown-lint # Test markdown linting
act -j link-check # Test link checking
act -j validate # Test structure validationRoot repository (all tests):
# Run individual jobs from root repo
act -W .github/workflows/ci.yml -j build # Test gsnake-core build
act -W .github/workflows/ci.yml -j test # Test gsnake-core tests
act -W .github/workflows/ci.yml -j wasm # Test WASM build
act -W .github/workflows/ci.yml -j gsnake-editor-test # Test gsnake-editor
act -W .github/workflows/ci.yml -j e2e-test # Test E2E tests (slow)
# Or run all jobs (this will take 15+ minutes):
act -W .github/workflows/ci.yml- Docker requirement:
actrequires Docker to be installed and running - Cache behavior: actions/cache may behave differently locally than on GitHub
- WASM build: The WASM job in gsnake-core may be slow due to wasm-pack installation (~30-40s)
- Link checking: The gsnake-specs link-check job may fail due to network issues or rate limits
- External repo checkouts: Submodule test.yml workflows that checkout external repositories (gsnake-levels, gsnake-web) require a GitHub token:
act -W .github/workflows/test.yml --secret GITHUB_TOKEN="your-token" - E2E tests: The root e2e-test job takes 5+ minutes due to WASM compilation, npm installs, and browser automation
- Cross-repo links: The gsnake-specs link-check may report false positives for relative links to sibling submodules (../../gsnake-*/README.md) when run in standalone mode
If act is not available, you can manually test the same commands that CI runs:
Rust projects:
cargo build --verbose
cargo test --verboseJavaScript projects:
npm ci
npm run build
npm run check
npm testgsnake-specs:
npx markdownlint '**/*.md'
npx markdown-link-check README.md