diff --git a/main.tscn b/main.tscn index 30817c0..5c57273 100644 --- a/main.tscn +++ b/main.tscn @@ -6,21 +6,9 @@ [ext_resource type="Script" uid="uid://c1f3b26n4yntf" path="res://world/world_view_manager.gd" id="4_1bvp3"] [ext_resource type="PackedScene" uid="uid://dhxxyprqflotq" path="res://player/npc/NpcVisual.tscn" id="5_lquwl"] [ext_resource type="Script" uid="uid://cjvbgqx8rao0t" path="res://world/ui/ui.gd" id="6_7mycd"] -[ext_resource type="PackedScene" uid="uid://dvd3qjpjor4sq" path="res://world/resource_nodes/ResourceNode.tscn" id="8_r3s0u"] [ext_resource type="Script" uid="uid://bbwol3mrjgn2x" path="res://world/active_world_adapter.gd" id="9_adapter"] [ext_resource type="Script" path="res://simulation/persistence/SaveSlotController.gd" id="10_save"] - -[sub_resource type="NavigationMesh" id="NavigationMesh_lquwl"] -vertices = PackedVector3Array(-14.5, 0.5, 0, -1, 0.5, 0, -1, 0.5, -0.75, 0, 0.5, -1, 0, 0.5, -14.5, -14.5, 0.5, -14.5, 0.75, 0.5, -1, 0.75, 0.75, -0.5, 14.5, 0.5, -0.5, 14.5, 0.5, -14.5, 0.75, 0.75, 0, 0, 1, 0, 0, 0.75, 0.75, -0.5, 0.75, 0.75, -0.5, 0.5, 14.5, 14.5, 0.5, 14.5, -1, 0.5, 0.75, -14.5, 0.5, 14.5) -polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(3, 2, 4), PackedInt32Array(4, 2, 5), PackedInt32Array(5, 2, 0), PackedInt32Array(6, 3, 4), PackedInt32Array(8, 7, 6), PackedInt32Array(8, 6, 9), PackedInt32Array(9, 6, 4), PackedInt32Array(12, 11, 10), PackedInt32Array(10, 7, 8), PackedInt32Array(14, 13, 12), PackedInt32Array(10, 8, 12), PackedInt32Array(12, 8, 14), PackedInt32Array(14, 8, 15), PackedInt32Array(0, 1, 16), PackedInt32Array(16, 13, 14), PackedInt32Array(14, 17, 16), PackedInt32Array(16, 17, 0)] - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o5qli"] -albedo_color = Color(0.16862746, 0.52156866, 0.30588236, 1) - -[sub_resource type="BoxMesh" id="BoxMesh_sgp6g"] - -[sub_resource type="BoxShape3D" id="BoxShape3D_lquwl"] -size = Vector3(30, 0.1, 30) +[ext_resource type="PackedScene" path="res://world/jajce/JajceWorld.tscn" id="11_jajce"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_o5qli"] radius = 0.4 @@ -30,55 +18,18 @@ height = 1.7 [sub_resource type="BoxMesh" id="BoxMesh_0wfyh"] -[sub_resource type="Environment" id="Environment_o5qli"] -background_mode = 1 -background_color = Color(0.46428233, 0.7990817, 0.98692364, 1) -ambient_light_source = 2 -ambient_light_color = Color(1, 1, 1, 1) -ambient_light_energy = 0.5 - -[sub_resource type="CylinderMesh" id="CylinderMesh_5vw27"] -top_radius = 1.129 -height = 5.774 - -[sub_resource type="BoxMesh" id="BoxMesh_kek77"] - -[sub_resource type="PrismMesh" id="PrismMesh_5vw27"] -size = Vector3(3, 5, 2) - -[sub_resource type="BoxMesh" id="BoxMesh_4c57u"] - [node name="Main" type="Node3D" unique_id=1850341560] -[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1256679786] -transform = Transform3D(0.8660254, -0.43301272, 0.24999999, 0, 0.49999997, 0.86602545, -0.5, -0.75, 0.43301266, 0, 0, 0) -light_energy = 2.0 - -[node name="World" type="Node3D" parent="." unique_id=1151232221] - -[node name="NavigationRegion3D" type="NavigationRegion3D" parent="World" unique_id=166422415] -navigation_mesh = SubResource("NavigationMesh_lquwl") - -[node name="GroundRoot" type="StaticBody3D" parent="World/NavigationRegion3D" unique_id=1002581689] - -[node name="GroundMesh" type="MeshInstance3D" parent="World/NavigationRegion3D/GroundRoot" unique_id=958336203] -transform = Transform3D(30, 0, 0, 0, 0.1, 0, 0, 0, 30, 0, -0.05, 0) -material_override = SubResource("StandardMaterial3D_o5qli") -mesh = SubResource("BoxMesh_sgp6g") -skeleton = NodePath("../../..") - -[node name="GroundCollision" type="CollisionShape3D" parent="World/NavigationRegion3D/GroundRoot" unique_id=1249304562] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.18380833, 0) -shape = SubResource("BoxShape3D_lquwl") +[node name="JajceWorld" parent="." instance=ExtResource("11_jajce")] [node name="Player" type="CharacterBody3D" parent="." unique_id=2022843760 node_paths=PackedStringArray("camera_rig", "simulation_manager", "pantry_marker", "guard_zone", "study_zone")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0) script = ExtResource("1_h2yge") camera_rig = NodePath("../CameraRig") simulation_manager = NodePath("../SimulationManager") -pantry_marker = NodePath("../ActivityMarkers/PantryMarker") -guard_zone = NodePath("../ActivityMarkers/GuardZone") -study_zone = NodePath("../ActivityMarkers/StudyZone") +pantry_marker = NodePath("../JajceWorld/LegacyActivityMarkers/PantryMarker") +guard_zone = NodePath("../JajceWorld/LegacyActivityMarkers/GuardZone") +study_zone = NodePath("../JajceWorld/LegacyActivityMarkers/StudyZone") stomach_capacity_for_food = 10 [node name="CollisionShape3D" type="CollisionShape3D" parent="Player" unique_id=1249497228] @@ -107,10 +58,10 @@ fov = 65.0 [node name="ActiveWorldAdapter" type="Node" parent="." node_paths=PackedStringArray("guard_marker", "study_marker", "rest_marker", "pantry_marker")] script = ExtResource("9_adapter") -guard_marker = NodePath("../ActivityMarkers/GuardZone") -study_marker = NodePath("../ActivityMarkers/StudyZone") -rest_marker = NodePath("../ActivityMarkers/RestZone") -pantry_marker = NodePath("../ActivityMarkers/PantryMarker") +guard_marker = NodePath("../JajceWorld/LegacyActivityMarkers/GuardZone") +study_marker = NodePath("../JajceWorld/LegacyActivityMarkers/StudyZone") +rest_marker = NodePath("../JajceWorld/LegacyActivityMarkers/RestZone") +pantry_marker = NodePath("../JajceWorld/LegacyActivityMarkers/PantryMarker") [node name="SimulationManager" type="Node" parent="." unique_id=1099676814 node_paths=PackedStringArray("active_world_adapter")] script = ExtResource("3_lquwl") @@ -128,46 +79,8 @@ active_npcs_parent = NodePath("../ActiveNPCs") [node name="EventBus" type="Node" parent="." unique_id=1149294963] -[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=662717542] -environment = SubResource("Environment_o5qli") - [node name="ActiveNPCs" type="Node3D" parent="." unique_id=88374680] -[node name="ActivityMarkers" type="Node3D" parent="." unique_id=1700020332] - -[node name="GuardZone" type="Marker3D" parent="ActivityMarkers" unique_id=1391821683] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 8) - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ActivityMarkers/GuardZone" unique_id=2044200724] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.354011, 0) -mesh = SubResource("CylinderMesh_5vw27") - -[node name="StudyZone" type="Marker3D" parent="ActivityMarkers" unique_id=1061191663] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 6) - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ActivityMarkers/StudyZone" unique_id=338918224] -transform = Transform3D(3.279775, 0, 0, 0, 5.511466, 0, 0, 0, 1, 0, 2.8180213, 0) -mesh = SubResource("BoxMesh_kek77") -metadata/_edit_group_ = true - -[node name="RestZone" type="Marker3D" parent="ActivityMarkers" unique_id=1187838016] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 5) - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ActivityMarkers/RestZone" unique_id=299533907] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.4911091, 0) -mesh = SubResource("PrismMesh_5vw27") - -[node name="MeshInstance3D2" type="MeshInstance3D" parent="ActivityMarkers/RestZone" unique_id=943692640] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3897309, 1.399735, 1.0352364) -mesh = SubResource("PrismMesh_5vw27") - -[node name="PantryMarker" type="Marker3D" parent="ActivityMarkers" unique_id=780921054] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8) - -[node name="MeshInstance3D" type="MeshInstance3D" parent="ActivityMarkers/PantryMarker" unique_id=357423915] -transform = Transform3D(4, 0, 0, 0, 3, 0, 0, 0, 4, 0, 1.5, 0) -mesh = SubResource("BoxMesh_4c57u") - [node name="UI" type="CanvasLayer" parent="." unique_id=875790201 node_paths=PackedStringArray("simulation_manager")] script = ExtResource("6_7mycd") simulation_manager = NodePath("../SimulationManager") @@ -188,30 +101,3 @@ theme_override_constants/margin_bottom = 4 [node name="VillageStatsLabel" type="Label" parent="UI/VillagePanel/MarginContainer" unique_id=1554319259] layout_mode = 2 theme_override_font_sizes/font_size = 10 - -[node name="ResourceNodes" type="Node3D" parent="." unique_id=1364178452] - -[node name="BerryBush_01" parent="ResourceNodes" unique_id=42005298 instance=ExtResource("8_r3s0u")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, -8) -node_id = &"berry_bush_01" - -[node name="BerryBush_02" parent="ResourceNodes" unique_id=2100422483 instance=ExtResource("8_r3s0u")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -4) -node_id = &"berry_bush_02" -initial_amount = 8.0 - -[node name="Tree_01" parent="ResourceNodes" unique_id=1162125845 instance=ExtResource("8_r3s0u")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -8) -node_id = &"tree_01" -action_id = &"gather_wood" -resource_id = &"wood" -initial_amount = 15.0 -yield_per_action = 3.0 - -[node name="Tree_02" parent="ResourceNodes" unique_id=1626186397 instance=ExtResource("8_r3s0u")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, -4) -node_id = &"tree_02" -action_id = &"gather_wood" -resource_id = &"wood" -initial_amount = 12.0 -yield_per_action = 3.0 diff --git a/tests/flat_map_baseline_test.gd b/tests/jajce_runtime_integration_test.gd similarity index 67% rename from tests/flat_map_baseline_test.gd rename to tests/jajce_runtime_integration_test.gd index 84e648e..e1478ca 100644 --- a/tests/flat_map_baseline_test.gd +++ b/tests/jajce_runtime_integration_test.gd @@ -15,7 +15,34 @@ func _run() -> void: simulation_manager.set_process(false) _check(simulation_manager.npcs.size() == 3, "Baseline should create three NPCs") - _check(main_scene.get_node("ResourceNodes").get_child_count() == 4, "Baseline should contain four ResourceNodes") + _check( + main_scene.has_node("JajceWorld/TerrainRoot/Terrain3D"), + "Playable runtime should instance the Jajce Terrain3D world" + ) + var terrain: Terrain3D = main_scene.get_node( + "JajceWorld/TerrainRoot/Terrain3D" + ) + _check( + terrain.get_camera() == main_scene.get_node("CameraRig/Camera3D"), + "Runtime Terrain3D should bind to the gameplay camera" + ) + _check( + not main_scene.has_node("World") + and not main_scene.has_node("ResourceNodes") + and not main_scene.has_node("ActivityMarkers"), + "Runtime should not retain duplicate flat-world objects" + ) + var resource_root := main_scene.get_node( + "JajceWorld/WorldObjects/ResourceNodes" + ) + _check( + resource_root.get_child_count() == 4, + "Runtime should contain four Jajce ResourceNodes" + ) + _check( + simulation_manager.resource_states.size() == 4, + "Simulation authority should bind all four Jajce resources" + ) var navigation_map: RID = main_scene.get_world_3d().navigation_map await _wait_for_navigation_map(navigation_map) @@ -28,14 +55,14 @@ func _run() -> void: ] var destinations: Array[Vector3] = [] for marker_path in [ - "ActivityMarkers/PantryMarker", - "ActivityMarkers/GuardZone", - "ActivityMarkers/StudyZone", - "ActivityMarkers/RestZone" + "JajceWorld/LegacyActivityMarkers/PantryMarker", + "JajceWorld/LegacyActivityMarkers/GuardZone", + "JajceWorld/LegacyActivityMarkers/StudyZone", + "JajceWorld/LegacyActivityMarkers/RestZone" ]: destinations.append(main_scene.get_node(marker_path).global_position) - for resource in main_scene.get_node("ResourceNodes").get_children(): + for resource in resource_root.get_children(): destinations.append((resource as ResourceNode).interaction_point.global_position) for origin in fixed_origins: @@ -79,7 +106,7 @@ func _run() -> void: _check(starving.is_dead, "Starvation threshold should still kill an NPC") if failures.is_empty(): - print("[TEST] Flat-map baseline passed: 3 NPCs, 4 resources, 24 navigation routes") + print("[TEST] Jajce runtime passed: 3 NPCs, 4 resources, 24 navigation routes") quit(0) return diff --git a/tests/flat_map_baseline_test.gd.uid b/tests/jajce_runtime_integration_test.gd.uid similarity index 100% rename from tests/flat_map_baseline_test.gd.uid rename to tests/jajce_runtime_integration_test.gd.uid diff --git a/tests/resource_node_player_parity_test.gd b/tests/resource_node_player_parity_test.gd index 3be4b72..5247c3a 100644 --- a/tests/resource_node_player_parity_test.gd +++ b/tests/resource_node_player_parity_test.gd @@ -14,8 +14,12 @@ func _run() -> void: var simulation_manager := main_scene.get_node("SimulationManager") var player := main_scene.get_node("Player") - var bush := main_scene.get_node("ResourceNodes/BerryBush_01") as ResourceNode - var tree := main_scene.get_node("ResourceNodes/Tree_01") as ResourceNode + var bush := main_scene.get_node( + "JajceWorld/WorldObjects/ResourceNodes/BerryBush_01" + ) as ResourceNode + var tree := main_scene.get_node( + "JajceWorld/WorldObjects/ResourceNodes/Tree_01" + ) as ResourceNode simulation_manager.set_process(false) var bush_state: ResourceStateRecord = simulation_manager.get_resource_state(