Demo: Rename agents

This commit is contained in:
Serhii Snitsaruk 2024-02-04 14:26:58 +01:00
parent 73152b5760
commit c925bab659
22 changed files with 118 additions and 92 deletions

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_l180o"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_l180o"]
[ext_resource type="Texture2D" uid="uid://cw8s50856x8ct" path="res://demo/assets/agent_melee_simple.png" id="2_bvbes"] [ext_resource type="Texture2D" uid="uid://cw8s50856x8ct" path="res://demo/assets/agent_melee_simple.png" id="2_bvbes"]
[ext_resource type="BehaviorTree" uid="uid://bpdm5jnegi38" path="res://demo/ai/trees/enemy_melee_simple.tres" id="3_tb7cx"] [ext_resource type="BehaviorTree" uid="uid://bpdm5jnegi38" path="res://demo/ai/trees/01_agent_melee_simple.tres" id="3_tb7cx"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_s08ac"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_s08ac"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_n83hi"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_n83hi"]
[ext_resource type="Texture2D" uid="uid://ce16nc0wy2s8" path="res://demo/assets/agent_charger.png" id="2_y7pic"] [ext_resource type="Texture2D" uid="uid://ce16nc0wy2s8" path="res://demo/assets/agent_charger.png" id="2_y7pic"]
[ext_resource type="BehaviorTree" uid="uid://ylife72ym5et" path="res://demo/ai/trees/enemy_charger.tres" id="3_nacc3"] [ext_resource type="BehaviorTree" uid="uid://ylife72ym5et" path="res://demo/ai/trees/02_agent_charger.tres" id="3_nacc3"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_b4r3u"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_b4r3u"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://730bthc0ywhd"] [gd_scene load_steps=5 format=3 uid="uid://730bthc0ywhd"]
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_c1bsr"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_13xup"]
[ext_resource type="Texture2D" uid="uid://h70okn6hmxum" path="res://demo/assets/agent_imp.png" id="2_vnje4"] [ext_resource type="Texture2D" uid="uid://h70okn6hmxum" path="res://demo/assets/agent_imp.png" id="2_xd5s8"]
[ext_resource type="BehaviorTree" uid="uid://c2bxoo68ywb27" path="res://demo/ai/trees/02_agent_imp.tres" id="3_xjn4q"] [ext_resource type="BehaviorTree" uid="uid://c2bxoo68ywb27" path="res://demo/ai/trees/03_agent_imp.tres" id="3_furh3"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_aog23"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_aog23"]
var/speed/name = "speed" var/speed/name = "speed"
@ -11,29 +11,29 @@ var/speed/value = 400.0
var/speed/hint = 1 var/speed/hint = 1
var/speed/hint_string = "10,1000,10" var/speed/hint_string = "10,1000,10"
[node name="AgentImp" instance=ExtResource("1_c1bsr")] [node name="AgentImp" instance=ExtResource("1_13xup")]
[node name="LegL" parent="Root/Rig" index="1"] [node name="LegL" parent="Root/Rig" index="1"]
texture = ExtResource("2_vnje4") texture = ExtResource("2_xd5s8")
[node name="LegR" parent="Root/Rig" index="2"] [node name="LegR" parent="Root/Rig" index="2"]
texture = ExtResource("2_vnje4") texture = ExtResource("2_xd5s8")
[node name="Body" parent="Root/Rig" index="3"] [node name="Body" parent="Root/Rig" index="3"]
texture = ExtResource("2_vnje4") texture = ExtResource("2_xd5s8")
[node name="Hat" parent="Root/Rig/Body" index="0"] [node name="Hat" parent="Root/Rig/Body" index="0"]
texture = ExtResource("2_vnje4") texture = ExtResource("2_xd5s8")
[node name="HandL" parent="Root/Rig/Body" index="1"] [node name="HandL" parent="Root/Rig/Body" index="1"]
texture = ExtResource("2_vnje4") texture = ExtResource("2_xd5s8")
[node name="HandR" parent="Root/Rig/Body" index="2"] [node name="HandR" parent="Root/Rig/Body" index="2"]
texture = ExtResource("2_vnje4") texture = ExtResource("2_xd5s8")
[node name="Health" parent="." index="3"] [node name="Health" parent="." index="3"]
max_health = 5.0 max_health = 5.0
[node name="BTPlayer" type="BTPlayer" parent="." index="5"] [node name="BTPlayer" type="BTPlayer" parent="." index="5"]
behavior_tree = ExtResource("3_xjn4q") behavior_tree = ExtResource("3_furh3")
blackboard_plan = SubResource("BlackboardPlan_aog23") blackboard_plan = SubResource("BlackboardPlan_aog23")

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_2ir76"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_2ir76"]
[ext_resource type="Texture2D" uid="uid://l042ovqqsy3l" path="res://demo/assets/agent_skirmisher.png" id="2_w8tqw"] [ext_resource type="Texture2D" uid="uid://l042ovqqsy3l" path="res://demo/assets/agent_skirmisher.png" id="2_w8tqw"]
[ext_resource type="BehaviorTree" uid="uid://qqmjvbeibatn" path="res://demo/ai/trees/enemy_melee_skirmisher.tres" id="3_bhfkv"] [ext_resource type="BehaviorTree" uid="uid://qqmjvbeibatn" path="res://demo/ai/trees/04_agent_skirmisher.tres" id="3_bhfkv"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_vjbry"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_vjbry"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_oa4xm"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_oa4xm"]
[ext_resource type="Texture2D" uid="uid://cjts4ennjtepg" path="res://demo/assets/agent_ranged.png" id="2_37lvn"] [ext_resource type="Texture2D" uid="uid://cjts4ennjtepg" path="res://demo/assets/agent_ranged.png" id="2_37lvn"]
[ext_resource type="BehaviorTree" uid="uid://cqluon1y1hnn5" path="res://demo/ai/trees/enemy_ranged.tres" id="3_f7r5w"] [ext_resource type="BehaviorTree" uid="uid://cqluon1y1hnn5" path="res://demo/ai/trees/05_agent_ranged.tres" id="3_f7r5w"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_2kwy7"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_2kwy7"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_dny3b"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_dny3b"]
[ext_resource type="Texture2D" uid="uid://bo0ibp7tvjbba" path="res://demo/assets/agent_combo.png" id="2_4rqld"] [ext_resource type="Texture2D" uid="uid://bo0ibp7tvjbba" path="res://demo/assets/agent_combo.png" id="2_4rqld"]
[ext_resource type="BehaviorTree" uid="uid://cpncl1db8j12f" path="res://demo/ai/trees/enemy_melee_combo.tres" id="3_l805q"] [ext_resource type="BehaviorTree" uid="uid://cpncl1db8j12f" path="res://demo/ai/trees/06_agent_melee_combo.tres" id="3_l805q"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_78rmu"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_78rmu"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_afx5l"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_afx5l"]
[ext_resource type="Texture2D" uid="uid://usu3j55d6dgc" path="res://demo/assets/agent_melee_nuanced.png" id="2_e51r0"] [ext_resource type="Texture2D" uid="uid://usu3j55d6dgc" path="res://demo/assets/agent_melee_nuanced.png" id="2_e51r0"]
[ext_resource type="BehaviorTree" uid="uid://c2u6sljqkim0n" path="res://demo/ai/trees/03_agent_melee_nuanced.tres" id="3_b8kcf"] [ext_resource type="BehaviorTree" uid="uid://c2u6sljqkim0n" path="res://demo/ai/trees/07_agent_melee_nuanced.tres" id="3_b8kcf"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_tnf02"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_tnf02"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_115kp"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_115kp"]
[ext_resource type="Texture2D" uid="uid://d1tx7u8ho0r4v" path="res://demo/assets/agent_demon.png" id="2_cb5f2"] [ext_resource type="Texture2D" uid="uid://d1tx7u8ho0r4v" path="res://demo/assets/agent_demon.png" id="2_cb5f2"]
[ext_resource type="BehaviorTree" uid="uid://cpcnbi81jqge4" path="res://demo/ai/trees/enemy_demon.tres" id="3_ebd57"] [ext_resource type="BehaviorTree" uid="uid://cpcnbi81jqge4" path="res://demo/ai/trees/08_agent_demon.tres" id="3_ebd57"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_5sr4g"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_5sr4g"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_neifu"] [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_neifu"]
[ext_resource type="Texture2D" uid="uid://ombnpn2edldt" path="res://demo/assets/agent_summoner.png" id="2_fcti4"] [ext_resource type="Texture2D" uid="uid://ombnpn2edldt" path="res://demo/assets/agent_summoner.png" id="2_fcti4"]
[ext_resource type="BehaviorTree" uid="uid://cpxk7jnqpwwlc" path="res://demo/ai/trees/enemy_summoner.tres" id="3_bunpq"] [ext_resource type="BehaviorTree" uid="uid://cpxk7jnqpwwlc" path="res://demo/ai/trees/09_agent_summoner.tres" id="3_bunpq"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_bqv3d"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_bqv3d"]
var/speed/name = "speed" var/speed/name = "speed"

View File

@ -12,7 +12,7 @@ extends CharacterBody2D
## Base agent script. ## Base agent script.
const MINION_RESOURCE := "res://demo/agents/agent_imp.tscn" const MINION_RESOURCE := "res://demo/agents/03_agent_imp.tscn"
const NinjaStar := preload("res://demo/agents/ninja_star/ninja_star.tscn") const NinjaStar := preload("res://demo/agents/ninja_star/ninja_star.tscn")
const Fireball := preload("res://demo/agents/fireball/fireball.tscn") const Fireball := preload("res://demo/agents/fireball/fireball.tscn")
@ -112,6 +112,8 @@ func apply_knockback(knockback: Vector2, frames: int = 10) -> void:
func die() -> void: func die() -> void:
if _is_dead:
return
_is_dead = true _is_dead = true
root.process_mode = Node.PROCESS_MODE_DISABLED root.process_mode = Node.PROCESS_MODE_DISABLED
animation_player.play(&"death") animation_player.play(&"death")

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=27 format=3 uid="uid://ylife72ym5et"] [gd_resource type="BehaviorTree" load_steps=27 format=3 uid="uid://ylife72ym5et"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="1_3ovx6"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_657p6"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_g3c1d"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_t3udh"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_l3434"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_u2ra5"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_km0bx"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_xwjl7"]
[ext_resource type="Script" path="res://demo/ai/tasks/leap_forward.gd" id="5_socam"] [ext_resource type="Script" path="res://demo/ai/tasks/leap_forward.gd" id="5_f6dg8"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_qd806"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_qd806"]
var/speed/name = "speed" var/speed/name = "speed"
@ -36,12 +36,12 @@ custom_name = "Short break"
children = [SubResource("BTPlayAnimation_ha2ag"), SubResource("BTRandomWait_cedqr")] children = [SubResource("BTPlayAnimation_ha2ag"), SubResource("BTRandomWait_cedqr")]
[sub_resource type="BTAction" id="BTAction_pp23y"] [sub_resource type="BTAction" id="BTAction_pp23y"]
script = ExtResource("1_g3c1d") script = ExtResource("1_657p6")
group = &"player" group = &"player"
output_var = "target" output_var = "target"
[sub_resource type="BTAction" id="BTAction_pmvd0"] [sub_resource type="BTAction" id="BTAction_pmvd0"]
script = ExtResource("1_3ovx6") script = ExtResource("2_t3udh")
target_var = "target" target_var = "target"
closest_side = false closest_side = false
flank_side = 0 flank_side = 0
@ -59,7 +59,7 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_87mi0"] [sub_resource type="BTAction" id="BTAction_87mi0"]
script = ExtResource("2_l3434") script = ExtResource("3_u2ra5")
target_position_var = "flank_pos" target_position_var = "flank_pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
@ -69,7 +69,7 @@ custom_name = "Flank target"
children = [SubResource("BTAction_pp23y"), SubResource("BTAction_pmvd0"), SubResource("BTPlayAnimation_h0poo"), SubResource("BTAction_87mi0")] children = [SubResource("BTAction_pp23y"), SubResource("BTAction_pmvd0"), SubResource("BTPlayAnimation_h0poo"), SubResource("BTAction_87mi0")]
[sub_resource type="BTAction" id="BTAction_q5g4a"] [sub_resource type="BTAction" id="BTAction_q5g4a"]
script = ExtResource("4_km0bx") script = ExtResource("4_xwjl7")
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_bfijg"] [sub_resource type="BBNode" id="BBNode_bfijg"]
@ -98,7 +98,7 @@ animation_name = &"charge"
blend = 0.05 blend = 0.05
[sub_resource type="BTAction" id="BTAction_o18uk"] [sub_resource type="BTAction" id="BTAction_o18uk"]
script = ExtResource("5_socam") script = ExtResource("5_f6dg8")
force = 1000.0 force = 1000.0
duration = 2.0 duration = 2.0

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=30 format=3 uid="uid://c2bxoo68ywb27"] [gd_resource type="BehaviorTree" load_steps=30 format=3 uid="uid://c2bxoo68ywb27"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_qgdmn"] [ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_cdtqu"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_kcs76"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_31fsn"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="3_cy2w4"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="3_y1r1a"]
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="4_lorkr"] [ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="4_jlgat"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_1vcyu"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_o4ggh"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed" var/speed/name = "speed"
@ -23,13 +23,13 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_chmiy"] [sub_resource type="BTAction" id="BTAction_chmiy"]
script = ExtResource("1_qgdmn") script = ExtResource("1_cdtqu")
range_min = 200.0 range_min = 200.0
range_max = 500.0 range_max = 500.0
position_var = "pos" position_var = "pos"
[sub_resource type="BTAction" id="BTAction_5kivl"] [sub_resource type="BTAction" id="BTAction_5kivl"]
script = ExtResource("2_kcs76") script = ExtResource("2_31fsn")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
@ -69,12 +69,12 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_ulbrf"] [sub_resource type="BTAction" id="BTAction_ulbrf"]
script = ExtResource("3_cy2w4") script = ExtResource("3_y1r1a")
group = &"player" group = &"player"
output_var = "target" output_var = "target"
[sub_resource type="BTAction" id="BTAction_a4jqi"] [sub_resource type="BTAction" id="BTAction_a4jqi"]
script = ExtResource("4_lorkr") script = ExtResource("4_jlgat")
target_var = "target" target_var = "target"
speed_var = "speed" speed_var = "speed"
approach_distance = 100.0 approach_distance = 100.0
@ -88,7 +88,7 @@ custom_name = "Pursue player"
children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), SubResource("BTTimeLimit_xek5v")] children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), SubResource("BTTimeLimit_xek5v")]
[sub_resource type="BTAction" id="BTAction_kidxn"] [sub_resource type="BTAction" id="BTAction_kidxn"]
script = ExtResource("5_1vcyu") script = ExtResource("5_o4ggh")
target_var = "target" target_var = "target"
[sub_resource type="BTWait" id="BTWait_tadkc"] [sub_resource type="BTWait" id="BTWait_tadkc"]

View File

@ -1,11 +1,11 @@
[gd_resource type="BehaviorTree" load_steps=36 format=3 uid="uid://qqmjvbeibatn"] [gd_resource type="BehaviorTree" load_steps=36 format=3 uid="uid://qqmjvbeibatn"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_oiqfa"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2883n"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_b4wcf"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_cjso2"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="3_hwbvn"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_treio"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_pn7sq"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_57x51"]
[ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="4_330a2"] [ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="5_p5dih"]
[ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="5_morrs"] [ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="6_fkv0k"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed" var/speed/name = "speed"
@ -38,7 +38,7 @@ min_duration = 1.5
max_duration = 3.0 max_duration = 3.0
[sub_resource type="BTAction" id="BTAction_ulbrf"] [sub_resource type="BTAction" id="BTAction_ulbrf"]
script = ExtResource("1_oiqfa") script = ExtResource("1_2883n")
group = &"player" group = &"player"
output_var = "target" output_var = "target"
@ -57,7 +57,7 @@ blend = 0.1
speed = 1.2 speed = 1.2
[sub_resource type="BTAction" id="BTAction_g5ayy"] [sub_resource type="BTAction" id="BTAction_g5ayy"]
script = ExtResource("2_b4wcf") script = ExtResource("2_cjso2")
target_var = "target" target_var = "target"
closest_side = false closest_side = false
flank_side = 2 flank_side = 2
@ -66,7 +66,7 @@ range_max = 100
position_var = "flank_pos" position_var = "flank_pos"
[sub_resource type="BTAction" id="BTAction_tv4lt"] [sub_resource type="BTAction" id="BTAction_tv4lt"]
script = ExtResource("3_pn7sq") script = ExtResource("3_treio")
target_position_var = "flank_pos" target_position_var = "flank_pos"
speed_var = "fast_speed" speed_var = "fast_speed"
tolerance = 50.0 tolerance = 50.0
@ -79,11 +79,11 @@ time_limit = 4.0
children = [SubResource("BTSequence_rgwic")] children = [SubResource("BTSequence_rgwic")]
[sub_resource type="BTAction" id="BTAction_kidxn"] [sub_resource type="BTAction" id="BTAction_kidxn"]
script = ExtResource("3_hwbvn") script = ExtResource("4_57x51")
target_var = "target" target_var = "target"
[sub_resource type="BTCondition" id="BTCondition_uk4dg"] [sub_resource type="BTCondition" id="BTCondition_uk4dg"]
script = ExtResource("4_330a2") script = ExtResource("5_p5dih")
distance_min = 50.0 distance_min = 50.0
distance_max = 170.0 distance_max = 170.0
target_var = "target" target_var = "target"
@ -132,7 +132,7 @@ blend = 0.1
speed = -0.7 speed = -0.7
[sub_resource type="BTAction" id="BTAction_4ye2y"] [sub_resource type="BTAction" id="BTAction_4ye2y"]
script = ExtResource("5_morrs") script = ExtResource("6_fkv0k")
speed_var = "slow_speed" speed_var = "slow_speed"
max_angle_deviation = 0.7 max_angle_deviation = 0.7

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=40 format=3 uid="uid://cqluon1y1hnn5"] [gd_resource type="BehaviorTree" load_steps=40 format=3 uid="uid://cqluon1y1hnn5"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_3j1v8"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_4xk1i"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_vbh52"] [ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="2_647kx"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_20ffh"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_q4r2p"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_x8yor"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="4_53hao"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="5_mexvv"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_aexyq"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed" var/speed/name = "speed"
@ -27,7 +27,7 @@ min_duration = 1.2
max_duration = 2.5 max_duration = 2.5
[sub_resource type="BTAction" id="BTAction_c4cxo"] [sub_resource type="BTAction" id="BTAction_c4cxo"]
script = ExtResource("1_3j1v8") script = ExtResource("1_4xk1i")
group = &"player" group = &"player"
output_var = "target" output_var = "target"
@ -39,7 +39,7 @@ children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud
custom_name = "He is bored attacking player all the time ;)" custom_name = "He is bored attacking player all the time ;)"
[sub_resource type="BTAction" id="BTAction_lpk67"] [sub_resource type="BTAction" id="BTAction_lpk67"]
script = ExtResource("5_mexvv") script = ExtResource("2_647kx")
range_min = 300.0 range_min = 300.0
range_max = 500.0 range_max = 500.0
position_var = "pos" position_var = "pos"
@ -54,7 +54,7 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_apfsn"] [sub_resource type="BTAction" id="BTAction_apfsn"]
script = ExtResource("3_20ffh") script = ExtResource("3_q4r2p")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
@ -72,7 +72,7 @@ run_chance = 0.3
children = [SubResource("BTSequence_0gdqn")] children = [SubResource("BTSequence_0gdqn")]
[sub_resource type="BTAction" id="BTAction_kuuw2"] [sub_resource type="BTAction" id="BTAction_kuuw2"]
script = ExtResource("2_vbh52") script = ExtResource("4_53hao")
target_var = "target" target_var = "target"
closest_side = true closest_side = true
flank_side = 0 flank_side = 0
@ -90,7 +90,7 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_66hsk"] [sub_resource type="BTAction" id="BTAction_66hsk"]
script = ExtResource("3_20ffh") script = ExtResource("3_q4r2p")
target_position_var = "shoot_pos" target_position_var = "shoot_pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
@ -99,7 +99,7 @@ tolerance = 50.0
children = [SubResource("BTAction_66hsk")] children = [SubResource("BTAction_66hsk")]
[sub_resource type="BTAction" id="BTAction_enw2m"] [sub_resource type="BTAction" id="BTAction_enw2m"]
script = ExtResource("4_x8yor") script = ExtResource("5_aexyq")
target_var = "target" target_var = "target"
[sub_resource type="BTSequence" id="BTSequence_lhg7f"] [sub_resource type="BTSequence" id="BTSequence_lhg7f"]

View File

@ -1,10 +1,10 @@
[gd_resource type="BehaviorTree" load_steps=37 format=3 uid="uid://cpncl1db8j12f"] [gd_resource type="BehaviorTree" load_steps=37 format=3 uid="uid://cpncl1db8j12f"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_e6233"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_sf4l8"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_ifiw3"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_5nwkp"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_4bv56"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_3tom2"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="3_ylc6a"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_hi228"]
[ext_resource type="Script" path="res://demo/ai/tasks/leap_forward.gd" id="5_1wo58"] [ext_resource type="Script" path="res://demo/ai/tasks/leap_forward.gd" id="5_fpbac"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed" var/speed/name = "speed"
@ -27,7 +27,7 @@ min_duration = 0.7
max_duration = 1.5 max_duration = 1.5
[sub_resource type="BTAction" id="BTAction_ulbrf"] [sub_resource type="BTAction" id="BTAction_ulbrf"]
script = ExtResource("1_e6233") script = ExtResource("1_sf4l8")
group = &"player" group = &"player"
output_var = "target" output_var = "target"
@ -36,7 +36,7 @@ custom_name = "Pause before action"
children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8"), SubResource("BTAction_ulbrf")] children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8"), SubResource("BTAction_ulbrf")]
[sub_resource type="BTAction" id="BTAction_85keo"] [sub_resource type="BTAction" id="BTAction_85keo"]
script = ExtResource("2_ifiw3") script = ExtResource("2_5nwkp")
target_var = "target" target_var = "target"
closest_side = true closest_side = true
flank_side = 0 flank_side = 0
@ -54,7 +54,7 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_ygjnc"] [sub_resource type="BTAction" id="BTAction_ygjnc"]
script = ExtResource("3_4bv56") script = ExtResource("3_3tom2")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
@ -67,7 +67,7 @@ custom_name = "Align with player"
children = [SubResource("BTAction_85keo"), SubResource("BTPlayAnimation_olf37"), SubResource("BTTimeLimit_xek5v")] children = [SubResource("BTAction_85keo"), SubResource("BTPlayAnimation_olf37"), SubResource("BTTimeLimit_xek5v")]
[sub_resource type="BTAction" id="BTAction_kidxn"] [sub_resource type="BTAction" id="BTAction_kidxn"]
script = ExtResource("3_ylc6a") script = ExtResource("4_hi228")
target_var = "target" target_var = "target"
[sub_resource type="BTWait" id="BTWait_tadkc"] [sub_resource type="BTWait" id="BTWait_tadkc"]
@ -83,7 +83,7 @@ animation_player = SubResource("BBNode_s8evu")
animation_name = &"attack_1" animation_name = &"attack_1"
[sub_resource type="BTAction" id="BTAction_u22bc"] [sub_resource type="BTAction" id="BTAction_u22bc"]
script = ExtResource("5_1wo58") script = ExtResource("5_fpbac")
force = 1000.0 force = 1000.0
duration = 0.1 duration = 0.1
@ -104,7 +104,7 @@ animation_player = SubResource("BBNode_3oljv")
animation_name = &"attack_2" animation_name = &"attack_2"
[sub_resource type="BTAction" id="BTAction_yuxl3"] [sub_resource type="BTAction" id="BTAction_yuxl3"]
script = ExtResource("5_1wo58") script = ExtResource("5_fpbac")
force = 1000.0 force = 1000.0
duration = 0.1 duration = 0.1
@ -125,7 +125,7 @@ animation_player = SubResource("BBNode_ot40l")
animation_name = &"attack_3" animation_name = &"attack_3"
[sub_resource type="BTAction" id="BTAction_rwp18"] [sub_resource type="BTAction" id="BTAction_rwp18"]
script = ExtResource("5_1wo58") script = ExtResource("5_fpbac")
force = 1000.0 force = 1000.0
duration = 0.1 duration = 0.1

View File

@ -1,11 +1,11 @@
[gd_resource type="BehaviorTree" load_steps=49 format=3 uid="uid://cpcnbi81jqge4"] [gd_resource type="BehaviorTree" load_steps=49 format=3 uid="uid://cpcnbi81jqge4"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_84v18"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_ce4la"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="2_ff2n7"] [ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="2_atyuj"]
[ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="3_ealyw"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="3_3mw7l"]
[ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="4_iaxsb"] [ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="4_6dr32"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="5_u6msy"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="5_dho0d"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="6_jl5ks"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="6_0pfsl"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_8ay3j"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_8ay3j"]
var/speed/name = "speed" var/speed/name = "speed"
@ -35,18 +35,18 @@ trigger_on_failure = true
children = [SubResource("BTSequence_5thv4")] children = [SubResource("BTSequence_5thv4")]
[sub_resource type="BTAction" id="BTAction_ohfp7"] [sub_resource type="BTAction" id="BTAction_ohfp7"]
script = ExtResource("1_84v18") script = ExtResource("1_ce4la")
group = &"player" group = &"player"
output_var = "target" output_var = "target"
[sub_resource type="BTCondition" id="BTCondition_7a5nv"] [sub_resource type="BTCondition" id="BTCondition_7a5nv"]
script = ExtResource("3_ealyw") script = ExtResource("2_atyuj")
distance_min = 50.0 distance_min = 50.0
distance_max = 150.0 distance_max = 150.0
target_var = "target" target_var = "target"
[sub_resource type="BTAction" id="BTAction_ddvrs"] [sub_resource type="BTAction" id="BTAction_ddvrs"]
script = ExtResource("2_ff2n7") script = ExtResource("3_3mw7l")
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_c4nfu"] [sub_resource type="BBNode" id="BBNode_c4nfu"]
@ -68,13 +68,13 @@ custom_name = "Melee"
children = [SubResource("BTAction_ohfp7"), SubResource("BTCondition_7a5nv"), SubResource("BTAction_ddvrs"), SubResource("BTCooldown_ejg6q")] children = [SubResource("BTAction_ohfp7"), SubResource("BTCondition_7a5nv"), SubResource("BTAction_ddvrs"), SubResource("BTCooldown_ejg6q")]
[sub_resource type="BTCondition" id="BTCondition_h75v8"] [sub_resource type="BTCondition" id="BTCondition_h75v8"]
script = ExtResource("3_ealyw") script = ExtResource("2_atyuj")
distance_min = 0.0 distance_min = 0.0
distance_max = 300.0 distance_max = 300.0
target_var = "target" target_var = "target"
[sub_resource type="BTAction" id="BTAction_wpt7j"] [sub_resource type="BTAction" id="BTAction_wpt7j"]
script = ExtResource("2_ff2n7") script = ExtResource("3_3mw7l")
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_iv62h"] [sub_resource type="BBNode" id="BBNode_iv62h"]
@ -88,7 +88,7 @@ blend = 0.1
speed = -1.0 speed = -1.0
[sub_resource type="BTAction" id="BTAction_h2efl"] [sub_resource type="BTAction" id="BTAction_h2efl"]
script = ExtResource("4_iaxsb") script = ExtResource("4_6dr32")
speed_var = "speed" speed_var = "speed"
max_angle_deviation = 0.7 max_angle_deviation = 0.7
@ -113,7 +113,7 @@ animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_4mmh0"] [sub_resource type="BTAction" id="BTAction_4mmh0"]
script = ExtResource("5_u6msy") script = ExtResource("5_dho0d")
target_var = "target" target_var = "target"
closest_side = false closest_side = false
flank_side = 0 flank_side = 0
@ -122,7 +122,7 @@ range_max = 700
position_var = "pos" position_var = "pos"
[sub_resource type="BTAction" id="BTAction_vb5c3"] [sub_resource type="BTAction" id="BTAction_vb5c3"]
script = ExtResource("6_jl5ks") script = ExtResource("6_0pfsl")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
@ -134,7 +134,7 @@ children = [SubResource("BTAction_vb5c3")]
custom_name = "Short break before action" custom_name = "Short break before action"
[sub_resource type="BTAction" id="BTAction_fkevy"] [sub_resource type="BTAction" id="BTAction_fkevy"]
script = ExtResource("2_ff2n7") script = ExtResource("3_3mw7l")
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_lh25u"] [sub_resource type="BBNode" id="BBNode_lh25u"]

View File

@ -78,4 +78,3 @@ func _on_agent_selection_id_pressed(id: int) -> void:
agent_selection.text = bt_player.behavior_tree.resource_path.get_file() agent_selection.text = bt_player.behavior_tree.resource_path.get_file()
previous.disabled = id == 0 previous.disabled = id == 0
next.disabled = id == 8 next.disabled = id == 8

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://b3ae14mc2ty3y"] [gd_scene load_steps=11 format=3 uid="uid://b3ae14mc2ty3y"]
[ext_resource type="Script" path="res://demo/scenes/agent_showcase.gd" id="1_frr2n"] [ext_resource type="Script" path="res://demo/scenes/agent_showcase.gd" id="1_frr2n"]
[ext_resource type="Theme" uid="uid://boqtjf88xcpu4" path="res://demo/assets/ui.theme" id="2_hb4lh"] [ext_resource type="Theme" uid="uid://boqtjf88xcpu4" path="res://demo/assets/ui.theme" id="2_hb4lh"]
@ -6,6 +6,7 @@
[ext_resource type="FontFile" uid="uid://d25vkmce7mhlt" path="res://demo/assets/fonts/knewave_regular.ttf" id="4_tju7a"] [ext_resource type="FontFile" uid="uid://d25vkmce7mhlt" path="res://demo/assets/fonts/knewave_regular.ttf" id="4_tju7a"]
[ext_resource type="FontFile" uid="uid://n231m6uqsq6x" path="res://demo/assets/fonts/junction_bold.otf" id="5_0fprc"] [ext_resource type="FontFile" uid="uid://n231m6uqsq6x" path="res://demo/assets/fonts/junction_bold.otf" id="5_0fprc"]
[ext_resource type="PackedScene" uid="uid://bsig1usigbbuy" path="res://demo/scenes/arena.tscn" id="6_6awy2"] [ext_resource type="PackedScene" uid="uid://bsig1usigbbuy" path="res://demo/scenes/arena.tscn" id="6_6awy2"]
[ext_resource type="Script" path="res://demo/scenes/toggle_fullscreen.gd" id="6_y6c7b"]
[ext_resource type="PackedScene" uid="uid://c5fhe3tulhlco" path="res://demo/props/dummy.tscn" id="7_ao7an"] [ext_resource type="PackedScene" uid="uid://c5fhe3tulhlco" path="res://demo/props/dummy.tscn" id="7_ao7an"]
[sub_resource type="LabelSettings" id="LabelSettings_3uhve"] [sub_resource type="LabelSettings" id="LabelSettings_3uhve"]
@ -147,6 +148,18 @@ label_settings = SubResource("LabelSettings_la4ui")
horizontal_alignment = 2 horizontal_alignment = 2
vertical_alignment = 1 vertical_alignment = 1
[node name="ToggleFullscreen" type="Button" parent="UI Layer/Control"]
layout_mode = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 120.0
offset_bottom = 53.0
focus_mode = 0
theme_override_fonts/font = ExtResource("4_tju7a")
theme_override_font_sizes/font_size = 22
text = "Toggle Fullscreen"
script = ExtResource("6_y6c7b")
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(400, 0) position = Vector2(400, 0)
zoom = Vector2(0.88, 0.88) zoom = Vector2(0.88, 0.88)

View File

@ -0,0 +1,12 @@
extends Button
func _ready() -> void:
pressed.connect(_toggle_fullscreen)
func _toggle_fullscreen() -> void:
if get_window().mode != Window.MODE_FULLSCREEN:
get_window().mode = Window.MODE_FULLSCREEN
else:
get_window().mode = Window.MODE_WINDOWED