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
+25 -33
View File
@@ -3,44 +3,36 @@ extends RefCounted
const GridMapStateType = preload("res://scripts/domain/grid_map_state.gd")
const FloorStateType = preload("res://scripts/domain/world/floor_state.gd")
const ActorStateType = preload("res://scripts/domain/actor_state.gd")
const RoomStateType = preload("res://scripts/domain/world/room_state.gd")
# Floor zero deliberately remains an authored tutorial surface. Its geometry is
# not derived from the run seed; RunState supplies persistence by caching it.
const SURFACE_SIZE := Vector2i(42, 16)
const ENTRANCE := Vector2i(4, 7)
const DOOR := Vector2i(36, 7)
const EXIT := Vector2i(39, 7)
# The surface mirrors DCWASCII's current floor-zero contract: an empty authored
# staging area, a straight corridor, one door, and the stairs to the procedural
# dungeon. It intentionally contains no enemies, chest, deadline content, or
# seed-dependent population.
static func generate(_seed: String = "") -> FloorState:
var map := GridMapStateType.new(Vector2i(30, 20), GridMapStateType.CellKind.WALL)
_carve_room(map, Rect2i(2, 12, 6, 5))
_carve_room(map, Rect2i(2, 4, 7, 7))
_carve_room(map, Rect2i(10, 2, 10, 6))
_carve_room(map, Rect2i(21, 5, 7, 8))
_carve_vertical_corridor(map, 4, 10, 12)
_carve_horizontal_corridor(map, 8, 10, 6)
_carve_horizontal_corridor(map, 18, 21, 6)
_carve_vertical_corridor(map, 18, 4, 6)
map.set_cell(Vector2i(4, 11), GridMapStateType.CellKind.CLOSED_DOOR)
map.set_cell(Vector2i(4, 7), GridMapStateType.CellKind.CHEST)
map.set_cell(Vector2i(18, 4), GridMapStateType.CellKind.STAIRS)
var map := GridMapStateType.new(SURFACE_SIZE, GridMapStateType.CellKind.WALL)
var entrance_room := RoomStateType.new(&"surface_entrance", Rect2i(2, 2, 18, 11), &"entrance")
var landing := RoomStateType.new(&"surface_landing", Rect2i(37, 6, 4, 3), &"open")
_carve_room(map, entrance_room.bounds)
for x in range(20, DOOR.x):
map.set_cell(Vector2i(x, ENTRANCE.y), GridMapStateType.CellKind.FLOOR)
map.set_cell(DOOR, GridMapStateType.CellKind.CLOSED_DOOR)
_carve_room(map, landing.bounds)
map.set_cell(EXIT, GridMapStateType.CellKind.STAIRS)
var floor := FloorStateType.new(map, 0, 0)
floor.entrance = Vector2i(4, 12)
floor.exit = Vector2i(18, 4)
floor.enemies[&"goblin"] = ActorStateType.new(&"goblin", Vector2i(24, 8), 6, 2)
floor.chests[Vector2i(4, 7)] = {
"loot_table_id": &"floor1_reward",
"opened": false,
}
floor.rooms = [entrance_room, landing]
floor.entrance = ENTRANCE
floor.exit = EXIT
floor.metadata = {"hand_authored": true, "theme": "surface"}
return floor
static func _carve_room(map: GridMapState, room: Rect2i) -> void:
for y in range(room.position.y, room.end.y):
for x in range(room.position.x, room.end.x):
static func _carve_room(map: GridMapState, bounds: Rect2i) -> void:
for y in range(bounds.position.y, bounds.end.y):
for x in range(bounds.position.x, bounds.end.x):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
static func _carve_horizontal_corridor(map: GridMapState, from_x: int, to_x: int, y: int) -> void:
for x in range(from_x, to_x + 1):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
static func _carve_vertical_corridor(map: GridMapState, x: int, from_y: int, to_y: int) -> void:
for y in range(from_y, to_y + 1):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)