From 12dbd9e1a6d913b148234e678bcaf0f354633652 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 16 Jan 2024 21:51:47 +0100 Subject: [PATCH] Restructure demo project for better compatibility with AssetLib package Also, add warning ignores for the custom task. --- demo/default_env.tres | 7 ------- demo/{ => demo}/ai/tasks/arrive_pos.gd | 2 ++ demo/{ => demo}/ai/trees/variables.tres | 0 demo/{ => demo}/ai/trees/waypoints.tres | 2 +- demo/{ => demo}/examples/variables/variables.tscn | 4 ++-- .../examples/waypoints/example_waypoints.gd | 0 .../examples/waypoints/example_waypoints.tscn | 6 +++--- .../examples/waypoints/patrolling_agent.gd | 0 .../examples/waypoints/patrolling_agent.tscn | 8 ++++---- .../examples/waypoints/waypoint_marker.gd | 0 demo/{icon.png => demo/godot.png} | Bin demo/{icon.png.import => demo/godot.png.import} | 6 +++--- .../tests/agent_properties/agent_properties.gd | 0 .../tests/agent_properties/agent_properties.tscn | 4 ++-- .../tests/agent_properties/bt_agent_properties.tres | 0 .../tests/blackboard_parameters/test_bb_params.gd | 0 .../bt_test_probability_selector.tres | 0 .../test_probability_selector.tscn | 2 +- demo/project.godot | 9 +++++++-- 19 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 demo/default_env.tres rename demo/{ => demo}/ai/tasks/arrive_pos.gd (90%) rename demo/{ => demo}/ai/trees/variables.tres (100%) rename demo/{ => demo}/ai/trees/waypoints.tres (93%) rename demo/{ => demo}/examples/variables/variables.tscn (70%) rename demo/{ => demo}/examples/waypoints/example_waypoints.gd (100%) rename demo/{ => demo}/examples/waypoints/example_waypoints.tscn (75%) rename demo/{ => demo}/examples/waypoints/patrolling_agent.gd (100%) rename demo/{ => demo}/examples/waypoints/patrolling_agent.tscn (87%) rename demo/{ => demo}/examples/waypoints/waypoint_marker.gd (100%) rename demo/{icon.png => demo/godot.png} (100%) rename demo/{icon.png.import => demo/godot.png.import} (73%) rename demo/{ => demo}/tests/agent_properties/agent_properties.gd (100%) rename demo/{ => demo}/tests/agent_properties/agent_properties.tscn (62%) rename demo/{ => demo}/tests/agent_properties/bt_agent_properties.tres (100%) rename demo/{ => demo}/tests/blackboard_parameters/test_bb_params.gd (100%) rename demo/{ => demo}/tests/probability_selector/bt_test_probability_selector.tres (100%) rename demo/{ => demo}/tests/probability_selector/test_probability_selector.tscn (75%) diff --git a/demo/default_env.tres b/demo/default_env.tres deleted file mode 100644 index 1a5570b..0000000 --- a/demo/default_env.tres +++ /dev/null @@ -1,7 +0,0 @@ -[gd_resource type="Environment" load_steps=2 format=2] - -[sub_resource type="Sky" id=1] - -[resource] -background_mode = 2 -background_sky = SubResource( 1 ) diff --git a/demo/ai/tasks/arrive_pos.gd b/demo/demo/ai/tasks/arrive_pos.gd similarity index 90% rename from demo/ai/tasks/arrive_pos.gd rename to demo/demo/ai/tasks/arrive_pos.gd index e0e361d..4d228f1 100644 --- a/demo/ai/tasks/arrive_pos.gd +++ b/demo/demo/ai/tasks/arrive_pos.gd @@ -18,12 +18,14 @@ extends BTAction @export var tolerance := 50.0 +@warning_ignore("native_method_override") # needed for GDExtension version. func _generate_name() -> String: return "Arrive pos: %s speed: %s" % [ LimboUtility.decorate_var(target_position_var), LimboUtility.decorate_var(speed_var), ] +@warning_ignore("native_method_override") func _tick(p_delta: float) -> Status: var target_pos: Vector2 = blackboard.get_var(target_position_var, Vector2.ZERO) if target_pos.distance_to(agent.global_position) < tolerance: diff --git a/demo/ai/trees/variables.tres b/demo/demo/ai/trees/variables.tres similarity index 100% rename from demo/ai/trees/variables.tres rename to demo/demo/ai/trees/variables.tres diff --git a/demo/ai/trees/waypoints.tres b/demo/demo/ai/trees/waypoints.tres similarity index 93% rename from demo/ai/trees/waypoints.tres rename to demo/demo/ai/trees/waypoints.tres index ecabd99..f94049a 100644 --- a/demo/ai/trees/waypoints.tres +++ b/demo/demo/ai/trees/waypoints.tres @@ -1,6 +1,6 @@ [gd_resource type="BehaviorTree" load_steps=10 format=3 uid="uid://cjkqi41oagagd"] -[ext_resource type="Script" path="res://ai/tasks/arrive_pos.gd" id="1_rhs33"] +[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="1_rhs33"] [sub_resource type="BTAction" id="BTAction_3xal7"] script = ExtResource("1_rhs33") diff --git a/demo/examples/variables/variables.tscn b/demo/demo/examples/variables/variables.tscn similarity index 70% rename from demo/examples/variables/variables.tscn rename to demo/demo/examples/variables/variables.tscn index 0f955f7..0a59bb0 100644 --- a/demo/examples/variables/variables.tscn +++ b/demo/demo/examples/variables/variables.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=2 format=3 uid="uid://d4bjeyescflm8"] -[ext_resource type="BehaviorTree" uid="uid://cvm3gqes75f53" path="res://ai/trees/variables.tres" id="1_tq7fc"] +[ext_resource type="BehaviorTree" uid="uid://cvm3gqes75f53" path="res://demo/ai/trees/variables.tres" id="1_cm2sf"] [node name="Variables Example" type="Node2D"] [node name="BTPlayer" type="BTPlayer" parent="."] -behavior_tree = ExtResource("1_tq7fc") +behavior_tree = ExtResource("1_cm2sf") diff --git a/demo/examples/waypoints/example_waypoints.gd b/demo/demo/examples/waypoints/example_waypoints.gd similarity index 100% rename from demo/examples/waypoints/example_waypoints.gd rename to demo/demo/examples/waypoints/example_waypoints.gd diff --git a/demo/examples/waypoints/example_waypoints.tscn b/demo/demo/examples/waypoints/example_waypoints.tscn similarity index 75% rename from demo/examples/waypoints/example_waypoints.tscn rename to demo/demo/examples/waypoints/example_waypoints.tscn index 2bb4425..e338ca1 100644 --- a/demo/examples/waypoints/example_waypoints.tscn +++ b/demo/demo/examples/waypoints/example_waypoints.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=4 format=3 uid="uid://p5i7fdku3hqs"] -[ext_resource type="Script" path="res://examples/waypoints/example_waypoints.gd" id="1_d4sso"] -[ext_resource type="Script" path="res://examples/waypoints/waypoint_marker.gd" id="2_l26sl"] -[ext_resource type="PackedScene" uid="uid://c26b8c8dndtop" path="res://examples/waypoints/patrolling_agent.tscn" id="3_t4qgi"] +[ext_resource type="Script" path="res://demo/examples/waypoints/example_waypoints.gd" id="1_d4sso"] +[ext_resource type="Script" path="res://demo/examples/waypoints/waypoint_marker.gd" id="2_l26sl"] +[ext_resource type="PackedScene" uid="uid://c26b8c8dndtop" path="res://demo/examples/waypoints/patrolling_agent.tscn" id="3_t4qgi"] [node name="ExampleWaypoints" type="Node2D"] script = ExtResource("1_d4sso") diff --git a/demo/examples/waypoints/patrolling_agent.gd b/demo/demo/examples/waypoints/patrolling_agent.gd similarity index 100% rename from demo/examples/waypoints/patrolling_agent.gd rename to demo/demo/examples/waypoints/patrolling_agent.gd diff --git a/demo/examples/waypoints/patrolling_agent.tscn b/demo/demo/examples/waypoints/patrolling_agent.tscn similarity index 87% rename from demo/examples/waypoints/patrolling_agent.tscn rename to demo/demo/examples/waypoints/patrolling_agent.tscn index 41d7661..e058444 100644 --- a/demo/examples/waypoints/patrolling_agent.tscn +++ b/demo/demo/examples/waypoints/patrolling_agent.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=7 format=3 uid="uid://c26b8c8dndtop"] -[ext_resource type="Script" path="res://examples/waypoints/patrolling_agent.gd" id="1_5wwhb"] -[ext_resource type="BehaviorTree" uid="uid://cjkqi41oagagd" path="res://ai/trees/waypoints.tres" id="2_66y4v"] -[ext_resource type="Texture2D" uid="uid://d0mht3ntak7e5" path="res://icon.png" id="3_j5bxx"] +[ext_resource type="Script" path="res://demo/examples/waypoints/patrolling_agent.gd" id="1_5wwhb"] +[ext_resource type="BehaviorTree" uid="uid://cjkqi41oagagd" path="res://demo/ai/trees/waypoints.tres" id="2_66y4v"] +[ext_resource type="Texture2D" uid="uid://d0mht3ntak7e5" path="res://demo/godot.png" id="3_64ge2"] [sub_resource type="Animation" id="Animation_5id00"] length = 0.001 @@ -51,7 +51,7 @@ _blackboard_data = { } [node name="Sprite2D" type="Sprite2D" parent="."] -texture = ExtResource("3_j5bxx") +texture = ExtResource("3_64ge2") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { diff --git a/demo/examples/waypoints/waypoint_marker.gd b/demo/demo/examples/waypoints/waypoint_marker.gd similarity index 100% rename from demo/examples/waypoints/waypoint_marker.gd rename to demo/demo/examples/waypoints/waypoint_marker.gd diff --git a/demo/icon.png b/demo/demo/godot.png similarity index 100% rename from demo/icon.png rename to demo/demo/godot.png diff --git a/demo/icon.png.import b/demo/demo/godot.png.import similarity index 73% rename from demo/icon.png.import rename to demo/demo/godot.png.import index 977b708..924caba 100644 --- a/demo/icon.png.import +++ b/demo/demo/godot.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://d0mht3ntak7e5" -path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" +path="res://.godot/imported/godot.png-a8a26b1338954efbba9baa82b9ad4a96.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.png" -dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] +source_file="res://demo/godot.png" +dest_files=["res://.godot/imported/godot.png-a8a26b1338954efbba9baa82b9ad4a96.ctex"] [params] diff --git a/demo/tests/agent_properties/agent_properties.gd b/demo/demo/tests/agent_properties/agent_properties.gd similarity index 100% rename from demo/tests/agent_properties/agent_properties.gd rename to demo/demo/tests/agent_properties/agent_properties.gd diff --git a/demo/tests/agent_properties/agent_properties.tscn b/demo/demo/tests/agent_properties/agent_properties.tscn similarity index 62% rename from demo/tests/agent_properties/agent_properties.tscn rename to demo/demo/tests/agent_properties/agent_properties.tscn index 9309aeb..59e664a 100644 --- a/demo/tests/agent_properties/agent_properties.tscn +++ b/demo/demo/tests/agent_properties/agent_properties.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=3 uid="uid://c3d3ed6545cly"] -[ext_resource type="Script" path="res://tests/agent_properties/agent_properties.gd" id="1_jh88u"] -[ext_resource type="BehaviorTree" uid="uid://ddhxf0haxgw" path="res://tests/agent_properties/bt_agent_properties.tres" id="2_txe8k"] +[ext_resource type="Script" path="res://demo/tests/agent_properties/agent_properties.gd" id="1_jh88u"] +[ext_resource type="BehaviorTree" uid="uid://ddhxf0haxgw" path="res://demo/tests/agent_properties/bt_agent_properties.tres" id="2_txe8k"] [node name="AgentProperties" type="Node2D"] script = ExtResource("1_jh88u") diff --git a/demo/tests/agent_properties/bt_agent_properties.tres b/demo/demo/tests/agent_properties/bt_agent_properties.tres similarity index 100% rename from demo/tests/agent_properties/bt_agent_properties.tres rename to demo/demo/tests/agent_properties/bt_agent_properties.tres diff --git a/demo/tests/blackboard_parameters/test_bb_params.gd b/demo/demo/tests/blackboard_parameters/test_bb_params.gd similarity index 100% rename from demo/tests/blackboard_parameters/test_bb_params.gd rename to demo/demo/tests/blackboard_parameters/test_bb_params.gd diff --git a/demo/tests/probability_selector/bt_test_probability_selector.tres b/demo/demo/tests/probability_selector/bt_test_probability_selector.tres similarity index 100% rename from demo/tests/probability_selector/bt_test_probability_selector.tres rename to demo/demo/tests/probability_selector/bt_test_probability_selector.tres diff --git a/demo/tests/probability_selector/test_probability_selector.tscn b/demo/demo/tests/probability_selector/test_probability_selector.tscn similarity index 75% rename from demo/tests/probability_selector/test_probability_selector.tscn rename to demo/demo/tests/probability_selector/test_probability_selector.tscn index dbdca9a..0746b2e 100644 --- a/demo/tests/probability_selector/test_probability_selector.tscn +++ b/demo/demo/tests/probability_selector/test_probability_selector.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://dgeb7tg8xb3j4"] -[ext_resource type="BehaviorTree" uid="uid://cen725hsk8lyl" path="res://tests/probability_selector/bt_test_probability_selector.tres" id="1_lr7l2"] +[ext_resource type="BehaviorTree" uid="uid://cen725hsk8lyl" path="res://demo/tests/probability_selector/bt_test_probability_selector.tres" id="1_lr7l2"] [node name="test_probability_selector" type="Node2D"] diff --git a/demo/project.godot b/demo/project.godot index d2dd19f..b3fd502 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -12,9 +12,9 @@ config_version=5 config/name="LimboAI Test" config/tags=PackedStringArray("demo") -run/main_scene="res://examples/waypoints/example_waypoints.tscn" +run/main_scene="res://demo/examples/waypoints/example_waypoints.tscn" config/features=PackedStringArray("4.2") -config/icon="res://icon.png" +config/icon="res://demo/godot.png" [debug] @@ -24,6 +24,11 @@ gdscript/warnings/native_method_override=1 common/drop_mouse_on_gui_input_disabled=true +[limbo_ai] + +behavior_tree/behavior_tree_default_dir="res://demo/ai/trees" +behavior_tree/user_task_dir_1="res://demo/ai/tasks" + [physics] common/enable_pause_aware_picking=true