Rearranged arcology metro sublayers

This commit is contained in:
Rob Kelly 2025-10-03 18:37:25 -06:00
parent ae4f4dba0c
commit e2d75f394d
4 changed files with 138 additions and 24 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://nllc8ljmn37g"] [gd_scene load_steps=10 format=3 uid="uid://nllc8ljmn37g"]
[ext_resource type="Script" uid="uid://drk82eeqk2mjs" path="res://src/world/generation/feature/generation_feature.gd" id="1_ek7o7"] [ext_resource type="Script" uid="uid://drk82eeqk2mjs" path="res://src/world/generation/feature/generation_feature.gd" id="1_ek7o7"]
[ext_resource type="Material" uid="uid://0ja682cfcvu3" path="res://assets/materials/shaders/megalith_base.material" id="2_pko82"] [ext_resource type="Material" uid="uid://0ja682cfcvu3" path="res://assets/materials/shaders/megalith_base.material" id="2_pko82"]
@ -12,9 +12,18 @@ size = Vector2(100000, 100000)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_ek7o7"] [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_ek7o7"]
data = PackedVector3Array(50000, 0, 50000, -50000, 0, 50000, 50000, 0, -50000, -50000, 0, 50000, -50000, 0, -50000, 50000, 0, -50000) data = PackedVector3Array(50000, 0, 50000, -50000, 0, 50000, 50000, 0, -50000, -50000, 0, 50000, -50000, 0, -50000, 50000, 0, -50000)
[node name="Arcology" type="Node3D" node_paths=PackedStringArray("sub_layers")] [sub_resource type="Curve" id="Curve_0w44q"]
_limits = [1.0, 4.0, 0.0, 1.0]
_data = [Vector2(0, 4), 0.0, -7.386, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_amoo5"]
_limits = [1.0, 4.0, 0.0, 1.0]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 4), 0.0, 0.0, 0, 0]
point_count = 2
[node name="Arcology" type="Node3D"]
script = ExtResource("1_ek7o7") script = ExtResource("1_ek7o7")
sub_layers = [NodePath("MetroGridLayer"), NodePath("MetroGridLayer2"), NodePath("MetroGridLayer3"), NodePath("MetroGridLayer4")]
metadata/_custom_type_script = "uid://drk82eeqk2mjs" metadata/_custom_type_script = "uid://drk82eeqk2mjs"
[node name="InnerPyramid" type="CSGCylinder3D" parent="."] [node name="InnerPyramid" type="CSGCylinder3D" parent="."]
@ -81,21 +90,109 @@ script = ExtResource("4_kox75")
end_margin_pct = 0.01 end_margin_pct = 0.01
metadata/_custom_type_script = "uid://cv0o1lirqeq44" metadata/_custom_type_script = "uid://cv0o1lirqeq44"
[node name="MetroGridLayer" parent="." instance=ExtResource("4_fy7wq")] [node name="MetroQuadrant" type="Node3D" parent="."]
simple_construct_threshold = 0.3
bounding_box = AABB(0, 0, 0, 99497, 100, 503)
[node name="MetroGridLayer2" parent="." instance=ExtResource("4_fy7wq")] [node name="OuterMetro" type="Node3D" parent="MetroQuadrant"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 99497, 0, 0)
simple_construct_threshold = 0.3
bounding_box = AABB(0, 0, 0, 503, 100, 99497)
[node name="MetroGridLayer3" parent="." instance=ExtResource("4_fy7wq")] [node name="MetroGridLayer" parent="MetroQuadrant/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 503, 0, 99497) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 55)
simple_construct_threshold = 0.3 bounding_box = AABB(0, 0, 0, 49088, 100, 448)
bounding_box = AABB(0, 0, 0, 99497, 100, 503)
[node name="MetroGridLayer4" parent="." instance=ExtResource("4_fy7wq")] [node name="MetroGridLayer2" parent="MetroQuadrant/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 503) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 503)
simple_construct_threshold = 0.3 bounding_box = AABB(0, 0, 0, 448, 100, 48640)
bounding_box = AABB(0, 0, 0, 503, 100, 99497)
[node name="InnerMetro" type="Node3D" parent="MetroQuadrant"]
[node name="MetroGridLayer" parent="MetroQuadrant/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45047, 0, 503)
construct_height_factor_x = SubResource("Curve_0w44q")
construct_height_factor_z = SubResource("Curve_amoo5")
bounding_box = AABB(0, 0, 0, 4096, 100, 44480)
[node name="MetroGridLayer2" parent="MetroQuadrant/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 503, 0, 45047)
construct_height_factor_x = SubResource("Curve_amoo5")
construct_height_factor_z = SubResource("Curve_0w44q")
bounding_box = AABB(0, 0, 0, 44480, 100, 4096)
[node name="MetroQuadrant2" type="Node3D" parent="."]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0, 100000)
[node name="OuterMetro" type="Node3D" parent="MetroQuadrant2"]
[node name="MetroGridLayer" parent="MetroQuadrant2/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 55)
bounding_box = AABB(0, 0, 0, 49088, 100, 448)
[node name="MetroGridLayer2" parent="MetroQuadrant2/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 503)
bounding_box = AABB(0, 0, 0, 448, 100, 48640)
[node name="InnerMetro" type="Node3D" parent="MetroQuadrant2"]
[node name="MetroGridLayer" parent="MetroQuadrant2/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45047, 0, 503)
construct_height_factor_x = SubResource("Curve_0w44q")
construct_height_factor_z = SubResource("Curve_amoo5")
bounding_box = AABB(0, 0, 0, 4096, 100, 44480)
[node name="MetroGridLayer2" parent="MetroQuadrant2/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 503, 0, 45047)
construct_height_factor_x = SubResource("Curve_amoo5")
construct_height_factor_z = SubResource("Curve_0w44q")
bounding_box = AABB(0, 0, 0, 44480, 100, 4096)
[node name="MetroQuadrant3" type="Node3D" parent="."]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 100000, 0, 100000)
[node name="OuterMetro" type="Node3D" parent="MetroQuadrant3"]
[node name="MetroGridLayer" parent="MetroQuadrant3/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 55)
bounding_box = AABB(0, 0, 0, 49088, 100, 448)
[node name="MetroGridLayer2" parent="MetroQuadrant3/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 503)
bounding_box = AABB(0, 0, 0, 448, 100, 48640)
[node name="InnerMetro" type="Node3D" parent="MetroQuadrant3"]
[node name="MetroGridLayer" parent="MetroQuadrant3/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45047, 0, 503)
construct_height_factor_x = SubResource("Curve_0w44q")
construct_height_factor_z = SubResource("Curve_amoo5")
bounding_box = AABB(0, 0, 0, 4096, 100, 44480)
[node name="MetroGridLayer2" parent="MetroQuadrant3/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 503, 0, 45047)
construct_height_factor_x = SubResource("Curve_amoo5")
construct_height_factor_z = SubResource("Curve_0w44q")
bounding_box = AABB(0, 0, 0, 44480, 100, 4096)
[node name="MetroQuadrant4" type="Node3D" parent="."]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 100000, 0, 0)
[node name="OuterMetro" type="Node3D" parent="MetroQuadrant4"]
[node name="MetroGridLayer" parent="MetroQuadrant4/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 55)
bounding_box = AABB(0, 0, 0, 49088, 100, 448)
[node name="MetroGridLayer2" parent="MetroQuadrant4/OuterMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 55, 0, 503)
bounding_box = AABB(0, 0, 0, 448, 100, 48640)
[node name="InnerMetro" type="Node3D" parent="MetroQuadrant4"]
[node name="MetroGridLayer" parent="MetroQuadrant4/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45047, 0, 503)
construct_height_factor_x = SubResource("Curve_0w44q")
construct_height_factor_z = SubResource("Curve_amoo5")
bounding_box = AABB(0, 0, 0, 4096, 100, 44480)
[node name="MetroGridLayer2" parent="MetroQuadrant4/InnerMetro" instance=ExtResource("4_fy7wq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 503, 0, 45047)
construct_height_factor_x = SubResource("Curve_amoo5")
construct_height_factor_z = SubResource("Curve_0w44q")
bounding_box = AABB(0, 0, 0, 44480, 100, 4096)

View File

@ -6,11 +6,27 @@ class_name GenerationFeature extends Node3D
@export var noise_scale := Vector3.ONE @export var noise_scale := Vector3.ONE
@export var noise_offset := Vector3.ZERO @export var noise_offset := Vector3.ZERO
@export var sub_layers: Array[GenerationLayer] var sub_layers: Array[GenerationLayer]:
get():
if not _defined_sub_layers:
sub_layers = _find_sub_layers(self)
_defined_sub_layers = true
return sub_layers
var _defined_sub_layers := false
var _generated := false var _generated := false
func _find_sub_layers(node: Node) -> Array[GenerationLayer]:
var layers: Array[GenerationLayer] = []
if node is GenerationLayer:
layers.append(node)
for c: Node in node.get_children():
# Do not walk outside of this scene
if c.owner in [owner, self]:
layers.append_array(_find_sub_layers(c))
return layers
func probe() -> void: func probe() -> void:
# TODO may want to make low-detail & high-detail probes distinct # TODO may want to make low-detail & high-detail probes distinct
if not _generated: if not _generated:

View File

@ -42,8 +42,10 @@ func probe_radius(center: Vector3, radius: float) -> void:
var rad_diff := Vector3(radius, 0, radius) var rad_diff := Vector3(radius, 0, radius)
# Translate probe box limits to grid space # Translate probe box limits to grid space
var grid_low := world_to_local(center - rad_diff).floor() var a := world_to_local(center - rad_diff).floor()
var grid_high := world_to_local(center + rad_diff).floor() var b := world_to_local(center + rad_diff).floor()
var grid_low := Vector2(minf(a.x, b.x), minf(a.y, b.y))
var grid_high := Vector2(maxf(a.x, b.x), maxf(a.y, b.y))
var grid_max := _plane_size().floor() var grid_max := _plane_size().floor()
# Constrain to bounding box # Constrain to bounding box
@ -96,7 +98,6 @@ func _init_debug_draw() -> void:
_debug_box = BoxMesh.new() _debug_box = BoxMesh.new()
var mat := StandardMaterial3D.new() var mat := StandardMaterial3D.new()
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
mat.cull_mode = BaseMaterial3D.CULL_DISABLED
mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
_debug_box.material = mat _debug_box.material = mat
_debug_meshinstance = MeshInstance3D.new() _debug_meshinstance = MeshInstance3D.new()

View File

@ -9,7 +9,7 @@ extends GridLayer
@export var noise_offset := Vector3.ZERO @export var noise_offset := Vector3.ZERO
@export_group("Construct Parameters") @export_group("Construct Parameters")
@export var simple_construct_threshold := 0.4 @export var simple_construct_threshold := 0.3
@export var construct_height_factor_x: Curve @export var construct_height_factor_x: Curve
@export var construct_height_factor_z: Curve @export var construct_height_factor_z: Curve