Snake Out

A Snake Puzzle Game — Unity Template

Version 1.0 | Unity 6+

🌟 This asset was made with the HyperCasual Game Engine!   Check it out — mobile puzzle templates & more. Click here to learn more ➔

Important: Template / Starting Point

This asset is designed as a template and starting point for your own game development. It provides the core systems, architecture, and tools needed to build a snake puzzle game. You are expected to customize, extend, and modify this template to create your unique game. This is not a complete, ready-to-publish game — it's a foundation for developers to build upon.

Overview

Snake Out is a grid-based puzzle game where players drag color-coded snakes into their matching holes before time runs out. The game features procedurally rendered visuals, a built-in level editor, an automatic level generator, a booster system, and full AdMob ad integration.

Drag-to-Solve Puzzles

Intuitive touch/mouse controls — drag snake heads or tails to navigate them across the grid and into matching colored holes.

Level Editor

Full Unity Editor window for designing levels with visual grid painting — place walls, holes, and snake segments with color-coded tools.

Auto Level Generator

Batch-generate hundreds of solvable levels with configurable difficulty curves, grid sizes, snake counts, and obstacle densities.

Booster System

Three in-game boosters — Freeze Time, Break Wall, and Auto-Solve — with tutorial popups and usage tracking.

AdMob Integration

Ragendom Monetization module with banner, interstitial, and rewarded video ads. Includes a Dummy provider for editor testing.

500 Levels Included

Ships with 500 pre-generated levels with a progressive difficulty curve, ready to play out of the box.

Getting Started

Requirements

Installation

  1. Import the Snake Out package into your Unity project
  2. Open the game scene at Assets/Snake Out/Scenes/GameNew.unity
  3. Press Play to test the first level

Quick Test

Once in Play mode, drag any snake by its head (or tail, if unlocked) toward the hole that matches its color. When all snakes are in their holes, the level is cleared and the next level loads automatically.

Folder Structure

Snake Out/ │ ├── Art/ │ ├── Materials/ — Shared materials (e.g. SnakeWallAndGround) │ └── Textures/ — UI textures (booster icons, panel backgrounds, etc.) │ ├── Audio/ — All sound effects (.wav) │ ├── Documentation/ — This documentation file │ ├── Editor/ — Editor-only scripts (excluded from builds) │ ├── LevelEditorWindow.cs — Visual level designer │ └── LevelGenerator.cs — Automatic batch level generator │ ├── Prefabs/ — All prefabs (UI panels, HUD, developer tools) │ ├── GameHUD_Panel.prefab │ ├── GameOverPanel.prefab │ ├── LevelClearedPanel.prefab │ ├── LoseWinPanel.prefab │ ├── Popup_Powerup_Picker.prefab │ └── DeveloperModeButton.prefab │ ├── Scenes/ │ └── GameNew.unity — Main game scene │ └── Scripts/ — All runtime scripts ├── SlitherRushGame.cs — Main game controller ├── SlitherSnake.cs — Snake entity (visuals, movement, particles) ├── LevelData.cs — Data structures (LevelData, LevelHole, LevelSnake, etc.) ├── LevelManager.cs — Level loading, progression, and persistence ├── SoundManager.cs — Audio system (singleton) ├── LoseWinPanelManager.cs — Win/Lose UI panel controller ├── CameraSwitcher.cs — Multi-game camera switching ├── InfiniteRotator.cs — UI rotation effect ├── DeveloperModeButton.cs — Dev panel toggle button └── DeveloperSettingsController.cs — Dev panel controls (level nav, ads) Resources/ — Unity Resources folder (loaded at runtime via Resources.Load) ├── Levels/ — 500 level JSON files (Level_1.json ... Level_500.json) └── SnakeWallAndGround.mat — Runtime-loaded wall material

Gameplay

Core Mechanics

Each level is a grid containing color-coded snakes, holes, and walls. The goal is to guide every snake into the hole that matches its color before the countdown timer reaches zero.

Snake Colors

The game supports seven predefined snake/hole colors:

Color Key Color Hex Value
orange Orange #FFA502
pink Pink #FF6B81
darkblue Dark Blue #1E90FF
blue Light Blue #48DBFB
red Red #FF4757
yellow Yellow #ECCC68
green Green #7BED9F

Win & Lose Conditions

Hole Animation

When a snake reaches its matching hole, it enters a segment-by-segment sucking animation. Each segment is removed on a timer while the visuals smoothly slide toward the hole. Colored particle bursts spawn at the hole entrance as segments are consumed.

Scripts Reference

Runtime scripts use the HypercasualGameEngine namespace. Developer/UI scripts use the PixelShooter3D namespace.

Core Scripts

Script Description
SlitherRushGame Main game controller. Spawns the grid, walls, holes, and snakes procedurally. Handles input (drag-to-move), game timer, hole entrance detection, win/lose conditions, and all booster logic. Attached to the root game object in the scene.
SlitherSnake Individual snake entity. Manages segment data, line renderer visuals (with shadow), eye animation, tongue animation, tail indicator, drag preview, hole slide animation, hole burst particles, and auto-solve flight arc.
LevelData Data structures for levels: GridPos, LevelHole, LevelSnake, LevelData, and the SlitherColors color palette. Serializable to/from JSON.
LevelManager Static class that loads level JSONs from Resources/Levels/, tracks the current level index via PlayerPrefs, and provides methods to advance, go back, or jump to any level.
SoundManager Singleton audio system. Exposes named methods for each sound effect: PlaySnakeMove(), PlaySnakeFlyToHole(), PlaySegmentSucked(), PlayFreezeTime(), PlayBreakWall(), PlayGameWin(), PlayGameOver().
LoseWinPanelManager Manages the Win and Lose UI panels. Auto-finds child panels by name. Supports auto-loading the next level after a configurable delay on win.

Utility Scripts

Script Description
CameraSwitcher Switches the camera between multiple parent transforms (for multi-game setups). Persists the selected index via PlayerPrefs.
InfiniteRotator Simple component that continuously rotates its transform around the local Z axis. Used for UI effects like radial shine animations.
DeveloperModeButton Toggles a developer settings panel on click. Auto-finds a child named DeveloperSettingsPanel if no reference is assigned.
DeveloperSettingsController Developer panel with buttons for level navigation (next, previous, reload, trigger win/lose) and ad testing (show/hide banner, show/request interstitial, show/request rewarded).

Editor Scripts

Script Description
LevelEditorWindow Unity Editor window (Tools > Snake Out Level Editor) for visually designing levels with a grid painter.
LevelGenerator Unity Editor window (Tools > Snake Out Auto Level Generator) for batch-generating levels with configurable parameters.

Level Editor

Opening the Level Editor

In the Unity menu bar, go to Tools > Snake Out Level Editor. This opens a dedicated Editor window — no need to enter Play mode.

Features

Paint Modes

Mode Left Click
None No painting — click cells to inspect
Wall Place a wall obstacle at the clicked cell
Hole Place a hole with the selected color at the clicked cell
Snake Append a segment to the selected snake at the clicked cell
Erase Remove whatever is at the clicked cell (wall, hole, or snake segment)

Level Storage

All levels are stored as individual JSON files in Assets/Resources/Levels/ with the naming convention Level_1.json, Level_2.json, etc. They are loaded at runtime via Resources.LoadAll.

Automatic Level Generator

The Automatic Level Generator is an Editor tool that batch-generates solvable puzzle levels procedurally. It uses constraint-based random placement with configurable difficulty curves.

Opening the Tool

In the Unity menu bar, go to Tools > Snake Out Auto Level Generator. This opens a settings window where you can configure all parameters before generating.

Settings

Setting Description
Levels to Generate How many new level files to create. New levels are appended after existing ones (never overwrites).
Cols / Rows (Min & Max) Range for randomizing the grid dimensions of each level.
Snake Count (Min & Max) Range for the number of snakes placed per level.
Snake Length (Min & Max) Range for the segment count of each snake.
Empty Tiles % (easy → hard) How much of the grid remains open. Higher values = easier (more room). Interpolates from easy to hard across the batch.
Time Limit (easy → hard) Countdown timer in seconds. Interpolates across the batch.
Tail-Lock Chance (easy → hard) Probability that a snake's tail is locked (can only move by head). Higher values = harder.
Hole Distance Factor (easy → hard) Controls how far holes are placed from their matching snakes. Higher values = harder.
Max Floating Wall Islands Maximum number of disconnected wall clusters per level (0–5).

How It Works

  1. Configure settings — adjust all parameters in the Editor window
  2. Click "Generate Levels" — the tool detects existing levels and appends new ones
  3. For each level, the generator:
    • Randomizes grid size, snake count, and snake lengths within your ranges
    • Interpolates difficulty settings (empty %, time, tail-lock chance, hole distance) based on position in the batch
    • Places snakes with connected segments using random walk
    • Places matching holes at appropriate distances
    • Fills remaining cells with walls based on the empty-tile percentage
    • Optionally adds floating wall islands
    • Exports a JSON level file to Resources/Levels/

Non-Destructive

The generator never overwrites existing level files. It always starts numbering from the next available index (e.g., if Level_500 exists, new levels start from Level_501).

Boosters

The game includes three booster abilities that players can activate during gameplay. Each booster has a limited number of uses per level and an optional tutorial popup that appears on first use.

Booster Effect Activation
Freeze Time Pauses the countdown timer for a set duration, giving extra time to solve the puzzle. Tap the freeze button. The timer bar changes color to indicate the freeze is active.
Break Wall Destroys a single wall obstacle, opening up a new path. Spawns a debris particle explosion. Tap the wall-destroy button, then tap any wall on the grid to break it.
Auto-Solve (Wing) Automatically flies a selected snake into its matching hole with an arc animation. Tap the wing button, then tap any snake on the grid to auto-solve it.

Booster Buttons

Booster buttons are found in the scene UI. Each button has:

Cheat Mode

Press the U key during gameplay to unlock all boosters (removes lock state). This is useful for testing.

AdMob Ads

This project includes a Ragendom Monetization module for integrating AdMob ads (banners, interstitials, and rewarded videos). The ad system supports both real AdMob ads on device and a built-in Dummy ad provider for testing in the Unity Editor.

Documentation

Full setup and configuration instructions for the ad system are provided in a separate documentation file located at:

Assets/Snake Out/RagendomAds/Documentation/Documentation.html

That documentation covers AdMob app IDs, ad unit IDs, UMP/GDPR consent, test devices, and all monetization settings.

Video Tutorial

If you prefer a video walkthrough over reading documentation, watch the full ads setup tutorial here:

▶ Watch Ads Setup Tutorial on YouTube

Quick Overview

The ad system consists of the following key components in the scene:

Ad Types

Ad Type Description
Banner A small ad strip displayed at the top or bottom of the screen. Show and hide at any time.
Interstitial A full-screen ad. Must be requested (loaded) first, then shown when ready. Supports cooldown timers and conditions.
Rewarded Video A full-screen video ad that grants a reward on completion. Must be requested first, then shown. Always available regardless of no-ads purchases.

Testing in the Editor

By default, the ad system uses the Dummy provider, which displays test UI overlays in the Editor (a green "TEST BANNER" bar, dark "TEST INTERSTITIAL" overlay, and blue "TEST REWARDED VIDEO" overlay). This lets you verify the ad flow without needing a real device or AdMob account.

The Developer Settings Panel (accessible via the gear icon in-game) includes ad control buttons for testing: Show/Hide Banner, Show/Request Interstitial, and Show/Request Rewarded Video.

Customization Guide

Adding New Snake Colors

Open LevelData.cs and add entries to the SlitherColors dictionary:

private static readonly Dictionary<string, Color> colors = new Dictionary<string, Color> { { "orange", new Color32(255, 165, 2, 255) }, { "pink", new Color32(255, 107, 129, 255) }, // Add your custom colors here: { "purple", new Color32(155, 89, 182, 255) }, };

New colors are automatically available in the Level Editor and Auto Level Generator.

Adjusting Grid Visuals

The grid, walls, holes, and snakes are all rendered procedurally in SlitherRushGame.cs. Key constants:

Modifying Snake Visuals

Snake rendering is handled in SlitherSnake.cs using Unity LineRenderer components. You can customize:

Adding New Boosters

New boosters can be added by following the existing pattern in SlitherRushGame.cs:

  1. Add booster state fields (uses count, active flag, button reference)
  2. Find the button in CreateBoosterButtons()
  3. Handle the booster logic in Update() or a dedicated method
  4. Add a click handler in HandleInput() if the booster requires a target selection

JSON Level Format

Each level is a JSON file with the following structure:

{ "cols": 6, "rows": 8, "timeLimit": 120.0, "holes": [ { "colorKey": "darkblue", "position": { "x": 0, "y": 4 } } ], "snakes": [ { "colorKey": "darkblue", "canMoveByTail": true, "segments": [ { "x": 4, "y": 3 }, { "x": 4, "y": 2 }, { "x": 4, "y": 1 } ] } ], "obstacles": [ { "x": 4, "y": 0 }, { "x": 1, "y": 3 } ] }

The first segment in a snake's segments array is the head; the last is the tail. Grid coordinates are zero-indexed, with (0,0) at the top-left corner.

Support

Common Issues

Issue Solution
No levels load / "No level data found" error Ensure JSON level files exist in Assets/Resources/Levels/ with the naming convention Level_1.json, Level_2.json, etc.
Purple/missing materials on WebGL The game uses Sprites/Default shader for runtime-created transparent materials. If you add custom shaders, ensure they are referenced by a material asset in the project so they are included in WebGL builds.
Snakes won't enter holes on WebGL This is caused by shader stripping (see above). The fix ensures CheckHoleEntrance is called before FlashTile so a shader error cannot block game logic.
Dev panel buttons don't respond If you added a Canvas component to the panel (e.g., for sorting order), you must also add a GraphicRaycaster component to the same object.
Level Editor shows empty grid Click "Reload from Disk" in the Level Editor, or ensure the Resources/Levels/ folder exists.

Tips

Contact Us

If you get stuck or have any issues, feel free to reach out to us at ragendom@gmail.com. We are happy to help!