Files
tgcc/docs/gyms/ai/gym_ai.tscn
2026-06-21 09:24:05 +00:00

133 lines
6.6 KiB
Plaintext

[gd_scene format=3 uid="uid://dqvrhiqgkd3w1"]
[ext_resource type="PackedScene" uid="uid://cp8tf1uitoj57" path="res://core/ai/agents/wagyu/ai_wagyu.tscn" id="2_n3ssi"]
[ext_resource type="PackedScene" uid="uid://c8e8vy2yx0vuj" path="res://core/ai/agents/goat/ai_goat.tscn" id="3_a3kkd"]
[ext_resource type="PackedScene" uid="uid://bk45etvtdd6m5" path="res://core/ai/agents/fox/ai_fox.tscn" id="3_fdj8t"]
[ext_resource type="PackedScene" uid="uid://dgpkoccwlypct" path="res://core/ai/agents/racoon/ai_racoon.tscn" id="4_uj4wt"]
[ext_resource type="PackedScene" uid="uid://ceqxsqfiotm5j" path="res://core/ai/agents/human/ai_farmer.tscn" id="6_wr508"]
[ext_resource type="PackedScene" uid="uid://bnnuke5e7e1yr" path="res://core/ai/agents/human/ai_citizen_walker.tscn" id="7_7kg15"]
[ext_resource type="PackedScene" uid="uid://bbseno7clbepx" path="res://core/ai/agents/human/ai_citizen_sitter.tscn" id="8_hw7u7"]
[ext_resource type="PackedScene" uid="uid://duppccreftg3v" path="res://core/ai/agents/cat/ai_cat.tscn" id="9_7kg15"]
[sub_resource type="NavigationMesh" id="NavigationMesh_a2xtd"]
vertices = PackedVector3Array(-19.5, -0.33473957, -19.5, -19.5, -0.33473957, 19.5, 19.5, -0.33473957, 19.5, 19.5, -0.33473957, -19.5)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
geometry_source_geometry_mode = 2
geometry_source_group_name = &"navigation_mesh_source_group1"
[sub_resource type="NavigationMesh" id="NavigationMesh_n3ssi"]
vertices = PackedVector3Array(0.64679813, -0.33499998, -18.241827, 0.64679813, -0.33499998, 18.258173, 18.146797, -0.33499998, 18.258173, 18.146797, -0.33499998, -18.241827)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
geometry_source_geometry_mode = 2
geometry_source_group_name = &"navigation_mesh_source_group2"
[sub_resource type="Environment" id="Environment_lmjyn"]
[sub_resource type="PlaneMesh" id="PlaneMesh_optuv"]
[sub_resource type="BoxShape3D" id="BoxShape3D_xtjak"]
size = Vector3(1.9942131, 0.09710693, 1.984024)
[node name="GymAI" type="Node3D" unique_id=868339787]
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="." unique_id=774907858]
navigation_mesh = SubResource("NavigationMesh_a2xtd")
[node name="NavigationRegion3D2" type="NavigationRegion3D" parent="." unique_id=527150023 groups=["navigation_mesh_source_group2"]]
navigation_mesh = SubResource("NavigationMesh_n3ssi")
navigation_layers = 2
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1772424900]
environment = SubResource("Environment_lmjyn")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=269230449]
transform = Transform3D(1, 0, 0, 0, 0.17952333, 0.98375374, 0, -0.98375374, 0.17952333, 0, 18.920979, 0)
[node name="Control" type="Control" parent="." unique_id=1072240389]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=1647272132]
layout_mode = 0
offset_left = 50.0
offset_top = 50.0
offset_right = 400.0
offset_bottom = 827.0
[node name="Label" type="Label" parent="Control/PanelContainer" unique_id=272421245]
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
size_flags_vertical = 1
text = "System Logic:
- The NPC uses a finite state machine to switch between behaviors.
- State logic runs during physics updates, while movement is handled by the agent through NavigationAgent3D.
AI States:
- IdleState: The agent waits in place for the duration defined by wait_time.
- PatrolState: The agent selects a valid random destination and moves toward it.
Core Components:
- NavigationAgent3D: Calculates the path and reports when the destination has been reached.
- PatrolRadiusShape: Defines the random movement area used when choosing the next patrol point.
- StateMachine: Initializes the available states and handles transitions between them.
Parameters:
- Speed: Movement speed of the agent.
- Wait Time: Delay in seconds on the IdleState node.
- Area Radius: Radius of the SphereShape3D used by PatrolRadiusShape."
autowrap_mode = 2
[node name="Camera3D" type="Camera3D" parent="." unique_id=1753000680]
transform = Transform3D(1, 0, 0, 0, 0.42261824, 0.9063078, 0, -0.9063078, 0.42261824, 0, 18.361065, 15.377485)
[node name="Floor" type="MeshInstance3D" parent="." unique_id=1976415311 groups=["navigation_mesh_source_group1"]]
transform = Transform3D(9.719975, 0, 0, 0, 20, 0, 0, 0, 20, -9.556898, -0.83473957, 0)
mesh = SubResource("PlaneMesh_optuv")
[node name="StaticBody3D" type="StaticBody3D" parent="Floor" unique_id=2007477719]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor/StaticBody3D" unique_id=1446628130]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0036563873, -0.009703338, -0.00868988)
shape = SubResource("BoxShape3D_xtjak")
[node name="Floor2" type="MeshInstance3D" parent="." unique_id=309377168 groups=["navigation_mesh_source_group2"]]
transform = Transform3D(9.282202, 0, 0, 0, 20, 0, 0, 0, 18.741827, 9.429, -0.835, 0)
mesh = SubResource("PlaneMesh_optuv")
[node name="StaticBody3D" type="StaticBody3D" parent="Floor2" unique_id=1058766942]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor2/StaticBody3D" unique_id=2111078072]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0036563873, -0.009703338, -0.00868988)
shape = SubResource("BoxShape3D_xtjak")
[node name="AiGoat" parent="." unique_id=1397968422 instance=ExtResource("3_a3kkd")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.125751, 0, 9.623213)
navigation_layers = 2
[node name="AiRacoon" parent="." unique_id=170783736 instance=ExtResource("4_uj4wt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.993821, 0, 3.241497)
navigation_layers = 2
[node name="AiWagyu" parent="." unique_id=1980932035 instance=ExtResource("2_n3ssi")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.6312037, 0, -2.8999653)
navigation_layers = 2
[node name="AiCat" parent="." unique_id=1228675528 instance=ExtResource("9_7kg15")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13, 0, 12)
[node name="AiFox" parent="." unique_id=1674280877 instance=ExtResource("3_fdj8t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9, 0, 6)
[node name="AiFarmer" parent="." unique_id=2065786320 instance=ExtResource("6_wr508")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 0.6, 15)
[node name="AiCitizenWalker" parent="." unique_id=1790494026 instance=ExtResource("7_7kg15")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13, 0.6, -5)
[node name="AiCitizenSitter" parent="." unique_id=827400114 instance=ExtResource("8_hw7u7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 0.6, 3)