feat: complete playtest parity improvements

This commit is contained in:
goose
2026-10-08 19:06:19 -04:00
parent cce25a1908
commit eca098b4b9
139 changed files with 3001 additions and 982 deletions
+19 -9
View File
@@ -3,8 +3,6 @@ extends RefCounted
const MAX_MAP_SIZE := Vector2i(700, 350)
const MAX_ROOM_COUNT := 500
const SHALLOW_ROOM_MIN_SIZE := Vector2i(5, 4)
const SHALLOW_ROOM_MAX_SIZE := Vector2i(10, 8)
const DEEP_ROOM_MIN_SIZE := Vector2i(4, 3)
const DEEP_ROOM_MAX_SIZE := Vector2i(6, 5)
const ROOM_PADDING := 2
@@ -38,13 +36,6 @@ const EconomyType = preload("res://scripts/domain/items/economy.gd")
# impractical. It is also the sole sizing input to generation, making a seed
# and floor number reproduce exactly the same layout.
static func generation_profile(floor_number: int) -> Dictionary:
if floor_number <= 1:
return {
"map_size": Vector2i(80, 50),
"target_room_count": 8,
"room_min_size": SHALLOW_ROOM_MIN_SIZE,
"room_max_size": SHALLOW_ROOM_MAX_SIZE,
}
var normalized_floor := maxi(1, floor_number)
return {
"map_size": Vector2i(
@@ -75,6 +66,7 @@ static func generate(seed: String, floor_number: int, catalog: ContentCatalog) -
graph.add_local_loops(rooms, rng)
for edge in graph.loop_edges:
_carve_l_corridor_preserving_doors(map, _room_center(rooms[edge.from].bounds), _room_center(rooms[edge.to].bounds))
tree_door_cells = _remove_nonfunctional_doors(map, tree_door_cells)
for serialized_door in tree_door_cells:
map.set_cell(Vector2i(int(serialized_door[0]), int(serialized_door[1])), GridMapStateType.CellKind.CLOSED_DOOR)
@@ -176,6 +168,24 @@ static func _place_tree_boundary_doors(map: GridMapState, path: Array[Vector2i],
break
return serialized_cells
static func _remove_nonfunctional_doors(map: GridMapState, serialized_doors: Array[Array]) -> Array[Array]:
var functional: Array[Array] = []
for serialized_door: Array in serialized_doors:
var cell := Vector2i(int(serialized_door[0]), int(serialized_door[1]))
var walkable_directions: Array[Vector2i] = []
for direction: Vector2i in [Vector2i.LEFT, Vector2i.RIGHT, Vector2i.UP, Vector2i.DOWN]:
if map.is_walkable(cell + direction):
walkable_directions.append(direction)
var controls_straight_passage := walkable_directions.size() == 2 and (
(walkable_directions.has(Vector2i.LEFT) and walkable_directions.has(Vector2i.RIGHT))
or (walkable_directions.has(Vector2i.UP) and walkable_directions.has(Vector2i.DOWN))
)
if controls_straight_passage:
functional.append(serialized_door)
else:
map.set_cell(cell, GridMapStateType.CellKind.FLOOR)
return functional
static func _is_adjacent_to_serialized_door(cell: Vector2i, serialized_doors: Array[Array]) -> bool:
for serialized_door in serialized_doors:
var door_cell := Vector2i(int(serialized_door[0]), int(serialized_door[1]))