37610242bf
Replace implicit randomness with seeded per-NPC RandomNumberGenerator streams so the same seed always produces the same scenario outcome. - Add SimulationClock (RefCounted): explicit fixed-step clock that converts frame delta into simulation ticks while preserving sub-tick remainder; replaces raw _process tick_timer accumulation - Add simulation_seed export (int=1337) to SimulationManager; drive per-NPC RNG streams via seed + npc_id + stream_id derivation (stream 0=init, stream 1=wander) - Add get_wander_offset(npc_id) to SimulationManager so wander targets are deterministic per seed; WorldViewManager calls it instead of local randf_range() - Add get_state_snapshot() and get_state_checksum() to SimulationManager for headless verification and future save/load - Convert SimNPC/SimVillage const DEBUG_LOGS to instance var debug_logs so headless tests can silence output without recompilation - Pass RandomNumberGenerator through SimNPC._init() instead of using global randf_range() for hunger/energy/position/scoring noise - Remove obsolete farm_zone and forest_zone exports from WorldViewManager and their marker/tree scene children from main.tscn; NPC gather tasks use ResourceNode exclusively - Rename TaskZone container to ActivityMarkers in main.tscn and update all scene paths (player, WVM, tests) to match - Add headless deterministic_simulation_test.gd: verifies clock accuracy, same-seed equality, different-seed divergence, and 24-tick scenario checksum without loading main.tscn
208 lines
9.8 KiB
Plaintext
208 lines
9.8 KiB
Plaintext
[gd_scene format=3 uid="uid://rs3hv73svbpa"]
|
|
|
|
[ext_resource type="Script" uid="uid://4mg67crlim53" path="res://player/player.gd" id="1_h2yge"]
|
|
[ext_resource type="Script" uid="uid://ii8ai801jur2" path="res://player/camera_rig.gd" id="2_1bvp3"]
|
|
[ext_resource type="Script" uid="uid://dbb25ttlyogqr" path="res://simulation/SimulationManager.gd" id="3_lquwl"]
|
|
[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"]
|
|
|
|
[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)
|
|
|
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_o5qli"]
|
|
radius = 0.4
|
|
height = 1.7
|
|
|
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_sgp6g"]
|
|
|
|
[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="Player" type="CharacterBody3D" parent="." unique_id=2022843760 node_paths=PackedStringArray("camera_rig", "simulation_manager", "food_zone", "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")
|
|
food_zone = NodePath("../ActivityMarkers/FoodZone")
|
|
guard_zone = NodePath("../ActivityMarkers/GuardZone")
|
|
study_zone = NodePath("../ActivityMarkers/StudyZone")
|
|
stomach_capacity_for_food = 10
|
|
|
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player" unique_id=1249497228]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
|
shape = SubResource("CapsuleShape3D_o5qli")
|
|
|
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="Player" unique_id=935946019]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
|
mesh = SubResource("CapsuleMesh_sgp6g")
|
|
|
|
[node name="FaceMarker" type="MeshInstance3D" parent="Player" unique_id=1558899356]
|
|
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.4, 0, 1.2, 0.6266626)
|
|
mesh = SubResource("BoxMesh_0wfyh")
|
|
|
|
[node name="CameraRig" type="Node3D" parent="." unique_id=81378719 node_paths=PackedStringArray("target")]
|
|
transform = Transform3D(1, 0, 0, 0, 0.57357645, 0.81915206, 0, -0.81915206, 0.57357645, 0, 10, 8)
|
|
script = ExtResource("2_1bvp3")
|
|
target = NodePath("../Player")
|
|
follow_speed = 8.0
|
|
deadzone_right = 2.0
|
|
deadzone_forward = 2.0
|
|
|
|
[node name="Camera3D" type="Camera3D" parent="CameraRig" unique_id=1992528776]
|
|
current = true
|
|
fov = 65.0
|
|
|
|
[node name="SimulationManager" type="Node" parent="." unique_id=1099676814]
|
|
script = ExtResource("3_lquwl")
|
|
|
|
[node name="WorldViewManager" type="Node" parent="." unique_id=763982891 node_paths=PackedStringArray("simulation_manager", "active_npcs_parent", "guard_zone", "study_zone", "rest_zone", "food_zone")]
|
|
script = ExtResource("4_1bvp3")
|
|
npc_visual_scene = ExtResource("5_lquwl")
|
|
simulation_manager = NodePath("../SimulationManager")
|
|
active_npcs_parent = NodePath("../ActiveNPCs")
|
|
guard_zone = NodePath("../ActivityMarkers/GuardZone")
|
|
study_zone = NodePath("../ActivityMarkers/StudyZone")
|
|
rest_zone = NodePath("../ActivityMarkers/RestZone")
|
|
food_zone = NodePath("../ActivityMarkers/FoodZone")
|
|
|
|
[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="FoodZone" 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/FoodZone" 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")
|
|
|
|
[node name="VillagePanel" type="PanelContainer" parent="UI" unique_id=482126250]
|
|
offset_left = 20.0
|
|
offset_top = 20.0
|
|
offset_right = 280.0
|
|
offset_bottom = 140.0
|
|
|
|
[node name="MarginContainer" type="MarginContainer" parent="UI/VillagePanel" unique_id=60382506]
|
|
layout_mode = 2
|
|
theme_override_constants/margin_left = 12
|
|
theme_override_constants/margin_top = 4
|
|
theme_override_constants/margin_right = 12
|
|
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"
|
|
amount_remaining = 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"
|
|
amount_remaining = 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"
|
|
amount_remaining = 12.0
|
|
yield_per_action = 3.0
|