A Simple Snake Game is a simple snake game in which you simply snake.
- Movement: Arrow keys, WASD, gamepad, mouse, or touch (tap/swipe)
- Pause: Space/Escape/P/or Start button
- Menu Navigation:
- Keyboard arrows/WASD
- Gamepad D-pad/stick
- Mouse
- Select: Enter/Space/A button
- Back: Escape/B button
- Debug overlay: F1 in debug builds
- Single paused tick: F2 while the debug overlay is visible and the game is paused
- Three game modes:
- Classic: the original obstacle-free game of eating and growing
- Pitfall: every third piece of food adds a pit, placed away from the snake whenever space allows
- Obstacles: seeded worlds built from reproducible Gates, Islands, and Ribbons wall patterns
- Multiple control schemes:
- Keyboard (Arrow keys or WASD)
- Gamepad (D-pad or analog stick)
- Mouse (click or drag toward the next direction)
- Touch (tap toward a direction or swipe; swipes resolve as soon as the threshold is crossed)
- Top 100 high scores tracked separately for each game mode
- Subtle cell-aligned gameplay grid, enabled by default and toggleable in Options
- Pause functionality (Space/P/Start button)
- Full controller support with UI navigation
- Versioned settings for sound, effects volume, fullscreen, reduced motion, and the gameplay grid
- Inspector-editable board, timing, scoring, and camera rules
- Deterministic model tests and a debug teaching overlay
Start with the learning path, then use the architecture guide as a map of ownership and runtime flow. The project deliberately uses explicit scene composition instead of Autoload singletons.
The main concepts demonstrated are scenes and node lifecycle, typed signals, Resources, input actions and touch events, pause-aware processing, fixed-tick models, interpolation, custom drawing, Camera2D, audio synthesis and buses, versioned persistence, headless tests, and exports.
The game can be built for different platforms using the provided build script.
- Godot Engine (version 4.7.1 or later) and matching export templates installed
- The Godot executable available in your PATH
- The build script auto-detects
godot,godot4, and theGODOT/GODOT4paths exported bysetup-godot
# Build all platforms (Web, Windows, Linux)
./build.sh
# Build a specific platform
./build.sh web
./build.sh windows
./build.sh linuxThe exported files will be placed in the out/ directory.
Run the source suite in headless mode:
./test.sh sourceFor the built Linux export, run:
./build.sh linux
./test.sh linux-exporttest.sh all runs both paths end-to-end. The source suite imports and parses the project, tests audio synthesis, session lifecycle, deterministic rules, input translation, persistence, and input actions, then instantiates the main scene and verifies that a playable round starts without opening a game window. Persistence and composed-scene tests inject disposable save paths so they do not read or overwrite player settings or scores.
Releases are created from a clean, up-to-date main branch:
./bump_patch.shThe helper runs the source test suite, increments application/config/version, creates the version commit and matching v* tag, then atomically pushes both. Pushing the tag triggers the GitHub release workflow, which tests and exports the Web, Windows, and Linux builds before publishing their archives.
- Explicit scene composition with no Autoload singletons
- Pure
Vector2igrid model with seeded randomness and bounded fixed-tick catch-up - Inspector-editable
GameRulesResource - Owned and injected audio service with speed-aware movement tones, reusable swept PCM cues, click-safe voice pooling, and four waveforms
- Reusable, pooled snake segment scenes and a custom-drawn food view
- Responsive UI design
- Versioned high-score and settings persistence with legacy migration
- Explicit keyboard, gamepad, mouse, tap, and scale-aware swipe translation
- Weighted Camera2D system
Created by bluehexagons in a few days as a learning project for Copilot-assisted Godot game development and release.
Feel free to use this code as a learning resource or base for your own projects.