Goo tubes played the same as manual tubes. Drop TubeGoo, the purple tile alternatives and the tube_goo custom data layer; the maze generator now picks auto or manual for two-way tubes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
148 lines
8 KiB
Markdown
148 lines
8 KiB
Markdown
# Maze mode
|
|
|
|
A "Maze" button on the main menu asks for a size and a complexity, then
|
|
generates a puzzle-book labyrinth with tubes, a Start and an End.
|
|
|
|
## Goals (checkable)
|
|
|
|
1. Main menu has a **Maze** button. It opens a setup panel (same look as
|
|
Options) with **Width** (1-4 screens), **Height** (1-3 screens) and
|
|
**Complexity** (1-5), plus **Generate** and **Back**.
|
|
2. The same inputs and seed always give the same maze.
|
|
3. The maze fills `Width x Height` screens (one screen = 20 x 15 tiles, the
|
|
RoomCamera's room). Tubes run between screens and through walls.
|
|
4. **Maze-book feel:** each region is a labyrinth of narrow corridors with
|
|
1-tile walls: long winding paths, branches, dead ends. Complexity 1 is
|
|
roomy (3-tile corridors, many loops); 4-5 is a dense 1-tile labyrinth.
|
|
5. Tube kinds: auto, manual and **one-way** (orange tiles).
|
|
One-way tubes:
|
|
- only let the slime in at their entrance; orange motes drift into it;
|
|
- **suck**: the slime is pulled in as soon as its middle is on the tile in
|
|
front of the entrance, without pressing anything;
|
|
- **blow**: white motes stream out of the exit; within 1 tile of the exit
|
|
(the blow zone) the slime is knocked off a wall or ceiling, or lifted off
|
|
the floor (240 px/s away; sideways blows also lift at 120 px/s).
|
|
6. Start and End are clearly visible (green START pad, gold END pad).
|
|
Touching End shows a win panel with **New maze** and **Main menu**.
|
|
7. **No soft-locks.** From every place the slime might get to, End must still
|
|
be surely reachable. Checked on the finished tiles by a validator that
|
|
doesn't trust the generator; a failed maze is thrown away and the next seed
|
|
tried.
|
|
8. A headless check builds many mazes and runs the validator on each, plus
|
|
negative tests the validator must reject.
|
|
|
|
9. **Lots of long tube rides**, many through open space: tubes run through
|
|
open halls and wide corridors where the slime can still get round them,
|
|
wind through rock and cross screens. Tubes of the same kind may **cross**
|
|
at a cross tile: auto and one-way tubes go straight across (two separate
|
|
rides); manual tubes join into one network you steer through
|
|
(checked in the game: a manual junction turns, an auto one goes straight).
|
|
|
|
| Complexity | Regions / screen | Corridor | Loops | Halls / region | One-way on route | Extra tubes / screen | Open rides / screen | Wall pipes / screen | Steered share |
|
|
|---|---|---|---|---|---|---|---|---|---|
|
|
| 1 | 2 x 1 | 3 | 50 % | 0 | 0 | 0.5 | 1.5 | 0 | 30 % |
|
|
| 2 | 2 x 1 | 2 | 30 % | 1 | 1 | 1 | 2 | 1 | 35 % |
|
|
| 3 | 2 x 1 | 2 | 15 % | 1 | 2 | 1.5 | 3 | 2 | 40 % |
|
|
| 4 | 1 x 1 | 1 | 5 % | 2 | 3 | 1.5 | 3.5 | 3 | 40 % |
|
|
| 5 | 1 x 1 | 1 | 0 % | 3 | 4 | 2 | 4.5 | 5 | 45 % |
|
|
|
|
Open rides are at least 12 tiles long and go from one spot to a far one in the
|
|
same or a neighbouring region (often on another screen). Tube winding goes up
|
|
with complexity.
|
|
|
|
## Non-goals
|
|
|
|
- No change to player movement, existing levels or other menus (besides the
|
|
one button). The player only gains what one-way tubes need: they only let it
|
|
in at the entrance, `pull_into_tube()` and `blow_away()`.
|
|
- No hazards, items or enemies. No saving of mazes; the seed isn't shown.
|
|
|
|
## Approaches considered (rework for maze-book layouts)
|
|
|
|
1. **Region graph + coarse-grid labyrinth per region (chosen).** Keep the
|
|
region graph (spanning tree rooted at End, one-way tubes towards End on the
|
|
route, extra tubes). Inside each region carve a classic recursive-backtracker
|
|
maze on a coarse grid (cell = corridor width, wall = 1 tile) and braid some
|
|
dead ends, plus open halls. Tubes between regions run in the rock between
|
|
regions; open rides run through rock and open air (halls, corridors 3+
|
|
wide) as long as each region's air stays in one piece; short "wall pipes"
|
|
go through one wall inside a region as shortcuts. Same-kind tubes may cross
|
|
straight across each other.
|
|
Safe by construction: corridors are two-way, and the tree still leads to
|
|
End from every region. One-way ends only go where their forced tiles don't
|
|
cut a region (see `MazeTubeRouter`).
|
|
2. **Corridor graph with rooms.** Rooms joined by drawn corridors. More
|
|
varied shapes, but corridors cross and need their own routing, and it reads
|
|
less like a maze book.
|
|
3. **Tile-level random carving + full search.** Random walks/caves, keep if
|
|
the search passes. Little control over difficulty, many rejected tries.
|
|
|
|
Approach 1 gives the dense maze-book look directly, scales by corridor width
|
|
and braid, and keeps the old safety argument.
|
|
|
|
## How the slime moves (checked in the game)
|
|
|
|
A scripted run in 1-tile spaces showed the slime: crawls a 1-tall corridor's
|
|
floor and ceiling; gets from floor to ceiling there; climbs a 1-wide shaft up
|
|
and down; turns into a shaft above a corridor from the ceiling; falls into a
|
|
shaft below; and goes from a shaft back into a corridor. So the narrowest
|
|
corridor is 1 tile.
|
|
|
|
## The soft-lock check (`MazeValidator` + `SlimeMoves`)
|
|
|
|
Works only from the TileMapLayer, with two models:
|
|
|
|
- **Might get to (generous):** any air tile joined to Start's tile by air, or
|
|
through a tube it could go into.
|
|
- **Surely gets to End from (strict, `SlimeMoves`):** a state is the slime in
|
|
an air tile stuck to one solid side. Moves: slide along a surface, turn an
|
|
inside corner, wrap an outside corner, cross a 1-tile gap, let go of a
|
|
ceiling and fall, go into a tube mouth in the surface it's on (coming out
|
|
stuck to the exit mouth's face; auto and one-way tubes go straight across
|
|
cross tiles, manual networks let it leave by any of their mouths).
|
|
Tube tiles standing in open air are solid like rock: the slime crawls on
|
|
them. Forced tiles: the tile in front of an
|
|
entrance (sucked in) and blow zones (blown to known spots: sideways onto the
|
|
landing tile's floor or the next; down, falling from the landing tile). A
|
|
state on a forced tile only counts if every place it can be moved to counts.
|
|
Exits that blow up, into a wall, sideways where it isn't 1 tile tall, or down
|
|
through another forced tile are rejected (their outcome isn't sure).
|
|
|
|
Pass if every state at every tile the slime might get to can surely reach End.
|
|
"Start reaches End" alone isn't enough: a one-way tube, a sucking entrance or a
|
|
blow zone can drop the slime where End is out of reach.
|
|
|
|
Not pinned: blow zones always have air past them and push the slime out of the
|
|
zone; suction only pulls into a tube that leads somewhere with room.
|
|
|
|
## Files
|
|
|
|
- `UI/maze_setup_menu.*` - the size/complexity panel.
|
|
- `Levels/Maze/maze_settings.gd` - inputs and the complexity table.
|
|
- `Levels/Maze/maze_graph.gd` - regions, spanning tree, one-way and extra tubes.
|
|
- `Levels/Maze/maze_corridors.gd` - carves a labyrinth into a region.
|
|
- `Levels/Maze/maze_tube_router.gd` - tubes between regions and wall pipes; one-way safety rules.
|
|
- `Levels/Maze/maze_carver.gd` - puts it together; Start and End.
|
|
- `Levels/Maze/maze_tiles.gd` - finds the tile for a tube shape and kind.
|
|
- `Levels/Maze/slime_moves.gd` - the strict movement model.
|
|
- `Levels/Maze/maze_validator.gd` - the soft-lock check.
|
|
- `Levels/Maze/maze_builder.gd` - graph, carve, check; next seed on failure.
|
|
- `Levels/Maze/maze_level.*`, `maze_marker.gd`, `maze_win_menu.*` - the playable scene.
|
|
- `Effects/one_way_tube.gd` - one-way rules: entrance check, exits, blow zones.
|
|
- `Effects/tube_air_currents.gd` - suction and blow acting on the player.
|
|
- `Effects/tube_airflow.gd` - orange motes in, white motes out.
|
|
- `Effects/pixel_stream.gd` - `trace_tube()`, shared by player and validator.
|
|
- `Assets/level_tiles.tres` - orange one-way tiles (alternatives 3-5) and their
|
|
custom data layers.
|
|
- `tests/maze_check.gd` - the headless check.
|
|
|
|
Run the check:
|
|
`godot --headless --audio-driver Dummy --script res://tests/maze_check.gd`
|
|
|
|
Junction test: one hand-made map with a cross tile must pass as manual tubes
|
|
and fail as auto tubes.
|
|
|
|
Negative tests: a one-way trap (a region whose only way in is a one-way
|
|
tube), Start in a blow zone, and two hand-made maps where Start and End are
|
|
joined by air (so an area-level check passes) but a blow zone or a sucking
|
|
entrance stops the slime.
|