SlimePlatformer/Levels/Maze/maze_settings.gd
tachyonwolf e7ae22b8cd Add Maze mode with one-way tubes and a soft-lock check
- Main menu "Maze" button opens a setup panel (width, height in screens;
  complexity 1-5) and generates a maze of rock chambers joined by tubes,
  with Start and End pads and a win panel.
- New one-way tube kind: orange tiles that only let the slime in at their
  entrance, with motes drifting into it (OneWayTube, TubeVacuum). The
  auto-tube trace moved to PixelStream.trace_tube so the player and the
  maze validator share it.
- Generation: chamber graph (spanning tree rooted at End, one-way tubes
  only towards End on the route, extra tubes), carved with AStarGrid2D.
  MazeValidator re-derives the chamber graph from the tiles and checks
  that End is reachable from every chamber reachable from Start.
- tests/maze_check.gd: headless batch check (360 mazes) plus a known
  soft-lock the validator must reject. See docs/MAZE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:45:46 -06:00

35 lines
1.6 KiB
GDScript

class_name MazeSettings
extends RefCounted
# What the player picked for the next maze (the Maze setup panel sets these,
# MazeLevel reads them), and what each complexity level means. See docs/MAZE.md.
const MIN_WIDTH = 1
const MAX_WIDTH = 4
const MIN_HEIGHT = 1
const MAX_HEIGHT = 3
const MIN_COMPLEXITY = 1
const MAX_COMPLEXITY = 5
# Per complexity level (index 0 is level 1):
# chambersPerScreen: how the chambers split each screen (columns, rows).
# oneWayOnRoute: how many tubes on the Start-End route are one-way.
# extraTubesPerScreen: tubes added on top of the spanning tree (loops and traps).
# steeredShare: the share of two-way tubes that are manual or goo, not auto.
# winding: how much tubes wander on their way (0 = shortest path).
const LEVELS: Array[Dictionary] = [
{chambersPerScreen = Vector2i(2, 1), oneWayOnRoute = 0, extraTubesPerScreen = 0.0, steeredShare = 0.0, winding = 0.5},
{chambersPerScreen = Vector2i(2, 2), oneWayOnRoute = 1, extraTubesPerScreen = 0.5, steeredShare = 0.2, winding = 1.0},
{chambersPerScreen = Vector2i(2, 2), oneWayOnRoute = 2, extraTubesPerScreen = 1.0, steeredShare = 0.3, winding = 2.0},
{chambersPerScreen = Vector2i(3, 2), oneWayOnRoute = 3, extraTubesPerScreen = 1.5, steeredShare = 0.35, winding = 3.0},
{chambersPerScreen = Vector2i(3, 2), oneWayOnRoute = 4, extraTubesPerScreen = 2.0, steeredShare = 0.4, winding = 4.0},
]
static var width := 2 # In screens.
static var height := 1
static var complexity := 2
static var mazeSeed := 0 # 0: pick a new random one when the maze is made.
static func get_level(level: int) -> Dictionary:
return LEVELS[clampi(level, MIN_COMPLEXITY, MAX_COMPLEXITY) - MIN_COMPLEXITY]