Remove goo tubes; steered maze tubes are always manual

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>
This commit is contained in:
SnekInAScarf 2026-11-16 15:04:09 -08:00
parent 43bf9c6d18
commit 58bd9fc1cd
12 changed files with 58 additions and 652 deletions

View file

@ -18,32 +18,26 @@ texture_region_size = Vector2i(32, 32)
1:0/1/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -16, -3)
1:0/1/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, 16, 3, 16, 16, -16, 16)
1:0/1/custom_data_0 = 10
1:0/2 = 2
1:0/2/modulate = Color(1, 0.7, 0.95, 1)
1:0/2/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -16, -3)
1:0/2/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, 16, 3, 16, 16, -16, 16)
1:0/2/custom_data_0 = 10
1:0/2/custom_data_2 = true
1:0/3 = 3
1:0/3/modulate = Color(1.7, 0.95, 0.3, 1)
1:0/3/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -16, -3)
1:0/3/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, 16, 3, 16, 16, -16, 16)
1:0/3/custom_data_0 = 10
1:0/3/custom_data_3 = true
1:0/3/custom_data_2 = true
1:0/4 = 4
1:0/4/modulate = Color(1.7, 0.95, 0.3, 1)
1:0/4/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -16, -3)
1:0/4/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, 16, 3, 16, 16, -16, 16)
1:0/4/custom_data_0 = 10
1:0/4/custom_data_3 = true
1:0/4/custom_data_4 = 2
1:0/4/custom_data_2 = true
1:0/4/custom_data_3 = 2
1:0/5 = 5
1:0/5/modulate = Color(1.7, 0.95, 0.3, 1)
1:0/5/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -16, -3)
1:0/5/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, 16, 3, 16, 16, -16, 16)
1:0/5/custom_data_0 = 10
1:0/5/custom_data_3 = true
1:0/5/custom_data_4 = 8
1:0/5/custom_data_2 = true
1:0/5/custom_data_3 = 8
2:0/next_alternative_id = 6
2:0/0 = 0
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 16, -16, 16)
@ -55,32 +49,26 @@ texture_region_size = Vector2i(32, 32)
2:0/1/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 16, -16, 16)
2:0/1/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, 16, 3, 16)
2:0/1/custom_data_0 = 5
2:0/2 = 2
2:0/2/modulate = Color(1, 0.7, 0.95, 1)
2:0/2/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 16, -16, 16)
2:0/2/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, 16, 3, 16)
2:0/2/custom_data_0 = 5
2:0/2/custom_data_2 = true
2:0/3 = 3
2:0/3/modulate = Color(1.7, 0.95, 0.3, 1)
2:0/3/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 16, -16, 16)
2:0/3/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, 16, 3, 16)
2:0/3/custom_data_0 = 5
2:0/3/custom_data_3 = true
2:0/3/custom_data_2 = true
2:0/4 = 4
2:0/4/modulate = Color(1.7, 0.95, 0.3, 1)
2:0/4/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 16, -16, 16)
2:0/4/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, 16, 3, 16)
2:0/4/custom_data_0 = 5
2:0/4/custom_data_3 = true
2:0/4/custom_data_4 = 1
2:0/4/custom_data_2 = true
2:0/4/custom_data_3 = 1
2:0/5 = 5
2:0/5/modulate = Color(1.7, 0.95, 0.3, 1)
2:0/5/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 16, -16, 16)
2:0/5/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, 16, 3, 16)
2:0/5/custom_data_0 = 5
2:0/5/custom_data_3 = true
2:0/5/custom_data_4 = 4
2:0/5/custom_data_2 = true
2:0/5/custom_data_3 = 4
3:0/next_alternative_id = 4
3:0/0 = 0
3:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
@ -96,14 +84,6 @@ texture_region_size = Vector2i(32, 32)
3:0/1/physics_layer_0/polygon_2/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
3:0/1/physics_layer_0/polygon_3/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
3:0/1/custom_data_0 = 15
3:0/2 = 2
3:0/2/modulate = Color(1, 0.7, 0.95, 1)
3:0/2/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
3:0/2/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, -3, 3, -3)
3:0/2/physics_layer_0/polygon_2/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
3:0/2/physics_layer_0/polygon_3/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
3:0/2/custom_data_0 = 15
3:0/2/custom_data_2 = true
3:0/3 = 3
3:0/3/modulate = Color(1.7, 0.95, 0.3, 1)
3:0/3/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
@ -111,7 +91,7 @@ texture_region_size = Vector2i(32, 32)
3:0/3/physics_layer_0/polygon_2/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
3:0/3/physics_layer_0/polygon_3/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
3:0/3/custom_data_0 = 15
3:0/3/custom_data_3 = true
3:0/3/custom_data_2 = true
4:0/next_alternative_id = 6
4:0/0 = 0
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 3, 16, 3, 16, 16, -16, 16)
@ -123,32 +103,26 @@ texture_region_size = Vector2i(32, 32)
4:0/1/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 3, 16, 3, 16, 16, -16, 16)
4:0/1/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, -3, 3, -3)
4:0/1/custom_data_0 = 3
4:0/2 = 2
4:0/2/modulate = Color(1, 0.7, 0.95, 1)
4:0/2/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 3, 16, 3, 16, 16, -16, 16)
4:0/2/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, -3, 3, -3)
4:0/2/custom_data_0 = 3
4:0/2/custom_data_2 = true
4:0/3 = 3
4:0/3/modulate = Color(1.7, 0.95, 0.3, 1)
4:0/3/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 3, 16, 3, 16, 16, -16, 16)
4:0/3/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, -3, 3, -3)
4:0/3/custom_data_0 = 3
4:0/3/custom_data_3 = true
4:0/3/custom_data_2 = true
4:0/4 = 4
4:0/4/modulate = Color(1.7, 0.95, 0.3, 1)
4:0/4/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 3, 16, 3, 16, 16, -16, 16)
4:0/4/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, -3, 3, -3)
4:0/4/custom_data_0 = 3
4:0/4/custom_data_3 = true
4:0/4/custom_data_4 = 1
4:0/4/custom_data_2 = true
4:0/4/custom_data_3 = 1
4:0/5 = 5
4:0/5/modulate = Color(1.7, 0.95, 0.3, 1)
4:0/5/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, -3, -16, -3, 3, 16, 3, 16, 16, -16, 16)
4:0/5/physics_layer_0/polygon_1/points = PackedVector2Array(3, -16, 16, -16, 16, -3, 3, -3)
4:0/5/custom_data_0 = 3
4:0/5/custom_data_3 = true
4:0/5/custom_data_4 = 2
4:0/5/custom_data_2 = true
4:0/5/custom_data_3 = 2
5:0/next_alternative_id = 6
5:0/0 = 0
5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(3, -16, 16, -16, 16, 16, -16, 16, -16, 3, 3, 3)
@ -160,32 +134,26 @@ texture_region_size = Vector2i(32, 32)
5:0/1/physics_layer_0/polygon_0/points = PackedVector2Array(3, -16, 16, -16, 16, 16, -16, 16, -16, 3, 3, 3)
5:0/1/physics_layer_0/polygon_1/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
5:0/1/custom_data_0 = 9
5:0/2 = 2
5:0/2/modulate = Color(1, 0.7, 0.95, 1)
5:0/2/physics_layer_0/polygon_0/points = PackedVector2Array(3, -16, 16, -16, 16, 16, -16, 16, -16, 3, 3, 3)
5:0/2/physics_layer_0/polygon_1/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
5:0/2/custom_data_0 = 9
5:0/2/custom_data_2 = true
5:0/3 = 3
5:0/3/modulate = Color(1.7, 0.95, 0.3, 1)
5:0/3/physics_layer_0/polygon_0/points = PackedVector2Array(3, -16, 16, -16, 16, 16, -16, 16, -16, 3, 3, 3)
5:0/3/physics_layer_0/polygon_1/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
5:0/3/custom_data_0 = 9
5:0/3/custom_data_3 = true
5:0/3/custom_data_2 = true
5:0/4 = 4
5:0/4/modulate = Color(1.7, 0.95, 0.3, 1)
5:0/4/physics_layer_0/polygon_0/points = PackedVector2Array(3, -16, 16, -16, 16, 16, -16, 16, -16, 3, 3, 3)
5:0/4/physics_layer_0/polygon_1/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
5:0/4/custom_data_0 = 9
5:0/4/custom_data_3 = true
5:0/4/custom_data_4 = 1
5:0/4/custom_data_2 = true
5:0/4/custom_data_3 = 1
5:0/5 = 5
5:0/5/modulate = Color(1.7, 0.95, 0.3, 1)
5:0/5/physics_layer_0/polygon_0/points = PackedVector2Array(3, -16, 16, -16, 16, 16, -16, 16, -16, 3, 3, 3)
5:0/5/physics_layer_0/polygon_1/points = PackedVector2Array(-16, -16, -3, -16, -3, -3, -16, -3)
5:0/5/custom_data_0 = 9
5:0/5/custom_data_3 = true
5:0/5/custom_data_4 = 8
5:0/5/custom_data_2 = true
5:0/5/custom_data_3 = 8
0:1/next_alternative_id = 6
0:1/0 = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 3, 16, 3, -3, -16, -3)
@ -197,32 +165,26 @@ texture_region_size = Vector2i(32, 32)
0:1/1/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 3, 16, 3, -3, -16, -3)
0:1/1/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
0:1/1/custom_data_0 = 12
0:1/2 = 2
0:1/2/modulate = Color(1, 0.7, 0.95, 1)
0:1/2/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 3, 16, 3, -3, -16, -3)
0:1/2/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
0:1/2/custom_data_0 = 12
0:1/2/custom_data_2 = true
0:1/3 = 3
0:1/3/modulate = Color(1.7, 0.95, 0.3, 1)
0:1/3/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 3, 16, 3, -3, -16, -3)
0:1/3/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
0:1/3/custom_data_0 = 12
0:1/3/custom_data_3 = true
0:1/3/custom_data_2 = true
0:1/4 = 4
0:1/4/modulate = Color(1.7, 0.95, 0.3, 1)
0:1/4/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 3, 16, 3, -3, -16, -3)
0:1/4/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
0:1/4/custom_data_0 = 12
0:1/4/custom_data_3 = true
0:1/4/custom_data_4 = 4
0:1/4/custom_data_2 = true
0:1/4/custom_data_3 = 4
0:1/5 = 5
0:1/5/modulate = Color(1.7, 0.95, 0.3, 1)
0:1/5/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, 3, 16, 3, -3, -16, -3)
0:1/5/physics_layer_0/polygon_1/points = PackedVector2Array(-16, 3, -3, 3, -3, 16, -16, 16)
0:1/5/custom_data_0 = 12
0:1/5/custom_data_3 = true
0:1/5/custom_data_4 = 8
0:1/5/custom_data_2 = true
0:1/5/custom_data_3 = 8
1:1/next_alternative_id = 6
1:1/0 = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -3, -3, -3, 16, -16, 16)
@ -234,32 +196,26 @@ texture_region_size = Vector2i(32, 32)
1:1/1/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -3, -3, -3, 16, -16, 16)
1:1/1/physics_layer_0/polygon_1/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
1:1/1/custom_data_0 = 6
1:1/2 = 2
1:1/2/modulate = Color(1, 0.7, 0.95, 1)
1:1/2/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -3, -3, -3, 16, -16, 16)
1:1/2/physics_layer_0/polygon_1/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
1:1/2/custom_data_0 = 6
1:1/2/custom_data_2 = true
1:1/3 = 3
1:1/3/modulate = Color(1.7, 0.95, 0.3, 1)
1:1/3/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -3, -3, -3, 16, -16, 16)
1:1/3/physics_layer_0/polygon_1/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
1:1/3/custom_data_0 = 6
1:1/3/custom_data_3 = true
1:1/3/custom_data_2 = true
1:1/4 = 4
1:1/4/modulate = Color(1.7, 0.95, 0.3, 1)
1:1/4/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -3, -3, -3, 16, -16, 16)
1:1/4/physics_layer_0/polygon_1/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
1:1/4/custom_data_0 = 6
1:1/4/custom_data_3 = true
1:1/4/custom_data_4 = 2
1:1/4/custom_data_2 = true
1:1/4/custom_data_3 = 2
1:1/5 = 5
1:1/5/modulate = Color(1.7, 0.95, 0.3, 1)
1:1/5/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -3, -3, -3, -3, 16, -16, 16)
1:1/5/physics_layer_0/polygon_1/points = PackedVector2Array(3, 3, 16, 3, 16, 16, 3, 16)
1:1/5/custom_data_0 = 6
1:1/5/custom_data_3 = true
1:1/5/custom_data_4 = 4
1:1/5/custom_data_2 = true
1:1/5/custom_data_3 = 4
[resource]
tile_size = Vector2i(32, 32)
@ -268,10 +224,8 @@ custom_data_layer_0/name = "tube_openings"
custom_data_layer_0/type = 2
custom_data_layer_1/name = "tube_manual"
custom_data_layer_1/type = 1
custom_data_layer_2/name = "tube_goo"
custom_data_layer_2/name = "tube_one_way"
custom_data_layer_2/type = 1
custom_data_layer_3/name = "tube_one_way"
custom_data_layer_3/type = 1
custom_data_layer_4/name = "tube_one_way_entry"
custom_data_layer_4/type = 2
custom_data_layer_3/name = "tube_one_way_entry"
custom_data_layer_3/type = 2
sources/0 = SubResource("TileSetAtlasSource_0cw2b")

View file

@ -48,8 +48,7 @@ const LAND_PITCH_MAX = 1.15
# open (the "tube_openings" custom data). Holding into a tube's mouth squeezes us
# in as pixels. An ordinary tube streams us through to the other end
# (PixelStream). A manual one ("tube_manual" tiles) lets the player steer us
# through it, round corners and either way at crossings (TubeSteer). A goo one
# ("tube_goo" tiles) is the same, but the goo has no head or tail (TubeGoo).
# through it, round corners and either way at crossings (TubeSteer).
# A one-way one ("tube_one_way" tiles) is an ordinary tube we can only go into
# at its entrance, and whose air pulls us in there and blows us away from its
# exit (OneWayTube, TubeAirCurrents).
@ -139,9 +138,8 @@ var tubeSqueezeDirection := Vector2.ZERO # Which way into that mouth.
var isInTube := false
var tubePixels: PixelStream # Our pixels streaming through an ordinary tube, or null.
# Our pixels being steered through a manual tube (a TubeSteer) or a goo tube (a
# TubeGoo), or null. Both have start(), steer(), isFinished and exitPose.
var tubeSteer: Variant = null
# Our pixels being steered through a manual tube, or null.
var tubeSteer: TubeSteer = null
var tubeExitPose := {} # Where the stream comes out (see _tube_exit_pose).
var tubeReentryCooldown := 0.0
var timeSpentSqueezingIntoTube := 0.0
@ -1058,7 +1056,7 @@ func _find_tube_towards(direction: Vector2, extraReach := 0.0) -> Dictionary:
if absf(toMouth.dot(across)) > radius or toMouth.dot(direction) > reach:
continue
var tube := {layer = layer, cell = cell, direction = direction}
if TubeSteer.is_manual(layer, cell) or TubeGoo.is_goo(layer, cell):
if TubeSteer.is_manual(layer, cell):
return tube
var path := PixelStream.trace_tube(layer, cell, Vector2i(direction))
if not path.is_empty() and not _tube_exit_pose_for(path).is_empty():
@ -1119,13 +1117,10 @@ func _enter_tube(tube: Dictionary) -> void:
if not wallPose.is_empty():
wallPose.startTransform = spriteTransform # The goo still starts as we look now.
entryPose = wallPose
if TubeGoo.is_goo(tube.layer, tube.cell):
tubeSteer = TubeGoo.new()
else:
tubeSteer = TubeSteer.new()
tubeSteer.indicatorColor = tubeIndicatorColor
tubeSteer.indicatorBorderColor = tubeIndicatorBorderColor
tubeSteer.indicatorRadius = tubeIndicatorRadius
tubeSteer = TubeSteer.new()
tubeSteer.indicatorColor = tubeIndicatorColor
tubeSteer.indicatorBorderColor = tubeIndicatorBorderColor
tubeSteer.indicatorRadius = tubeIndicatorRadius
get_parent().add_child(tubeSteer)
tubeSteer.start(sprite, tube.layer, tube.cell, Vector2i(tube.direction), TUBE_WIDTH, TUBE_MAX_FLOW_LENGTH,
entryPose, _tube_exit_pose, REST_FRAME)

View file

@ -15,7 +15,7 @@ extends Node2D
# in the sprite. Pixels flying between the two don't get one: it would speckle
# them all in black.
# Where the slime's pixels draw while in a tube (this and TubeSteer and TubeGoo):
# Where the slime's pixels draw while in a tube (this and TubeSteer):
# behind the tiles (z 0), which only show them through the tube's see-through
# channel. Goo going in or out of a mouth is hidden where it overlaps the tile.
# A background must go lower than this, or on its own CanvasLayer.

View file

@ -1,534 +0,0 @@
class_name TubeGoo
extends Node2D
# The slime squeezed into a goo tube as a shapeless amount of goo, with no head
# or tail. The goo fills a connected patch of the tubes (a line, or a T or plus
# shape where it spans a crossing), and moves by growing at one spot while
# shrinking by the same amount at all its other tips at once.
#
# Steering: pressing a direction grows the goo at the growth point nearest the
# one it last grew at (the "active" point) that can grow that way. A growth
# point is any tip, or any spot the goo covers with an empty branch beside it.
# So in a straight tube pressing back grows the far tip (reversing), and with
# the goo spanning a crossing, pressing into a side branch sprouts the middle
# into it while both ends drain towards it.
# Tips also look ahead along straight tube, so pressing towards a turn before
# reaching it carries the tip there.
# Every growth point pulses faintly. The one the input is using pulses brighter.
#
# Past each mouth with room for the slime is a straight "outside line". Goo out
# there gathers into the slime's shape. Once all of it is out far enough, it
# reforms: isFinished goes true and exitPose says where. The goo starts out on
# the entry mouth's line, in the shape of the sprite that went in, so backing
# all the way out reforms us where we went in.
#
# The track is made of vertices one pixel apart, and the goo moves a vertex at a
# time. Each vertex holds one row of pixels across the tube. If the goo would
# be longer than maxLength, the rows hold more pixels (overlapping) instead.
const SPEED = 150.0 # How fast the goo grows while pressed, in px/s.
const GATHER_DISTANCE = 24 # How far past a mouth goo goes before it's in its place in the slime.
# How much of the input must point along a way for the goo to grow along it
# (0.5 lets diagonals pick either way).
const MIN_PULL = 0.5
const LOOKAHEAD = 48 # How far along straight tube a tip looks for a turn the input points along.
const MAX_TILES = 1024 # Stop mapping a tube network this big.
const MAX_STEPS_PER_FRAME = 8
const PULSE_SPEED = 7.0 # Radians per second.
const PULSE_ALPHA = 0.5 # How strongly growth points pulse.
const ACTIVE_PULSE_ALPHA = 0.9 # How strongly the one being grown pulses.
const PULSE_LENGTH = 3 # How many vertices into a branch the pulse shows.
const SHOW_ACTIVE = false # Outline the active point, for debugging.
const NO_GROWTH = Vector2i(-1, -1)
const DIRECTIONS: Array[Vector2i] = [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT]
var isFinished := false
var exitPose := {} # The pose we came out as (see start()).
# The track's vertices.
var _positions := PackedVector2Array()
var _neighbors: Array[Array] = [] # Per vertex: the vertices next to it.
var _lines := PackedInt32Array() # Per vertex: the outside line it's on, or -1 in the tubes.
var _depths := PackedInt32Array() # Per vertex on an outside line: how far out it is (1 = just past the mouth).
# The outside lines.
var _lineMouths := PackedVector2Array()
var _lineOutwards := PackedVector2Array()
var _lineStarts := PackedInt32Array() # The vertex at depth 1.
var _linePoses: Array[Dictionary] = [] # The pose we come out as there.
var _lineShapes: Array[Dictionary] = [] # That pose's pixels nearest the mouth first, worked out when needed.
var _lineLength := 0
var _entryLine := -1
# The goo.
var _rowAt := PackedInt32Array() # Per vertex: the row of pixels there, or -1 if empty.
var _shrunkAt := PackedInt32Array() # Per vertex: when the goo last shrank back to it.
var _clock := 0
var _active := -1
var _growth := 0.0 # Growth we're owed but haven't done, in vertices.
var _cue := NO_GROWTH # (vertex, empty vertex it grew into) for the brighter pulse.
var _time := 0.0
# The pixels: row r holds pixels r * _pixelsPerRow up to the next row's, going
# across its _laneCount lanes and round again.
var _rowCount := 0
var _laneCount := 1
var _pixelsPerRow := 1
var _colors := PackedColorArray()
var _spots := PackedVector2Array() # Where each pixel goes in the shape it's gathering into outside.
var _spotColors := PackedColorArray()
var _rowLines := PackedInt32Array() # Per row: the outside line its spots are for, or -1.
var _endFrame := {} # The frame we reform as, in the sprite's space.
# Squeezes into the tube at `entryCell` heading `entryDirection`.
# Poses are {spriteTransform: Transform2D, ...plus whatever the caller wants
# back in exitPose}. entryPose is the slime as it is now (or, if it has a
# .startTransform, that's the slime as it is now and the rest is where backing out puts us). findPose(mouth:
# Vector2, outward: Vector2) gives the pose for coming out of a mouth, or {} if
# there's no room. endFrame: the frame we reform as. maxLength: the longest the
# goo can be.
func start(sprite: Sprite2D, layer: TileMapLayer, entryCell: Vector2i, entryDirection: Vector2i,
width: float, maxLength: float, entryPose: Dictionary, findPose: Callable, endFrame: int) -> void:
top_level = true
global_position = Vector2.ZERO
z_index = PixelStream.GOO_Z_INDEX
_laneCount = maxi(int(width), 1)
var from := PixelStream.get_frame_pixels(sprite, sprite.frame, entryPose.get("startTransform", entryPose.spriteTransform))
_endFrame = PixelStream.get_frame_pixels(sprite, endFrame, Transform2D.IDENTITY)
if from.colors.is_empty() or _endFrame.colors.is_empty():
exitPose = entryPose
isFinished = true
return
# If the frame we reform as has more pixels, or the last row isn't full,
# some are doubled up so none go missing.
var pixelCount := maxi(from.colors.size(), _endFrame.colors.size())
_rowCount = mini(ceili(float(pixelCount) / _laneCount), maxi(int(maxLength), 1))
_pixelsPerRow = ceili(float(pixelCount) / _rowCount)
_lineLength = _rowCount + GATHER_DISTANCE
_build_track(layer, entryCell, entryDirection, entryPose, findPose)
if _entryLine == -1:
exitPose = entryPose
isFinished = true
return
# The goo starts out on the entry mouth's line, far enough out that every
# pixel is still in its place in the sprite. The pixels nearest the mouth
# are in the rows nearest it, so they go in first.
var count := _rowCount * _pixelsPerRow
var order := _sorted_by_distance(from.positions, _lineMouths[_entryLine])
for i in count:
var k: int = order[int(float(i) * order.size() / count)]
_colors.append(from.colors[k])
_spots.append(from.positions[k])
_spotColors.append(from.colors[k])
_rowLines.resize(_rowCount)
_rowLines.fill(_entryLine)
for row in _rowCount:
_rowAt[_line_vertex(_entryLine, GATHER_DISTANCE + row)] = row
_active = _line_vertex(_entryLine, GATHER_DISTANCE)
# Moves the goo for one physics frame. input: the player's input, with y down.
func steer(input: Vector2, delta: float) -> void:
if isFinished:
return
_cue = NO_GROWTH
if input == Vector2.ZERO:
_growth = 0.0
return
input = input.normalized()
_growth += SPEED * delta
for i in MAX_STEPS_PER_FRAME:
if _growth < 1.0:
break
var growth := _choose_growth(input)
if growth == NO_GROWTH:
_growth = 0.0 # Nowhere to grow the way the input points.
break
_cue = growth
_grow(growth.x, growth.y)
_growth -= 1.0
if _check_all_out():
return
# Where the goo last grew, in global coordinates (for the camera). The goo has
# no head, so this is the end the player is pushing.
func get_focus() -> Vector2:
if _active == -1:
return global_position
return _positions[_active]
func _process(delta: float) -> void:
_time += delta
queue_redraw()
# ---- Setup ----
# Maps out the goo tube network from `entryCell` as vertices a pixel apart,
# plus an outside line past each mouth we can come out of.
func _build_track(layer: TileMapLayer, entryCell: Vector2i, entryDirection: Vector2i,
entryPose: Dictionary, findPose: Callable) -> void:
var cellVertices := {entryCell: _add_vertex(TubeSteer.cell_point(layer, entryCell, Vector2i.ZERO))}
var toVisit: Array[Vector2i] = [entryCell]
while not toVisit.is_empty() and cellVertices.size() < MAX_TILES:
var cell: Vector2i = toVisit.pop_front()
var openings := TubeSteer.get_openings(layer, cell)
for direction in DIRECTIONS:
if openings & TubeSteer.side_bit(direction) == 0:
continue
var nextCell := cell + direction
if is_goo(layer, nextCell) and TubeSteer.get_openings(layer, nextCell) & TubeSteer.side_bit(-direction):
if not cellVertices.has(nextCell):
cellVertices[nextCell] = _add_vertex(TubeSteer.cell_point(layer, nextCell, Vector2i.ZERO))
toVisit.append(nextCell)
# Each pair of tiles is joined once, from its left or top tile.
if direction == Vector2i.RIGHT or direction == Vector2i.DOWN:
_join(cellVertices[cell], cellVertices[nextCell])
elif layer.get_cell_source_id(nextCell) == -1:
# A mouth into open space.
var mouthPosition := TubeSteer.cell_point(layer, cell, direction)
var mouth := _add_vertex(mouthPosition)
_join(cellVertices[cell], mouth)
var isEntry := cell == entryCell and direction == -entryDirection
var pose: Dictionary = entryPose if isEntry else findPose.call(mouthPosition, Vector2(direction))
if pose.is_empty():
continue # No room out there: a dead end.
if isEntry:
_entryLine = _lineMouths.size()
_add_outside_line(mouth, Vector2(direction), pose)
# Otherwise it opens into something solid: a dead end.
func _add_vertex(at: Vector2, line := -1, depth := 0) -> int:
_positions.append(at)
_neighbors.append([])
_lines.append(line)
_depths.append(depth)
_rowAt.append(-1)
_shrunkAt.append(0)
return _positions.size() - 1
func _connect(a: int, b: int) -> void:
_neighbors[a].append(b)
_neighbors[b].append(a)
# Joins two vertices with a straight run of vertices a pixel apart.
func _join(a: int, b: int) -> void:
var from := _positions[a]
var to := _positions[b]
var steps := maxi(roundi(from.distance_to(to)), 1)
var previous := a
for step in range(1, steps):
var vertex := _add_vertex(from.lerp(to, float(step) / steps))
_connect(previous, vertex)
previous = vertex
_connect(previous, b)
func _add_outside_line(mouth: int, outward: Vector2, pose: Dictionary) -> void:
var line := _lineMouths.size()
_lineMouths.append(_positions[mouth])
_lineOutwards.append(outward)
_linePoses.append(pose)
_lineShapes.append({})
_lineStarts.append(_positions.size())
var previous := mouth
for depth in range(1, _lineLength + 1):
var vertex := _add_vertex(_positions[mouth] + outward * depth, line, depth)
_connect(previous, vertex)
previous = vertex
func _line_vertex(line: int, depth: int) -> int:
return _lineStarts[line] + depth - 1
# ---- Growing ----
# Where to grow for the input: (a goo vertex, the empty vertex beside it to grow
# into), nearest the active point. NO_GROWTH if there's nowhere.
func _choose_growth(input: Vector2) -> Vector2i:
var distances := _goo_distances_from(_active)
var best := NO_GROWTH
var bestDistance := 0
var bestPull := 0.0
for vertex in _rowAt.size():
if _rowAt[vertex] == -1:
continue
for next: int in _neighbors[vertex]:
if not _can_grow_into(vertex, next):
continue
var pull := input.dot(_direction(vertex, next))
if pull < MIN_PULL and _is_tip(vertex):
pull = _lookahead_pull(vertex, next, input)
if pull < MIN_PULL:
continue
var distance := distances[vertex]
if best == NO_GROWTH or distance < bestDistance or (distance == bestDistance and pull > bestPull):
best = Vector2i(vertex, next)
bestDistance = distance
bestPull = pull
return best
# Whether the goo at `vertex` can grow into `next`: it's empty, and growing
# there wouldn't join up with goo somewhere else (round a loop).
func _can_grow_into(vertex: int, next: int) -> bool:
if _rowAt[next] != -1:
return false
for other: int in _neighbors[next]:
if other != vertex and _rowAt[other] != -1:
return false
return true
# From a tip growing into `next`, how well the input points along a way on from
# the turn or junction at the end of the straight run ahead.
func _lookahead_pull(tip: int, next: int, input: Vector2) -> float:
var previous := tip
var current := next
for i in LOOKAHEAD:
var ways := _neighbors[current].filter(func(other: int) -> bool: return other != previous)
var isStraightOn := ways.size() == 1 and _direction(current, ways[0]).is_equal_approx(_direction(previous, current))
if isStraightOn and _rowAt[ways[0]] == -1:
previous = current
current = ways[0]
continue
var best := -INF
for way: int in ways:
if _rowAt[way] == -1:
best = maxf(best, input.dot(_direction(current, way)))
return best
return -INF
# Grows the goo from `vertex` into `next`, and shrinks it at the tip that's gone
# longest without shrinking. Taking turns like this drains all the tips at once.
# The goo between that tip and `next` flows along a vertex.
func _grow(vertex: int, next: int) -> void:
_rowAt[next] = -2 # Goo, but which row is sorted out below.
var tip := _pick_tip_to_shrink(next)
var path := _goo_path(tip, next)
for i in range(path.size() - 1, 0, -1):
_rowAt[path[i]] = _rowAt[path[i - 1]]
_rowAt[tip] = -1
_clock += 1
_shrunkAt[path[1]] = _clock
_active = next
for i in range(1, path.size()):
_update_row_line(_rowAt[path[i]], path[i])
func _pick_tip_to_shrink(exclude: int) -> int:
var best := -1
for vertex in _rowAt.size():
if _rowAt[vertex] == -1 or vertex == exclude or not _is_tip(vertex):
continue
if best == -1 or _shrunkAt[vertex] < _shrunkAt[best]:
best = vertex
return best
func _is_tip(vertex: int) -> bool:
var gooNeighbors := 0
for other: int in _neighbors[vertex]:
if _rowAt[other] != -1:
gooNeighbors += 1
return gooNeighbors <= 1
# How far each vertex is from `from` through the goo (-1 if it isn't goo).
func _goo_distances_from(from: int) -> PackedInt32Array:
var distances := PackedInt32Array()
distances.resize(_rowAt.size())
distances.fill(-1)
distances[from] = 0
var queue: Array[int] = [from]
while not queue.is_empty():
var vertex: int = queue.pop_front()
for other: int in _neighbors[vertex]:
if _rowAt[other] != -1 and distances[other] == -1:
distances[other] = distances[vertex] + 1
queue.append(other)
return distances
# The vertices from `from` to `to` through the goo.
func _goo_path(from: int, to: int) -> PackedInt32Array:
var cameFrom := {to: -1}
var queue: Array[int] = [to]
while not queue.is_empty() and not cameFrom.has(from):
var vertex: int = queue.pop_front()
for other: int in _neighbors[vertex]:
if _rowAt[other] != -1 and not cameFrom.has(other):
cameFrom[other] = vertex
queue.append(other)
var path := PackedInt32Array()
var vertex := from
while vertex != -1:
path.append(vertex)
vertex = cameFrom[vertex]
return path
# When a row moves onto an outside line, picks the spots its pixels gather
# into there. The first rows out take the spots furthest from the mouth.
func _update_row_line(row: int, vertex: int) -> void:
var line := _lines[vertex]
if line == _rowLines[row]:
return
_rowLines[row] = line
if line == -1:
return
var alreadyOut := 0
for depth in range(1, _lineLength + 1):
var other := _rowAt[_line_vertex(line, depth)]
if other >= 0 and other != row:
alreadyOut += 1
var group := _rowCount - 1 - alreadyOut
var shape := _get_line_shape(line)
var pointCount: int = shape.positions.size()
for slot in _pixelsPerRow:
var i := row * _pixelsPerRow + slot
var k := int(float(group * _pixelsPerRow + slot) * pointCount / (_rowCount * _pixelsPerRow))
_spots[i] = shape.positions[k]
_spotColors[i] = shape.colors[k]
# The pixels of the frame we reform as, placed as the line's pose, nearest the
# mouth first.
func _get_line_shape(line: int) -> Dictionary:
if not _lineShapes[line].is_empty():
return _lineShapes[line]
var spriteTransform: Transform2D = _linePoses[line].spriteTransform
var placed := PackedVector2Array()
for local: Vector2 in _endFrame.positions:
placed.append(spriteTransform * local)
var positions := PackedVector2Array()
var colors := PackedColorArray()
for k: int in _sorted_by_distance(placed, _lineMouths[line]):
positions.append(placed[k])
colors.append(_endFrame.colors[k])
_lineShapes[line] = {positions = positions, colors = colors}
return _lineShapes[line]
# Finishes if all the goo is out on one line, far enough to be back in shape.
func _check_all_out() -> bool:
var line := _lines[_active]
if line == -1:
return false
var outCount := 0
for depth in range(GATHER_DISTANCE, _lineLength + 1):
if _rowAt[_line_vertex(line, depth)] != -1:
outCount += 1
if outCount < _rowCount:
return false
exitPose = _linePoses[line]
isFinished = true
return true
func _direction(from: int, to: int) -> Vector2:
return (_positions[to] - _positions[from]).normalized()
# Indices of `points`, nearest to `target` first.
static func _sorted_by_distance(points: PackedVector2Array, target: Vector2) -> Array:
var order := range(points.size())
order.sort_custom(func(a: int, b: int) -> bool:
return points[a].distance_squared_to(target) < points[b].distance_squared_to(target))
return order
# ---- Drawing ----
func _draw() -> void:
if _colors.is_empty():
return
for vertex in _rowAt.size():
var row := _rowAt[vertex]
if row < 0:
continue
var line := _lines[vertex]
var across := _across(vertex)
for slot in _pixelsPerRow:
var i := row * _pixelsPerRow + slot
var laneOffset := across * (slot % _laneCount - (_laneCount - 1) / 2.0)
var spot := _positions[vertex] + laneOffset
var color := _colors[i]
if line != -1:
# Out past a mouth: gathering into its place in the slime.
var gathered := clampf(float(_depths[vertex]) / GATHER_DISTANCE, 0.0, 1.0)
spot = (_lineMouths[line] + laneOffset).lerp(_spots[i], gathered)
color = color.lerp(_spotColors[i], gathered)
draw_rect(Rect2(spot.floor(), Vector2.ONE), color)
_draw_growth_cues()
if SHOW_ACTIVE and _active != -1:
draw_rect(Rect2(_positions[_active].floor() - Vector2.ONE, Vector2.ONE * 3), Color.RED, false)
# A faint pulse just into each empty branch the goo could grow into, brighter
# for the one it's growing into now.
func _draw_growth_cues() -> void:
var pulse := 0.5 + 0.5 * sin(_time * PULSE_SPEED)
for vertex in _rowAt.size():
if _rowAt[vertex] == -1 or _lines[vertex] != -1:
continue
for next: int in _neighbors[vertex]:
if not _can_grow_into(vertex, next):
continue
var isActive := _cue == Vector2i(vertex, next)
var color := Color(1, 1, 1, (ACTIVE_PULSE_ALPHA if isActive else PULSE_ALPHA) * pulse)
var direction := _direction(vertex, next)
var across := _across_for(direction)
# Start past the goo's edge: at a junction, the goo crossing it
# spreads half a tube's width into the branch.
var firstStep := _laneCount / 2 + 1
for step in range(firstStep, firstStep + PULSE_LENGTH):
for lane in _laneCount:
var spot := _positions[vertex] + direction * step + across * (lane - (_laneCount - 1) / 2.0)
draw_rect(Rect2(spot.floor(), Vector2.ONE), color)
# Which way a row's lanes spread at `vertex`: across the tube there.
func _across(vertex: int) -> Vector2:
var line := _lines[vertex]
if line != -1:
return _across_for(_lineOutwards[line])
# Along the tube to goo next to it if there is some (at a bend or junction
# there's more than one way), otherwise to any neighbour.
var along := Vector2.ZERO
for other: int in _neighbors[vertex]:
if along == Vector2.ZERO or _rowAt[other] != -1:
along = _direction(vertex, other)
if _rowAt[other] != -1:
break
return _across_for(along)
# Rows across a tube going `along` always spread the same way (rightwards or
# downwards), so pixels don't swap sides when the goo changes direction.
static func _across_for(along: Vector2) -> Vector2:
return Vector2.DOWN if absf(along.x) > absf(along.y) else Vector2.RIGHT
# ---- Tube tiles ----
# Whether the tile at `cell` is a goo tube (the "tube_goo" custom data).
static func is_goo(layer: TileMapLayer, cell: Vector2i) -> bool:
var data := layer.get_cell_tile_data(cell)
if data == null or not data.has_custom_data("tube_goo"):
return false
return data.get_custom_data("tube_goo")

View file

@ -1 +0,0 @@
uid://bfwddelrq8ydu

View file

@ -25,7 +25,6 @@ extends RefCounted
const AUTO = &"auto"
const MANUAL = &"manual"
const GOO = &"goo"
const ONE_WAY = &"one_way" # Goes from .from to .to only.
const EXTRA_TUBE_REACH = 2 # Extra tubes join regions up to this many grid steps apart (diagonals count as one).
const EXTRA_TUBE_TRIES = 40 # Per extra tube, tries to find a pair of regions not joined yet.
@ -33,7 +32,7 @@ const EXTRA_TUBE_TRIES = 40 # Per extra tube, tries to find a pair of regions no
const GRID_STEPS: Array[Vector2i] = [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT]
var gridSize := Vector2i.ZERO # Regions across and down.
# Per tube: {from: region, to: region, kind: AUTO/MANUAL/GOO/ONE_WAY,
# Per tube: {from: region, to: region, kind: AUTO/MANUAL/ONE_WAY,
# isRequired: true for the tree (the maze breaks without it)}.
var tubes: Array[Dictionary] = []
var start := 0
@ -107,11 +106,9 @@ func _two_way_kind() -> StringName:
return pick_two_way_kind(_random, _level.steeredShare)
# Auto, or (with chance `steeredShare`) manual or goo. MazeCarver uses this too.
# Auto, or (with chance `steeredShare`) manual. MazeCarver uses this too.
static func pick_two_way_kind(random: RandomNumberGenerator, steeredShare: float) -> StringName:
if random.randf() >= steeredShare:
return AUTO
return MANUAL if random.randf() < 0.5 else GOO
return MANUAL if random.randf() < steeredShare else AUTO
func _pick_start_and_end() -> void:

View file

@ -23,7 +23,7 @@ const MAX_COMPLEXITY = 5
# openTubesPerScreen: long rides through open air and rock, within or
# between neighbouring regions.
# wallPipesPerScreen: short tubes through a wall inside a region (shortcuts).
# steeredShare: the share of two-way tubes that are manual or goo, not auto.
# steeredShare: the share of two-way tubes that are manual, not auto.
# winding: how much tubes wander (0 = shortest path).
const LEVELS: Array[Dictionary] = [
{regionsPerScreen = Vector2i(2, 1), corridorWidth = 3, braid = 0.5, hallsPerRegion = 0, oneWayOnRoute = 0,

View file

@ -3,13 +3,12 @@ extends RefCounted
# Finds the tile for a tube of a given shape and kind in a TileSet, by reading
# the tiles' custom data (so nothing here hard-codes atlas positions).
# Kinds are MazeGraph's: AUTO, MANUAL, GOO, ONE_WAY, plus ROCK for solid tiles.
# Kinds are MazeGraph's: AUTO, MANUAL, ONE_WAY, plus ROCK for solid tiles.
const ROCK = &"rock"
# The TileSet custom data layers (see player.gd and the tube scripts).
const OPENINGS_LAYER = "tube_openings"
const MANUAL_LAYER = "tube_manual"
const GOO_LAYER = "tube_goo"
var _sourceId := -1
var _tiles := {} # "openings/kind/entrySide" -> [atlas coords, alternative].
@ -52,8 +51,6 @@ static func _kind_of(data: TileData) -> StringName:
return MazeGraph.ONE_WAY
if data.get_custom_data(MANUAL_LAYER):
return MazeGraph.MANUAL
if data.get_custom_data(GOO_LAYER):
return MazeGraph.GOO
return MazeGraph.AUTO

View file

@ -7,7 +7,7 @@ extends RefCounted
# get round them, and short "wall pipes" through a single wall.
# Tubes may cross another tube of the same kind at a straight tile, making a
# cross tile: auto and one-way tubes go straight through it (two separate
# rides), manual and goo tubes join into one network you steer through.
# rides), manual tubes join into one network you steer through.
# Otherwise tubes never share a tile, and their openings only face their own
# tiles, so they can't join by accident.
#

View file

@ -14,7 +14,7 @@ extends RefCounted
# - cross a 1-tile gap to the opposite side (a hop or a bridge),
# - let go of a ceiling and fall straight down onto a floor,
# - go into a tube mouth in the surface it's on, coming out stuck to the face
# of the mouth it leaves by (any mouth of a manual or goo network).
# of the mouth it leaves by (any mouth of a manual network).
# "Forced" tiles move the slime without asking (it can't stay or cross):
# - the tile in front of a one-way tube's entrance sucks it in,
# - the blow zone in front of a one-way exit blows it to known spots (sideways:
@ -66,7 +66,7 @@ func states_at(cell: Vector2i) -> Array[Vector3i]:
# heading `direction` (none if it can't go in there).
func tube_exits(cell: Vector2i, direction: Vector2i) -> Array[Vector3i]:
var exits: Array[Vector3i] = []
if TubeSteer.is_manual(_layer, cell) or TubeGoo.is_goo(_layer, cell):
if TubeSteer.is_manual(_layer, cell):
for mouth in _network_mouths(cell):
exits.append(_state(mouth.front, mouth.tile - mouth.front))
return exits
@ -209,10 +209,9 @@ func _find_suction_tiles() -> void:
_forced[front] = outcomes
# The mouths of the steered tube network `first` is in (joined the way
# TubeSteer and TubeGoo join tiles: same kind, both open): [{tile, front}].
# The mouths of the manual tube network `first` is in (joined the way
# TubeSteer joins tiles: both manual, both open): [{tile, front}].
func _network_mouths(first: Vector2i) -> Array[Dictionary]:
var isGoo := TubeGoo.is_goo(_layer, first)
var seen := {first: true}
var toVisit: Array[Vector2i] = [first]
var mouths: Array[Dictionary] = []
@ -226,8 +225,7 @@ func _network_mouths(first: Vector2i) -> Array[Dictionary]:
if is_air(next):
mouths.append({tile = cell, front = next})
continue
var isSameKind := TubeGoo.is_goo(_layer, next) if isGoo else TubeSteer.is_manual(_layer, next)
if isSameKind and TubeSteer.get_openings(_layer, next) & TubeSteer.side_bit(-direction) and not seen.has(next):
if TubeSteer.is_manual(_layer, next) and TubeSteer.get_openings(_layer, next) & TubeSteer.side_bit(-direction) and not seen.has(next):
seen[next] = true
toVisit.append(next)
return mouths

View file

@ -1,7 +1,7 @@
# Components
- Player (`Characters/player.gd`): the slime: crawling on any surface, hops, bridges, edge wraps, going into tubes.
- Tubes (`Effects/`): tiles the slime squeezes through. Kinds: auto (`PixelStream`), manual (`TubeSteer`), goo (`TubeGoo`), one-way (`OneWayTube`, an auto tube with one entrance).
- Tubes (`Effects/`): tiles the slime squeezes through. Kinds: auto (`PixelStream`), manual (`TubeSteer`), one-way (`OneWayTube`, an auto tube with one entrance).
- Tube air (`Effects/tube_airflow.gd`, `Effects/tube_air_currents.gd`): air through one-way tubes: motes in and out, suction into entrances, blow away from exits.
- Room camera (`Levels/room_camera.gd`): screen-by-screen camera that cuts between 640x480 rooms.
- Maze generation (`Levels/Maze/`): builds, validates (slime movement model) and plays random tube labyrinths (see `docs/MAZE.md`).

View file

@ -14,7 +14,7 @@ generates a puzzle-book labyrinth with tubes, a Start and an End.
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, goo (all kept) and **one-way** (orange tiles).
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
@ -35,7 +35,7 @@ generates a puzzle-book labyrinth with tubes, a Start and an End.
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 and goo tubes join into one network you steer through
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 |
@ -99,7 +99,7 @@ Works only from the TileMapLayer, with two models:
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 and goo networks let it leave by any of their mouths).
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