فهرست منبع

finalize experiments, update illustrations

Khemin 7 ماه پیش
والد
کامیت
7e83f25f3f
60فایلهای تغییر یافته به همراه1850 افزوده شده و 3091 حذف شده
  1. 0 606
      Godot Exploration - 2d/BouncingBalls/sc_semantics.tscn40879525.tmp
  2. 13 0
      Godot Exploration - 2d/Platooning/Communication/Communicator.tscn
  3. 18 9
      Godot Exploration - 2d/Platooning/communicator.gd
  4. 0 0
      Godot Exploration - 2d/Platooning/Communication/communication_channel.gd.uid
  5. 20 20
      Godot Exploration - 2d/Platooning/communicator.tscn
  6. 5 0
      Godot Exploration - 2d/Platooning/Communication/communicator.gd
  7. 1 0
      Godot Exploration - 2d/Platooning/Communication/communicator.gd.uid
  8. 19 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_leader_world.gd
  9. 1 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_leader_world.gd.uid
  10. 52 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_leader_world.tscn
  11. 24 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.gd
  12. 1 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.gd.uid
  13. 44 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.tscn
  14. 29 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.tscn2291713166.tmp
  15. 2 15
      Godot Exploration - 2d/Platooning/platoon_test_world.gd
  16. 0 0
      Godot Exploration - 2d/Platooning/Scenarios/platoon_team_world.gd.uid
  17. 4 3
      Godot Exploration - 2d/Platooning/platoon_test_world.tscn
  18. 0 0
      Godot Exploration - 2d/Platooning/Scenarios/screenshot_map.tscn
  19. 49 0
      Godot Exploration - 2d/Platooning/StrategicDeciders/scout_strategy.gd
  20. 1 0
      Godot Exploration - 2d/Platooning/StrategicDeciders/scout_strategy.gd.uid
  21. 80 0
      Godot Exploration - 2d/Platooning/StrategicDeciders/scout_strategy.tscn
  22. 111 0
      Godot Exploration - 2d/Platooning/leader.gd
  23. 1 0
      Godot Exploration - 2d/Platooning/leader.gd.uid
  24. 143 0
      Godot Exploration - 2d/Platooning/leader.tscn
  25. 0 0
      Godot Exploration - 2d/Platooning/misc/regroup_point.gd
  26. 0 0
      Godot Exploration - 2d/Platooning/misc/regroup_point.gd.uid
  27. 1 1
      Godot Exploration - 2d/Platooning/regroup_point.tscn
  28. 190 0
      Godot Exploration - 2d/Platooning/pawn.gd
  29. 1 0
      Godot Exploration - 2d/Platooning/pawn.gd.uid
  30. 122 0
      Godot Exploration - 2d/Platooning/pawn.tscn
  31. 148 0
      Godot Exploration - 2d/Platooning/scout.gd
  32. 1 0
      Godot Exploration - 2d/Platooning/scout.gd.uid
  33. 112 0
      Godot Exploration - 2d/Platooning/scout.tscn
  34. 37 0
      Godot Exploration - 2d/examples/lightswitch.tscn
  35. 0 2057
      Godot Exploration - 2d/mai3398.tmp
  36. 0 73
      Godot Exploration - 2d/mai9D09.tmp
  37. 0 65
      Godot Exploration - 2d/maiCAD6.tmp
  38. 0 65
      Godot Exploration - 2d/maiEAB1.tmp
  39. 0 58
      Godot Exploration - 2d/main.tscn1047157524.tmp
  40. 0 58
      Godot Exploration - 2d/main.tscn1119918514.tmp
  41. 0 57
      Godot Exploration - 2d/main.tscn5454769972.tmp
  42. 0 0
      Godot Exploration - 2d/semantic_testing/sc_semantics.gd
  43. 0 0
      Godot Exploration - 2d/semantic_testing/sc_semantics.gd.uid
  44. 3 3
      Godot Exploration - 2d/BouncingBalls/sc_semantics.tscn
  45. 0 0
      Godot Exploration - 2d/semantic_testing/semantics_test.gd
  46. 0 0
      Godot Exploration - 2d/semantic_testing/semantics_test.gd.uid
  47. 1 1
      Godot Exploration - 2d/BouncingBalls/semantics_tests.tscn
  48. 616 0
      illustrations/drawio/SemanticTesting.drawio
  49. BIN
      illustrations/images/BigStepMaximality-original.PNG
  50. BIN
      illustrations/images/ComboStepMaximality-original.PNG
  51. BIN
      illustrations/images/GodotCodingExample.PNG
  52. BIN
      illustrations/images/GodotEnvironment.PNG
  53. BIN
      illustrations/images/InputEventLifeLine.PNG
  54. BIN
      illustrations/images/InputEventLifeline-original.PNG
  55. BIN
      illustrations/images/InternalEventLifeline-original.PNG
  56. BIN
      illustrations/images/LayersOfAbstraction.PNG
  57. BIN
      illustrations/images/coord_exp_quadrant.PNG
  58. BIN
      illustrations/images/lightswitch_example.PNG
  59. BIN
      illustrations/images/lightswitch_example_godot.PNG
  60. BIN
      illustrations/images/semantic_output.PNG

+ 0 - 606
Godot Exploration - 2d/BouncingBalls/sc_semantics.tscn40879525.tmp

@@ -1,606 +0,0 @@
-[gd_scene load_steps=48 format=3 uid="uid://dpw4gqwmpfe5e"]
-
-[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="1_0ag1n"]
-[ext_resource type="Script" uid="uid://cl75pkl5l8lau" path="res://BouncingBalls/sc_semantics.gd" id="1_7xljh"]
-[ext_resource type="Script" uid="uid://dtlmgewt76wtf" path="res://addons/godot_state_charts/parallel_state.gd" id="2_7xljh"]
-[ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="2_umojb"]
-[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="3_umojb"]
-[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="4_1iswr"]
-[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="5_ploh2"]
-[ext_resource type="Script" uid="uid://cgpbecy3dmigh" path="res://addons/godot_state_charts/expression_guard.gd" id="7_7xljh"]
-[ext_resource type="Script" uid="uid://c41gily0vosn7" path="res://addons/godot_state_charts/guard.gd" id="8_kkye2"]
-[ext_resource type="Script" uid="uid://bpmcjqjecisib" path="res://addons/godot_state_charts/state_is_active_guard.gd" id="9_g1l08"]
-[ext_resource type="Script" uid="uid://j83wx22slqlm" path="res://addons/godot_state_charts/not_guard.gd" id="10_8bunp"]
-[ext_resource type="Script" uid="uid://pw277ma67hja" path="res://addons/godot_state_charts/all_of_guard.gd" id="11_yttom"]
-
-[sub_resource type="Resource" id="Resource_ggnlb"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../RegionReceive1/GotEvent")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_8t620"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../RegionReceive2/GotEvent")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_fsrxh"]
-script = ExtResource("10_8bunp")
-guard = SubResource("Resource_8t620")
-metadata/_custom_type_script = "uid://j83wx22slqlm"
-
-[sub_resource type="Resource" id="Resource_seyq0"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_ggnlb"), SubResource("Resource_fsrxh")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_plpm3"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../RegionReceive1/GotEvent")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_lya64"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../RegionReceive2/GotEvent")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_olyqa"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_plpm3"), SubResource("Resource_lya64")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_kkye2"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../RegionReceive1/GotEvent")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_g1l08"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../RegionReceive2/GotEvent")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_8bunp"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_kkye2"), SubResource("Resource_g1l08")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_umojb"]
-script = ExtResource("7_7xljh")
-expression = "x == 1"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_1iswr"]
-script = ExtResource("7_7xljh")
-expression = "x == 0"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_7xljh"]
-script = ExtResource("7_7xljh")
-expression = "x == 1"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_yttom"]
-script = ExtResource("7_7xljh")
-expression = "x==0"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_ybjrp"]
-script = ExtResource("7_7xljh")
-expression = "x==0"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_1yp0e"]
-script = ExtResource("7_7xljh")
-expression = "x==1"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_kcoy7"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../../MemoryProtocol/MemoryProtocol/ComboStep")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_0ryux"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../MemoryProtocolDeducer/TakeOne")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_gcgaa"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_1yp0e"), SubResource("Resource_kcoy7"), SubResource("Resource_0ryux")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_x6ssm"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../../InputEventLifeline/FirstComboStep")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_lnngb"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../InputEventDeducer/TakeOne")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_tk11p"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_x6ssm"), SubResource("Resource_lnngb")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_pwu1q"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../../InternalEventLifeline/InternalEventLifeline/NextComboStep")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_w3bnh"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../InternalEventDeducer/TakeOne")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_7132v"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_pwu1q"), SubResource("Resource_w3bnh")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_mxhyw"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../../InputEventLifeline/FirstComboStep")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_8epgs"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../InputEventDeducer/TakeMany")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_ugi1x"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_mxhyw"), SubResource("Resource_8epgs")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_d1k7b"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../../InternalEventLifeline/InternalEventLifeline/NextComboStep")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_tav7g"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../InternalEventDeducer/TakeMany")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_dy56r"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_d1k7b"), SubResource("Resource_tav7g")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[sub_resource type="Resource" id="Resource_ettqd"]
-script = ExtResource("7_7xljh")
-expression = "x==1"
-metadata/_custom_type_script = "uid://cgpbecy3dmigh"
-
-[sub_resource type="Resource" id="Resource_75830"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../../MemoryProtocol/MemoryProtocol/ComboStep")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_1wlx4"]
-script = ExtResource("9_g1l08")
-state = NodePath("../../../MemoryProtocolDeducer/TakeMany")
-metadata/_custom_type_script = "uid://bpmcjqjecisib"
-
-[sub_resource type="Resource" id="Resource_avby4"]
-script = ExtResource("11_yttom")
-guards = Array[ExtResource("8_kkye2")]([SubResource("Resource_ettqd"), SubResource("Resource_75830"), SubResource("Resource_1wlx4")])
-metadata/_custom_type_script = "uid://pw277ma67hja"
-
-[node name="SC_semantics" type="Node2D"]
-script = ExtResource("1_7xljh")
-
-[node name="StateChartDebugger" parent="." instance=ExtResource("2_umojb")]
-offset_left = -685.0
-offset_top = -476.0
-offset_right = 690.0
-offset_bottom = 464.0
-size_flags_horizontal = 4
-size_flags_vertical = 4
-initial_node_to_watch = NodePath("../StateChart")
-
-[node name="StateChart" type="Node" parent="."]
-script = ExtResource("1_0ag1n")
-metadata/_custom_type_script = "uid://cau6j0o0julfq"
-
-[node name="ParallelState" type="Node" parent="StateChart"]
-script = ExtResource("2_7xljh")
-metadata/_custom_type_script = "uid://dtlmgewt76wtf"
-
-[node name="BigStepMaximality" type="Node" parent="StateChart/ParallelState"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/BigStepMaximality"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/BigStepMaximality/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-delay_in_seconds = "0.0"
-
-[node name="TakeOne" type="Node" parent="StateChart/ParallelState/BigStepMaximality"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/BigStepMaximality/TakeOne"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-delay_in_seconds = "0.0"
-
-[node name="TakeMany" type="Node" parent="StateChart/ParallelState/BigStepMaximality"]
-script = ExtResource("4_1iswr")
-
-[node name="InputEventLifeline" type="Node" parent="StateChart/ParallelState"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("FirstSmallStep")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="FirstSmallStep" type="Node" parent="StateChart/ParallelState/InputEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/InputEventLifeline/FirstSmallStep"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../FirstComboStep")
-event = &"input0"
-delay_in_seconds = "0.0"
-
-[node name="FirstComboStep" type="Node" parent="StateChart/ParallelState/InputEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/InputEventLifeline/FirstComboStep"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../Whole")
-event = &"input0"
-delay_in_seconds = "0.0"
-
-[node name="Whole" type="Node" parent="StateChart/ParallelState/InputEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="InternalEventLifeline" type="Node" parent="StateChart/ParallelState"]
-script = ExtResource("2_7xljh")
-metadata/_custom_type_script = "uid://dtlmgewt76wtf"
-
-[node name="RegionReceive1" type="Node" parent="StateChart/ParallelState/InternalEventLifeline"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionReceive1"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionReceive1/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../GotEvent")
-event = &"internal0"
-delay_in_seconds = "0.0"
-
-[node name="GotEvent" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionReceive1"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="RegionBroadcast" type="Node" parent="StateChart/ParallelState/InternalEventLifeline"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionBroadcast"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="internal_broadcast" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionBroadcast/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../Done")
-delay_in_seconds = "0.0"
-
-[node name="Done" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionBroadcast"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="RegionReceive2" type="Node" parent="StateChart/ParallelState/InternalEventLifeline"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionReceive2"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionReceive2/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../GotEvent")
-event = &"internal0"
-delay_in_seconds = "0.0"
-
-[node name="GotEvent" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/RegionReceive2"]
-script = ExtResource("4_1iswr")
-
-[node name="InternalEventLifeline" type="Node" parent="StateChart/ParallelState/InternalEventLifeline"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../NextSmallStep")
-guard = SubResource("Resource_seyq0")
-delay_in_seconds = "0.0"
-
-[node name="Transition2" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../Remainder")
-guard = SubResource("Resource_olyqa")
-delay_in_seconds = "0.0"
-
-[node name="Transition3" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../Queue")
-delay_in_seconds = "0.0"
-
-[node name="NextSmallStep" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="Remainder" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="Queue" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline/Queue"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../NextComboStep")
-guard = SubResource("Resource_8bunp")
-delay_in_seconds = "0.0"
-
-[node name="NextComboStep" type="Node" parent="StateChart/ParallelState/InternalEventLifeline/InternalEventLifeline"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="MemoryProtocol" type="Node" parent="StateChart/ParallelState"]
-script = ExtResource("2_7xljh")
-
-[node name="RegionAssign" type="Node" parent="StateChart/ParallelState/MemoryProtocol"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/MemoryProtocol/RegionAssign"]
-script = ExtResource("4_1iswr")
-
-[node name="assign_x" type="Node" parent="StateChart/ParallelState/MemoryProtocol/RegionAssign/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../Assigned")
-delay_in_seconds = "0.0"
-
-[node name="Assigned" type="Node" parent="StateChart/ParallelState/MemoryProtocol/RegionAssign"]
-script = ExtResource("4_1iswr")
-
-[node name="MemoryProtocol" type="Node" parent="StateChart/ParallelState/MemoryProtocol"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../SmallStep")
-guard = SubResource("Resource_umojb")
-delay_in_seconds = "0.0"
-
-[node name="Transition2" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../BigStep")
-guard = SubResource("Resource_1iswr")
-delay_in_seconds = "0.0"
-
-[node name="SmallStep" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol"]
-script = ExtResource("4_1iswr")
-
-[node name="BigStep" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol/BigStep"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../ComboStep")
-guard = SubResource("Resource_7xljh")
-delay_in_seconds = "0.0"
-
-[node name="ComboStep" type="Node" parent="StateChart/ParallelState/MemoryProtocol/MemoryProtocol"]
-script = ExtResource("4_1iswr")
-
-[node name="Priority" type="Node" parent="StateChart/ParallelState"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Composite")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Composite" type="Node" parent="StateChart/ParallelState/Priority"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Basic")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Basic" type="Node" parent="StateChart/ParallelState/Priority/Composite"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/Priority/Composite/Basic"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../../SourceChild")
-delay_in_seconds = "0.0"
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/Priority/Composite"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../SourceParent")
-delay_in_seconds = "0.0"
-
-[node name="SourceParent" type="Node" parent="StateChart/ParallelState/Priority"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="SourceChild" type="Node" parent="StateChart/ParallelState/Priority"]
-script = ExtResource("4_1iswr")
-
-[node name="ComboStepMaximality" type="Node" parent="StateChart/ParallelState"]
-script = ExtResource("2_7xljh")
-metadata/_custom_type_script = "uid://dtlmgewt76wtf"
-
-[node name="InputEventDeducer" type="Node" parent="StateChart/ParallelState/ComboStepMaximality"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InputEventDeducer"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InputEventDeducer/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-event = &"input0"
-delay_in_seconds = "0.0"
-
-[node name="TakeOne" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InputEventDeducer"]
-script = ExtResource("4_1iswr")
-metadata/_custom_type_script = "uid://dyiggrr357tov"
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InputEventDeducer/TakeOne"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-event = &"input0"
-delay_in_seconds = "0.0"
-
-[node name="TakeMany" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InputEventDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="InternalEventDeducer" type="Node" parent="StateChart/ParallelState/ComboStepMaximality"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InternalEventDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InternalEventDeducer/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-event = &"internal0"
-delay_in_seconds = "0.0"
-
-[node name="TakeOne" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InternalEventDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InternalEventDeducer/TakeOne"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-event = &"internal0"
-delay_in_seconds = "0.0"
-
-[node name="TakeMany" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/InternalEventDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="MemoryProtocolDeducer" type="Node" parent="StateChart/ParallelState/ComboStepMaximality"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("Initial")
-
-[node name="Initial" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/MemoryProtocolDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/MemoryProtocolDeducer/Initial"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-guard = SubResource("Resource_yttom")
-delay_in_seconds = "0.0"
-
-[node name="TakeOne" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/MemoryProtocolDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/MemoryProtocolDeducer/TakeOne"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-guard = SubResource("Resource_ybjrp")
-delay_in_seconds = "0.0"
-
-[node name="TakeMany" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/MemoryProtocolDeducer"]
-script = ExtResource("4_1iswr")
-
-[node name="ComboStepMaximality" type="Node" parent="StateChart/ParallelState/ComboStepMaximality"]
-script = ExtResource("3_umojb")
-initial_state = NodePath("NoComboSteps")
-
-[node name="NoComboSteps" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/NoComboSteps"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-guard = SubResource("Resource_gcgaa")
-delay_in_seconds = "0.0"
-
-[node name="Transition2" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/NoComboSteps"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-guard = SubResource("Resource_tk11p")
-delay_in_seconds = "0.0"
-
-[node name="Transition3" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/NoComboSteps"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeOne")
-guard = SubResource("Resource_7132v")
-delay_in_seconds = "0.0"
-
-[node name="Transition4" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/NoComboSteps"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-guard = SubResource("Resource_ugi1x")
-delay_in_seconds = "0.0"
-
-[node name="Transition5" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/NoComboSteps"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-guard = SubResource("Resource_dy56r")
-delay_in_seconds = "0.0"
-
-[node name="Transition6" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/NoComboSteps"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../TakeMany")
-guard = SubResource("Resource_avby4")
-delay_in_seconds = "0.0"
-
-[node name="TakeOne" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/TakeOne"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../NoComboSteps")
-event = &"input0"
-delay_in_seconds = "0.0"
-
-[node name="Transition2" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/TakeOne"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../NoComboSteps")
-event = &"internal0"
-delay_in_seconds = "0.0"
-
-[node name="TakeMany" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality"]
-script = ExtResource("4_1iswr")
-
-[node name="Transition" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/TakeMany"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../NoComboSteps")
-event = &"input0"
-delay_in_seconds = "0.0"
-
-[node name="Transition2" type="Node" parent="StateChart/ParallelState/ComboStepMaximality/ComboStepMaximality/TakeMany"]
-script = ExtResource("5_ploh2")
-to = NodePath("../../NoComboSteps")
-event = &"internal0"
-delay_in_seconds = "0.0"
-
-[node name="Camera2D" type="Camera2D" parent="."]
-
-[connection signal="state_entered" from="StateChart/ParallelState/InputEventLifeline" to="." method="_on_input_event_lifeline_state_entered"]
-[connection signal="taken" from="StateChart/ParallelState/InternalEventLifeline/RegionBroadcast/Initial/internal_broadcast" to="." method="_on_internal_broadcast_taken"]
-[connection signal="taken" from="StateChart/ParallelState/MemoryProtocol/RegionAssign/Initial/assign_x" to="." method="_on_assign_x_taken"]

+ 13 - 0
Godot Exploration - 2d/Platooning/Communication/Communicator.tscn

@@ -0,0 +1,13 @@
+[gd_scene load_steps=3 format=3 uid="uid://c18kqntm5kf53"]
+
+[ext_resource type="Script" uid="uid://bjl081wbrtwo0" path="res://Platooning/Communication/communicator.gd" id="1_g081f"]
+[ext_resource type="PackedScene" uid="uid://4upow5w6yesc" path="res://Platooning/Communication/communication_channel.tscn" id="2_wqcap"]
+
+[node name="Communicator" type="Node2D"]
+script = ExtResource("1_g081f")
+
+[node name="CommandChannel" parent="." instance=ExtResource("2_wqcap")]
+channel_name = "command"
+
+[node name="DataChannel" parent="." instance=ExtResource("2_wqcap")]
+channel_name = "data"

+ 18 - 9
Godot Exploration - 2d/Platooning/communicator.gd

@@ -1,11 +1,17 @@
 extends Node2D
-class_name Communicator
+class_name CommunicationChannel
 
 signal send(message: Dictionary)
+signal recieve_map(map: Grid2D)
 
-const DELAY: float = 2.0
+signal attack(target: Vector2)
+signal explore
+signal regroup(pos: Vector2)
+
+const DELAY: float = 1.0
 
 @onready var behavior: StateChart = $Behavior
+@export var channel_name: String = "default"
 
 var outgoing: Array = []
 var incoming: Array = []
@@ -14,13 +20,13 @@ func _ready() -> void:
 	self.behavior.set_expression_property.call_deferred("delay", DELAY)
 
 
-# Method to add message to communicators outgoing channel
+# Method to add message to communicators outgoing pool
 func _add_outgoing(message: Dictionary) -> void:
 	self.outgoing.append(message)
 	self.behavior.send_event("send")
 
 
-# Method to add message to communicators incoming channel
+# Method to add message to communicators incoming pool
 func _add_incoming(message: Dictionary) -> void:
 	self.incoming.append(message)
 	self.behavior.send_event("receive")
@@ -38,7 +44,6 @@ func _on_sender_idle_state_entered() -> void:
 func _on_send_state_entered() -> void:
 	var message = self.outgoing.pop_front()
 	self.send.emit(message)
-	
 
 
 #------------------------------------------------------------------------------#
@@ -53,8 +58,12 @@ func _on_receiver_idle_state_entered() -> void:
 func _on_process_state_entered() -> void:
 	var message: Dictionary = self.incoming.pop_front()
 	
-	# TODO implement handler of incoming traffic to send data to appropriate component
+	# Return early if message is not destined for this channel.
+	if message.channel != self.channel_name:
+		return
+	
 	match message.tag:
-		"map": pass
-		"enemy": pass
-		"...": pass
+		"map": self.recieve_map.emit(message.data)
+		"attack": self.attack.emit(message.data)
+		"explore": self.explore.emit()
+		"group": self.regroup.emit(message.data)

Godot Exploration - 2d/Platooning/communicator.gd.uid → Godot Exploration - 2d/Platooning/Communication/communication_channel.gd.uid


+ 20 - 20
Godot Exploration - 2d/Platooning/communicator.tscn

@@ -1,66 +1,66 @@
 [gd_scene load_steps=7 format=3 uid="uid://4upow5w6yesc"]
 
-[ext_resource type="Script" uid="uid://drgnwv3bhm3v2" path="res://Platooning/communicator.gd" id="1_km1ck"]
-[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="2_xwngf"]
-[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="3_5js2r"]
-[ext_resource type="Script" uid="uid://dtlmgewt76wtf" path="res://addons/godot_state_charts/parallel_state.gd" id="3_xwngf"]
-[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="4_j22e8"]
-[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="5_ic1as"]
+[ext_resource type="Script" uid="uid://drgnwv3bhm3v2" path="res://Platooning/Communication/communication_channel.gd" id="1_gn3c7"]
+[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="2_uiui2"]
+[ext_resource type="Script" uid="uid://dtlmgewt76wtf" path="res://addons/godot_state_charts/parallel_state.gd" id="3_qsby1"]
+[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="4_dp7xi"]
+[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="5_c2n2x"]
+[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="6_08wub"]
 
-[node name="Communicator" type="Node2D"]
-script = ExtResource("1_km1ck")
+[node name="CommunicationChannel" type="Node2D"]
+script = ExtResource("1_gn3c7")
 
 [node name="Behavior" type="Node" parent="."]
-script = ExtResource("2_xwngf")
+script = ExtResource("2_uiui2")
 metadata/_custom_type_script = "uid://cau6j0o0julfq"
 
 [node name="Communication" type="Node" parent="Behavior"]
-script = ExtResource("3_xwngf")
+script = ExtResource("3_qsby1")
 metadata/_custom_type_script = "uid://dtlmgewt76wtf"
 
 [node name="Sender" type="Node" parent="Behavior/Communication"]
-script = ExtResource("3_5js2r")
+script = ExtResource("4_dp7xi")
 initial_state = NodePath("Idle")
 metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
 
 [node name="Idle" type="Node" parent="Behavior/Communication/Sender"]
-script = ExtResource("4_j22e8")
+script = ExtResource("5_c2n2x")
 
 [node name="send" type="Node" parent="Behavior/Communication/Sender/Idle"]
-script = ExtResource("5_ic1as")
+script = ExtResource("6_08wub")
 to = NodePath("../../Send")
 event = &"send"
 delay_in_seconds = "delay"
 
 [node name="Send" type="Node" parent="Behavior/Communication/Sender"]
-script = ExtResource("4_j22e8")
+script = ExtResource("5_c2n2x")
 
 [node name="finish" type="Node" parent="Behavior/Communication/Sender/Send"]
-script = ExtResource("5_ic1as")
+script = ExtResource("6_08wub")
 to = NodePath("../../Idle")
 delay_in_seconds = "0.0"
 
 [node name="Receiver" type="Node" parent="Behavior/Communication"]
-script = ExtResource("3_5js2r")
+script = ExtResource("4_dp7xi")
 initial_state = NodePath("Idle")
 metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
 
 [node name="Idle" type="Node" parent="Behavior/Communication/Receiver"]
-script = ExtResource("4_j22e8")
+script = ExtResource("5_c2n2x")
 metadata/_custom_type_script = "uid://dyiggrr357tov"
 
 [node name="receive" type="Node" parent="Behavior/Communication/Receiver/Idle"]
-script = ExtResource("5_ic1as")
+script = ExtResource("6_08wub")
 to = NodePath("../../Process")
 event = &"receive"
 delay_in_seconds = "0.0"
 
 [node name="Process" type="Node" parent="Behavior/Communication/Receiver"]
-script = ExtResource("4_j22e8")
+script = ExtResource("5_c2n2x")
 metadata/_custom_type_script = "uid://dyiggrr357tov"
 
 [node name="finish" type="Node" parent="Behavior/Communication/Receiver/Process"]
-script = ExtResource("5_ic1as")
+script = ExtResource("6_08wub")
 to = NodePath("../../Idle")
 delay_in_seconds = "0.0"
 

+ 5 - 0
Godot Exploration - 2d/Platooning/Communication/communicator.gd

@@ -0,0 +1,5 @@
+extends Node2D
+class_name Communicator
+
+@onready var command_channel: CommunicationChannel = $CommandChannel
+@onready var data_channel: CommunicationChannel = $DataChannel

+ 1 - 0
Godot Exploration - 2d/Platooning/Communication/communicator.gd.uid

@@ -0,0 +1 @@
+uid://bjl081wbrtwo0

+ 19 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_leader_world.gd

@@ -0,0 +1,19 @@
+extends PlatoonTestInstance
+class_name PlatoonLeaderInstance
+
+
+func _ready() -> void:
+	# Set up safe point information and establish communication between leader and teammates
+	for child in self.get_children():
+		if child is PlayerLeader:
+			for other in self.get_children():
+				if other is Pawn and other.get_team() == child.get_team():
+					other.communicator.data_channel.send.connect(child.communicator.data_channel._add_incoming)
+					child.communicator.command_channel.send.connect(other.communicator.command_channel._add_incoming)
+				if other is RegroupPoint and other.get_team() == child.get_team():
+					child.set_safe_point(other.global_position)
+		
+		if child is Scout:
+			for other in self.get_children():
+				if other is RegroupPoint and child.get_team() == other.get_team():
+					child.scout_strategy.set_safe_point(other.global_position)

+ 1 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_leader_world.gd.uid

@@ -0,0 +1 @@
+uid://sejt56l4p1y0

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 52 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_leader_world.tscn


+ 24 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.gd

@@ -0,0 +1,24 @@
+extends Node2D
+class_name PlatoonTestInstance
+
+@export var TILE_SIZE: int = 64
+@onready var area: CollisionShape2D = $Bounds/area
+
+
+func _ready() -> void:
+	# Set up safe point information
+	for child in self.get_children():
+		if child is Scout:
+			for other in self.get_children():
+				if other is RegroupPoint and child.get_team() == other.get_team():
+					child.scout_strategy.set_safe_point(other.global_position)
+
+
+func get_map_dimensions() -> Dictionary:
+	var dimensions: Dictionary = {}
+	
+	dimensions["size"] = area.get_shape().get_rect().size
+	dimensions["tile_size"] = TILE_SIZE
+	dimensions["instance_offset"] = position
+	
+	return dimensions

+ 1 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.gd.uid

@@ -0,0 +1 @@
+uid://dcwlifop1eca1

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 44 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.tscn


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 29 - 0
Godot Exploration - 2d/Platooning/Scenarios/platoon_scout_world.tscn2291713166.tmp


+ 2 - 15
Godot Exploration - 2d/Platooning/platoon_test_world.gd

@@ -1,8 +1,5 @@
-extends Node2D
-class_name PlatoonTestInstance
-
-@export var TILE_SIZE: int = 64
-@onready var area: CollisionShape2D = $Bounds/area
+extends PlatoonTestInstance
+class_name PlatoonTeamInstance
 
 
 func _ready() -> void:
@@ -17,13 +14,3 @@ func _ready() -> void:
 					child.group_planner.reached_regroup.connect(other._request_group)
 					other.group.connect(child.infantry_strategy._on_team_group)
 					other.explore.connect(child.infantry_strategy._on_team_explore)
-
-
-func get_map_dimensions() -> Dictionary:
-	var dimensions: Dictionary = {}
-	
-	dimensions["size"] = area.get_shape().get_rect().size
-	dimensions["tile_size"] = TILE_SIZE
-	dimensions["instance_offset"] = position
-	
-	return dimensions

Godot Exploration - 2d/Platooning/platoon_test_world.gd.uid → Godot Exploration - 2d/Platooning/Scenarios/platoon_team_world.gd.uid


+ 4 - 3
Godot Exploration - 2d/Platooning/platoon_test_world.tscn

@@ -1,14 +1,14 @@
 [gd_scene load_steps=6 format=4 uid="uid://htfwsxicdhip"]
 
-[ext_resource type="Script" uid="uid://bmuinyb4rfcut" path="res://Platooning/platoon_test_world.gd" id="1_ahheq"]
+[ext_resource type="Script" uid="uid://bmuinyb4rfcut" path="res://Platooning/Scenarios/platoon_team_world.gd" id="1_ahheq"]
 [ext_resource type="TileSet" uid="uid://d02nybfepnuiw" path="res://assets/tilesets/main_tileset.tres" id="2_qyuao"]
 [ext_resource type="PackedScene" uid="uid://blmnl0b0h0tu0" path="res://Platooning/infantry.tscn" id="3_a4rne"]
-[ext_resource type="PackedScene" uid="uid://dcu7do534160e" path="res://Platooning/regroup_point.tscn" id="4_kwdou"]
+[ext_resource type="PackedScene" uid="uid://dcu7do534160e" path="res://Platooning/misc/regroup_point.tscn" id="4_kwdou"]
 
 [sub_resource type="RectangleShape2D" id="RectangleShape2D_msrlr"]
 size = Vector2(2560, 1440)
 
-[node name="PlatoonTestWorld" type="Node2D"]
+[node name="PlatoonTeamWorld" type="Node2D"]
 script = ExtResource("1_ahheq")
 
 [node name="TileMapLayer" type="TileMapLayer" parent="."]
@@ -49,6 +49,7 @@ rotation = -3.1238
 TEAM = "ENEMY"
 
 [node name="EnemyPoint" parent="." instance=ExtResource("4_kwdou")]
+modulate = Color(1, 0, 0.623529, 1)
 position = Vector2(1310, 1181)
 rotation = -0.000539899
 _team = "ENEMY"

Godot Exploration - 2d/Platooning/screenshot_map.tscn → Godot Exploration - 2d/Platooning/Scenarios/screenshot_map.tscn


+ 49 - 0
Godot Exploration - 2d/Platooning/StrategicDeciders/scout_strategy.gd

@@ -0,0 +1,49 @@
+extends Node2D
+class_name ScoutStrategy
+
+signal attack
+signal explore
+signal new_destination(pos: Vector2)
+
+var safe_point: Vector2 = Vector2(0, 0)
+@onready var behavior: StateChart = $Behavior
+
+
+func set_safe_point(pos: Vector2) -> void:
+	self.safe_point = pos
+
+
+#-----------------------------------------------------------------------------#
+# Explore State
+func _on_exploring_state_entered() -> void:
+	self.explore.emit()
+
+
+# Callable to connect to EnemyTracker's enemy_position_known signal
+func _on_enemy_tracker_enemy_position_known() -> void:
+	self.behavior.send_event("attack")
+
+
+#-----------------------------------------------------------------------------#
+# Attack State
+func _on_attacking_state_entered() -> void:
+	self.attack.emit()
+
+
+#Callable to connect to EnemyTracker's enemy_position_unsure signal
+func _on_enemy_tracker_enemy_position_unsure() -> void:
+	self.behavior.send_event("enemy_lost")
+
+
+#-----------------------------------------------------------------------------#
+# NormalOperation State
+
+# Callable to connect to danger signal
+func _on_enemy_danger() -> void:
+	self.behavior.send_event("flee")
+
+
+#-----------------------------------------------------------------------------#
+# Fleeing State
+func _on_fleeing_state_entered() -> void:
+	self.new_destination.emit(self.safe_point)

+ 1 - 0
Godot Exploration - 2d/Platooning/StrategicDeciders/scout_strategy.gd.uid

@@ -0,0 +1 @@
+uid://g6pnxgt6atry

+ 80 - 0
Godot Exploration - 2d/Platooning/StrategicDeciders/scout_strategy.tscn

@@ -0,0 +1,80 @@
+[gd_scene load_steps=6 format=3 uid="uid://ccom8jmnsbdwc"]
+
+[ext_resource type="Script" uid="uid://g6pnxgt6atry" path="res://Platooning/StrategicDeciders/scout_strategy.gd" id="1_6hbv3"]
+[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="2_s0aaa"]
+[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="3_oaadw"]
+[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="4_32tjx"]
+[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="5_dgok2"]
+
+[node name="ScoutStrategy" type="Node2D"]
+script = ExtResource("1_6hbv3")
+
+[node name="Behavior" type="Node" parent="."]
+script = ExtResource("2_s0aaa")
+metadata/_custom_type_script = "uid://cau6j0o0julfq"
+
+[node name="ScoutStrategy" type="Node" parent="Behavior"]
+script = ExtResource("3_oaadw")
+initial_state = NodePath("NormalOperation")
+metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
+
+[node name="NormalOperation" type="Node" parent="Behavior/ScoutStrategy"]
+script = ExtResource("3_oaadw")
+initial_state = NodePath("Exploring")
+metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
+
+[node name="Exploring" type="Node" parent="Behavior/ScoutStrategy/NormalOperation"]
+script = ExtResource("4_32tjx")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="attack" type="Node" parent="Behavior/ScoutStrategy/NormalOperation/Exploring"]
+script = ExtResource("5_dgok2")
+to = NodePath("../../Attacking")
+event = &"attack"
+delay_in_seconds = "0.0"
+
+[node name="Attacking" type="Node" parent="Behavior/ScoutStrategy/NormalOperation"]
+script = ExtResource("4_32tjx")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="enemy_lost" type="Node" parent="Behavior/ScoutStrategy/NormalOperation/Attacking"]
+script = ExtResource("5_dgok2")
+to = NodePath("../../Waiting")
+event = &"enemy_lost"
+delay_in_seconds = "0.0"
+
+[node name="Waiting" type="Node" parent="Behavior/ScoutStrategy/NormalOperation"]
+script = ExtResource("4_32tjx")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="enemy_found" type="Node" parent="Behavior/ScoutStrategy/NormalOperation/Waiting"]
+script = ExtResource("5_dgok2")
+to = NodePath("../../Attacking")
+event = &"attack"
+delay_in_seconds = "0.0"
+
+[node name="stop" type="Node" parent="Behavior/ScoutStrategy/NormalOperation/Waiting"]
+script = ExtResource("5_dgok2")
+to = NodePath("../../Exploring")
+delay_in_seconds = "5.0"
+
+[node name="flee" type="Node" parent="Behavior/ScoutStrategy/NormalOperation"]
+script = ExtResource("5_dgok2")
+to = NodePath("../../Fleeing")
+event = &"flee"
+delay_in_seconds = "0.0"
+
+[node name="Fleeing" type="Node" parent="Behavior/ScoutStrategy"]
+script = ExtResource("4_32tjx")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="escaped" type="Node" parent="Behavior/ScoutStrategy/Fleeing"]
+script = ExtResource("5_dgok2")
+to = NodePath("../../NormalOperation")
+delay_in_seconds = "10.0"
+
+[connection signal="state_processing" from="Behavior/ScoutStrategy/NormalOperation" to="." method="_on_normal_operation_state_processing"]
+[connection signal="state_entered" from="Behavior/ScoutStrategy/NormalOperation/Exploring" to="." method="_on_exploring_state_entered"]
+[connection signal="taken" from="Behavior/ScoutStrategy/NormalOperation/Exploring/attack" to="." method="_on_regroup_taken"]
+[connection signal="state_entered" from="Behavior/ScoutStrategy/NormalOperation/Attacking" to="." method="_on_attacking_state_entered"]
+[connection signal="state_entered" from="Behavior/ScoutStrategy/Fleeing" to="." method="_on_fleeing_state_entered"]

+ 111 - 0
Godot Exploration - 2d/Platooning/leader.gd

@@ -0,0 +1,111 @@
+extends CharacterBody2D
+class_name PlayerLeader
+
+var SPEED: int = 200
+
+@export var _team: String = "ALLY"
+
+@onready var behavior: StateChart = $Behavior
+@onready var communicator: Communicator = $Communicator
+@onready var obstacle_map: ObstacleMap = $ObstacleMap
+@onready var indicator_label: Label = $CanvasLayer/Indicator/IndicatorLabel
+
+var safe_point: Vector2 = Vector2(0, 0)
+var _map_initialized: bool = false
+
+
+func set_safe_point(pos: Vector2) -> void:
+	self.safe_point = pos
+
+func get_team() -> String:
+	return self._team
+
+func _on_receive_map(map: Grid2D) -> void:
+	self.obstacle_map.compare_map(map)
+
+func _ready() -> void:
+	self.communicator.data_channel.recieve_map.connect(self._on_receive_map)
+
+func _input(event: InputEvent) -> void:
+	if event.is_action_pressed("sprint"):
+		self.SPEED += 100
+	if event.is_action_released("sprint"):
+		self.SPEED -= 100
+	
+	if event.is_action_pressed("group"):
+		self.behavior.send_event("group")
+	
+	if event.is_action_pressed("attack"):
+		self.behavior.send_event("attack")
+	
+	if event.is_action_pressed("explore"):
+		self.behavior.send_event("explore")
+
+func _process(delta: float) -> void:
+	self.look_at(get_global_mouse_position())
+	
+	var horizontal := Input.get_axis("left", "right")
+	var vertical := Input.get_axis("up", "down")
+	
+	var move_vector = Vector2(horizontal, vertical)
+	move_vector = move_vector.normalized()
+		
+	self.velocity = move_vector * self.SPEED
+	move_and_slide()
+
+#-----------------------------------------------------------------------------#
+# Commands/Explore State
+func _on_explore_state_entered() -> void:
+	self.indicator_label.text = "Exploring"
+	
+	var message = {
+		"channel": "command",
+		"tag": "explore",
+		"data": null
+	}
+	
+	self.communicator.command_channel._add_outgoing(message)
+
+
+#-----------------------------------------------------------------------------#
+# Commands/Attack State
+func _on_attack_state_entered() -> void:
+	self.indicator_label.text = "Select Target"
+
+
+func _on_attack_state_processing(delta: float) -> void:
+	if Input.is_action_just_pressed("LMB"):
+		self.indicator_label.text = "Attacking"
+		
+		var message = {
+			"channel": "command",
+			"tag": "attack",
+			"data": get_global_mouse_position()
+		}
+		
+		self.communicator.command_channel._add_outgoing(message)
+		self.behavior.send_event("end")
+
+
+#-----------------------------------------------------------------------------#
+# Commands/Group State
+func _on_group_state_entered() -> void:
+	self.indicator_label.text = "Regrouping"
+	
+	var message = {
+		"channel": "command",
+		"tag": "group",
+		"data": self.safe_point
+	}
+	
+	self.communicator.command_channel._add_outgoing(message)
+
+
+#-----------------------------------------------------------------------------#
+# Commands/Group State
+func _on_idle_state_entered() -> void:
+	if not self._map_initialized:
+		var world: PlatoonTestInstance = self.get_parent()
+		var dimensions = world.get_map_dimensions()
+		self.obstacle_map.build_empty_map(dimensions)
+		self._map_initialized = true

+ 1 - 0
Godot Exploration - 2d/Platooning/leader.gd.uid

@@ -0,0 +1 @@
+uid://8dk6gdfdimxu

+ 143 - 0
Godot Exploration - 2d/Platooning/leader.tscn

@@ -0,0 +1,143 @@
+[gd_scene load_steps=10 format=3 uid="uid://bb5grkgqlyppc"]
+
+[ext_resource type="Script" uid="uid://8dk6gdfdimxu" path="res://Platooning/leader.gd" id="1_lerld"]
+[ext_resource type="Texture2D" uid="uid://ci5drx8biwvkd" path="res://assets/kenney_top-down-shooter/PNG/leader.png" id="2_56dxl"]
+[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="3_56dxl"]
+[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="4_6e8ak"]
+[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="5_4oxbc"]
+[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="6_ko0ks"]
+[ext_resource type="PackedScene" uid="uid://c18kqntm5kf53" path="res://Platooning/Communication/Communicator.tscn" id="7_56dxl"]
+[ext_resource type="PackedScene" uid="uid://cxa4n46xuic4k" path="res://TankWars/Memorizers/obstacle_map.tscn" id="7_tkcwn"]
+
+[sub_resource type="CircleShape2D" id="CircleShape2D_fc5gf"]
+radius = 23.0
+
+[node name="Leader" type="CharacterBody2D"]
+script = ExtResource("1_lerld")
+
+[node name="sprite" type="Sprite2D" parent="."]
+texture = ExtResource("2_56dxl")
+
+[node name="collision" type="CollisionShape2D" parent="."]
+shape = SubResource("CircleShape2D_fc5gf")
+
+[node name="Behavior" type="Node" parent="."]
+script = ExtResource("3_56dxl")
+metadata/_custom_type_script = "uid://cau6j0o0julfq"
+
+[node name="CompoundState" type="Node" parent="Behavior"]
+script = ExtResource("4_6e8ak")
+initial_state = NodePath("Idle")
+metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
+
+[node name="Idle" type="Node" parent="Behavior/CompoundState"]
+script = ExtResource("5_4oxbc")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="attack" type="Node" parent="Behavior/CompoundState/Idle"]
+script = ExtResource("6_ko0ks")
+to = NodePath("../../Commands/Attack")
+event = &"attack"
+delay_in_seconds = "0.0"
+
+[node name="explore" type="Node" parent="Behavior/CompoundState/Idle"]
+script = ExtResource("6_ko0ks")
+to = NodePath("../../Commands/Explore")
+event = &"explore"
+delay_in_seconds = "0.0"
+
+[node name="group" type="Node" parent="Behavior/CompoundState/Idle"]
+script = ExtResource("6_ko0ks")
+to = NodePath("../../Commands/Group")
+event = &"group"
+delay_in_seconds = "0.0"
+
+[node name="Commands" type="Node" parent="Behavior/CompoundState"]
+script = ExtResource("4_6e8ak")
+initial_state = NodePath("Group")
+
+[node name="Attack" type="Node" parent="Behavior/CompoundState/Commands"]
+script = ExtResource("5_4oxbc")
+
+[node name="finish" type="Node" parent="Behavior/CompoundState/Commands/Attack"]
+script = ExtResource("6_ko0ks")
+to = NodePath("../../../Idle")
+event = &"end"
+delay_in_seconds = "0.2"
+
+[node name="Explore" type="Node" parent="Behavior/CompoundState/Commands"]
+script = ExtResource("5_4oxbc")
+
+[node name="finish" type="Node" parent="Behavior/CompoundState/Commands/Explore"]
+script = ExtResource("6_ko0ks")
+to = NodePath("../../../Idle")
+delay_in_seconds = "0.5"
+
+[node name="Group" type="Node" parent="Behavior/CompoundState/Commands"]
+script = ExtResource("5_4oxbc")
+
+[node name="finish" type="Node" parent="Behavior/CompoundState/Commands/Group"]
+script = ExtResource("6_ko0ks")
+to = NodePath("../../../Idle")
+delay_in_seconds = "0.2"
+
+[node name="Communicator" parent="." instance=ExtResource("7_56dxl")]
+
+[node name="ObstacleMap" parent="." instance=ExtResource("7_tkcwn")]
+show_map = true
+
+[node name="CanvasLayer" type="CanvasLayer" parent="."]
+
+[node name="Controls" type="PanelContainer" parent="CanvasLayer"]
+offset_right = 66.0
+offset_bottom = 88.0
+
+[node name="List" type="VBoxContainer" parent="CanvasLayer/Controls"]
+layout_mode = 2
+
+[node name="movement" type="Label" parent="CanvasLayer/Controls/List"]
+layout_mode = 2
+text = "move: WASD"
+
+[node name="sprint" type="Label" parent="CanvasLayer/Controls/List"]
+layout_mode = 2
+text = "sprint: Shift"
+
+[node name="attack" type="Label" parent="CanvasLayer/Controls/List"]
+layout_mode = 2
+text = "attack: Q"
+
+[node name="select_target" type="Label" parent="CanvasLayer/Controls/List"]
+layout_mode = 2
+text = "select target: LMB"
+
+[node name="explore" type="Label" parent="CanvasLayer/Controls/List"]
+layout_mode = 2
+text = "explore: E "
+
+[node name="group" type="Label" parent="CanvasLayer/Controls/List"]
+layout_mode = 2
+text = "group: G"
+
+[node name="Indicator" type="PanelContainer" parent="CanvasLayer"]
+anchors_preset = 5
+anchor_left = 0.5
+anchor_right = 0.5
+offset_left = -20.0
+offset_right = 20.0
+offset_bottom = 40.0
+grow_horizontal = 2
+
+[node name="IndicatorLabel" type="Label" parent="CanvasLayer/Indicator"]
+layout_mode = 2
+size_flags_vertical = 1
+text = "Idle"
+horizontal_alignment = 1
+vertical_alignment = 1
+
+[connection signal="state_entered" from="Behavior/CompoundState" to="." method="_on_compound_state_state_entered"]
+[connection signal="state_entered" from="Behavior/CompoundState/Idle" to="." method="_on_idle_state_entered"]
+[connection signal="state_entered" from="Behavior/CompoundState/Commands/Attack" to="." method="_on_attack_state_entered"]
+[connection signal="state_processing" from="Behavior/CompoundState/Commands/Attack" to="." method="_on_attack_state_processing"]
+[connection signal="state_entered" from="Behavior/CompoundState/Commands/Explore" to="." method="_on_explore_state_entered"]
+[connection signal="state_entered" from="Behavior/CompoundState/Commands/Group" to="." method="_on_group_state_entered"]

Godot Exploration - 2d/Platooning/regroup_point.gd → Godot Exploration - 2d/Platooning/misc/regroup_point.gd


Godot Exploration - 2d/Platooning/regroup_point.gd.uid → Godot Exploration - 2d/Platooning/misc/regroup_point.gd.uid


+ 1 - 1
Godot Exploration - 2d/Platooning/regroup_point.tscn

@@ -1,7 +1,7 @@
 [gd_scene load_steps=3 format=3 uid="uid://dcu7do534160e"]
 
 [ext_resource type="Texture2D" uid="uid://bx27n5v3rn0re" path="res://assets/kenney_top-down-shooter/PNG/target.png" id="1_5v4cr"]
-[ext_resource type="Script" uid="uid://5xh2vdn7n8nn" path="res://Platooning/regroup_point.gd" id="2_oujy0"]
+[ext_resource type="Script" uid="uid://5xh2vdn7n8nn" path="res://Platooning/misc/regroup_point.gd" id="2_oujy0"]
 
 [node name="RegroupPoint" type="Sprite2D"]
 texture = ExtResource("1_5v4cr")

+ 190 - 0
Godot Exploration - 2d/Platooning/pawn.gd

@@ -0,0 +1,190 @@
+extends InfantryBase
+class_name Pawn
+
+signal waypoint_reached
+signal clear_pathfinding
+signal send_map(message: Dictionary)
+signal attack
+signal explore
+signal regroup
+
+var target_waypoint: Vector2
+var _map_initialized: bool = false
+@export var nav_margin: float = 15.0
+@export var share_map: bool = false
+
+@onready var behavior: StateChart = $Behavior
+@onready var communicator: Communicator = $Communicator
+@onready var enemy_tracker: EnemyTracker = $EnemyTracker
+@onready var explore_planner: ExplorePlanner = $ExplorePlanner
+@onready var group_planner: GroupPlanner = $GroupPlanner
+@onready var infantry_attack_planner: InfantryAttackPlanner = $InfantryAttackPlanner
+@onready var infantry_strategy: InfantryStrategy = $InfantryStrategy
+@onready var obstacle_map: ObstacleMap = $ObstacleMap
+@onready var pathfinder: Pathfinder = $Pathfinder
+@onready var vision: Vision = $Vision
+
+
+func _ready() -> void:
+	# Propagate the team and strength to the vision component. Vision component can compare these to other units.
+	self.vision.set_team(self.TEAM)
+	self.vision.set_strength(self.STRENGTH)
+	
+	# Connecting all signals between components of the infantry soldier -------#
+	
+	self.clear_pathfinding.connect(self.pathfinder._on_clear_pathfinding)
+	self.waypoint_reached.connect(self.pathfinder._on_waypoint_reached)
+	
+	self.explore_planner.new_destination.connect(self.pathfinder._on_new_destination)
+	self.explore_planner.request_exploration_target.connect(self.obstacle_map._on_explore_planner_request_exploration_target)
+	
+	self.group_planner.clear_pathfinding.connect(self.pathfinder._on_clear_pathfinding)
+	self.group_planner.new_destination.connect(self.pathfinder._on_new_destination)
+	
+	self.infantry_attack_planner.new_destination.connect(self.pathfinder._on_new_destination)
+	self.infantry_attack_planner.fight.connect(self._on_fight)
+	
+	self.attack.connect(self.explore_planner._stop_explore_planner)
+	self.attack.connect(self.group_planner._stop_group_planner)
+	self.attack.connect(self.infantry_attack_planner._on_strategy_attack)
+	self.explore.connect(self.explore_planner._on_strategy_explore)
+	self.explore.connect(self.group_planner._stop_group_planner)
+	self.explore.connect(self.infantry_attack_planner._stop_attack_planner)
+	self.regroup.connect(self.explore_planner._stop_explore_planner)
+	self.regroup.connect(self.group_planner._on_strategy_regroup)
+	self.regroup.connect(self.infantry_attack_planner._stop_attack_planner)
+	
+	self.obstacle_map.send_exploration_target.connect(self.explore_planner._on_obstacle_map_send_exploration_target)
+	self.obstacle_map.send_path.connect(self.pathfinder._on_obstacle_map_send_path)
+	self.obstacle_map.update_done.connect(self.vision._on_obstacle_map_update_done)
+	
+	self.pathfinder.destination_reached.connect(self.explore_planner._on_pathfinder_destination_reached)
+	self.pathfinder.new_waypoint.connect(self._on_pathfinder_new_waypoint)
+	self.pathfinder.request_path.connect(self.obstacle_map._on_pathfinder_request_path)
+	
+	self.vision.enemy_sighted.connect(self.enemy_tracker._on_enemy_sighted)
+	self.vision.enemy_lost.connect(self.enemy_tracker._on_enemy_lost)
+	self.vision.obstacles_sighted.connect(self.obstacle_map._on_obstacle_sighted)
+	self.vision.ready_to_fight.connect(self.infantry_attack_planner._on_ready_to_fight)
+	self.vision.ready_to_fight.connect(self._on_ready_to_fight)
+	
+	self.send_map.connect(self.communicator.data_channel._add_outgoing)
+	
+	self.communicator.command_channel.attack.connect(self._on_communicator_attack)
+	self.communicator.command_channel.explore.connect(self._on_communicator_explore)
+	self.communicator.command_channel.regroup.connect(self._on_communicator_regroup)
+	
+	#--------------------------------------------------------------------------#
+
+
+func dies() -> void:
+	# TODO do some more before removing the agent from the scene.
+	# Add information to collector, make sure this agent is not referenced by others
+	self.queue_free()
+
+
+func target_waypoint_reached() -> bool:
+	var x_dif = abs(self.global_position.x - self.target_waypoint.x)
+	var y_dif = abs(self.global_position.y - self.target_waypoint.y)
+	
+	if x_dif <= self.nav_margin and y_dif <= self.nav_margin:
+		return true
+	
+	return false
+
+
+func target_blocked() -> bool:
+	var target_tile = self.obstacle_map.grid.global_to_tile(self.target_waypoint)
+	if self.obstacle_map.grid.get_tile(target_tile).val == 1:
+		return true
+	return false
+
+
+# Callable to connect to Pathfinder's new_waypoint signal
+func _on_pathfinder_new_waypoint(waypoint: Vector2) -> void:
+	self.target_waypoint = waypoint
+	self.behavior.send_event("new_waypoint")
+
+
+# Callable to connect to Vision's ready_to_fight signal
+func _on_ready_to_fight() -> void:
+	self.clear_pathfinding.emit()
+	self.behavior.send_event("stop")
+
+
+func _on_fight() -> void:
+	var enemy_strength = self.vision.check_enemy_strength()
+	if enemy_strength >= self.get_strength():
+		# Lose fight resulting in the death of this agent
+		self.dies()
+	else:
+		self.vision.kill()
+
+func _on_share_map_timeout() -> void:
+	if self.share_map:
+		var message = {
+			"channel": "data",
+			"tag": "map",
+			"data": self.obstacle_map.grid
+		}
+		self.send_map.emit(message)
+
+
+func _on_map_receive(map: Grid2D) -> void:
+	self.obstacle_map.compare_map(map)
+
+
+#-----------------------------------------------------------------------------#
+# RotateBody State
+func _on_rotate_body_state_processing(delta: float) -> void:
+	var target_direction = self.global_position.direction_to(self.target_waypoint)
+	self.global_rotation = lerp_angle(self.global_rotation, target_direction.angle(), delta * 10)
+	
+	if self.vision.target_in_front(self.target_waypoint):
+		self.behavior.send_event("move")
+
+
+#-----------------------------------------------------------------------------#
+# Moving State
+func _on_moving_state_physics_processing(delta: float) -> void:
+	if self.target_waypoint_reached():
+		self.behavior.send_event("waypoint_reached")
+		return
+	
+	if self.target_blocked():
+		self.clear_pathfinding.emit()
+		self.behavior.send_event("waypoint_reached")
+		return
+	
+	var target_direction = self.global_position.direction_to(self.target_waypoint)
+	self.velocity = target_direction * self.SPEED
+	
+	var motion = self.velocity * delta
+	self.move_and_collide(motion)
+
+
+func _on_waypoint_reached_taken() -> void:
+	self.waypoint_reached.emit()
+
+
+func _on_infantry_movement_state_entered() -> void:
+	if not self._map_initialized:
+		var world: PlatoonTestInstance = self.get_parent()
+		var dimensions = world.get_map_dimensions()
+		self.obstacle_map.build_empty_map(dimensions)
+		self._map_initialized = true
+
+#-----------------------------------------------------------------------------#
+# Communicator Responses
+func _on_communicator_attack(target: Vector2) -> void:
+	self.infantry_attack_planner._on_enemy_tracker_enemy_position_changed(target)
+	self.attack.emit()
+
+
+func _on_communicator_explore() -> void:
+	self.explore.emit()
+
+
+func _on_communicator_regroup(pos: Vector2) -> void:
+	self.group_planner.set_regroup_point(pos)
+	self.regroup.emit()

+ 1 - 0
Godot Exploration - 2d/Platooning/pawn.gd.uid

@@ -0,0 +1 @@
+uid://diqbayfayrjc1

+ 122 - 0
Godot Exploration - 2d/Platooning/pawn.tscn

@@ -0,0 +1,122 @@
+[gd_scene load_steps=17 format=3 uid="uid://bd82dxa2xlbr0"]
+
+[ext_resource type="Script" uid="uid://diqbayfayrjc1" path="res://Platooning/pawn.gd" id="1_qyl3e"]
+[ext_resource type="Texture2D" uid="uid://dh10j38lptsbq" path="res://assets/kenney_top-down-shooter/PNG/soldier.png" id="2_jd6ef"]
+[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="3_o7vpy"]
+[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="4_hry0o"]
+[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="5_dm74v"]
+[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="6_5v3fq"]
+[ext_resource type="PackedScene" uid="uid://c18kqntm5kf53" path="res://Platooning/Communication/Communicator.tscn" id="7_vpmsw"]
+[ext_resource type="PackedScene" uid="uid://b0i3goxsi5vte" path="res://TankWars/Memorizers/enemy_tracker.tscn" id="8_jlshk"]
+[ext_resource type="PackedScene" uid="uid://bsfcprv20pdnf" path="res://TankWars/TacticalDeciders/explore_planner.tscn" id="9_jdknj"]
+[ext_resource type="PackedScene" uid="uid://0bkshlrx7wpw" path="res://Platooning/TacticalDeciders/group_planner.tscn" id="10_ifef1"]
+[ext_resource type="PackedScene" uid="uid://cctrepqj08p47" path="res://Platooning/TacticalDeciders/infantry_attack_planner.tscn" id="11_sovdj"]
+[ext_resource type="PackedScene" uid="uid://cxa4n46xuic4k" path="res://TankWars/Memorizers/obstacle_map.tscn" id="12_th5gn"]
+[ext_resource type="PackedScene" uid="uid://cxhtqmgsfi31e" path="res://TankWars/TacticalDeciders/pathfinder.tscn" id="13_7m2tt"]
+[ext_resource type="PackedScene" uid="uid://dwt5d54cictjf" path="res://Platooning/Sensors/vision.tscn" id="14_l426y"]
+[ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="15_kgpkx"]
+
+[sub_resource type="CircleShape2D" id="CircleShape2D_13v80"]
+radius = 23.0
+
+[node name="Pawn" type="CharacterBody2D"]
+collision_layer = 2
+script = ExtResource("1_qyl3e")
+share_map = true
+
+[node name="sprite" type="Sprite2D" parent="."]
+texture = ExtResource("2_jd6ef")
+
+[node name="collision" type="CollisionShape2D" parent="."]
+shape = SubResource("CircleShape2D_13v80")
+
+[node name="Behavior" type="Node" parent="."]
+script = ExtResource("3_o7vpy")
+metadata/_custom_type_script = "uid://cau6j0o0julfq"
+
+[node name="InfantryMovement" type="Node" parent="Behavior"]
+script = ExtResource("4_hry0o")
+initial_state = NodePath("Idle")
+
+[node name="Idle" type="Node" parent="Behavior/InfantryMovement"]
+script = ExtResource("5_dm74v")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="new_waypoint" type="Node" parent="Behavior/InfantryMovement/Idle"]
+script = ExtResource("6_5v3fq")
+to = NodePath("../../RotateBody")
+event = &"new_waypoint"
+delay_in_seconds = "0.0"
+
+[node name="RotateBody" type="Node" parent="Behavior/InfantryMovement"]
+script = ExtResource("5_dm74v")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="move" type="Node" parent="Behavior/InfantryMovement/RotateBody"]
+script = ExtResource("6_5v3fq")
+to = NodePath("../../Moving")
+event = &"move"
+delay_in_seconds = "0.0"
+
+[node name="stop" type="Node" parent="Behavior/InfantryMovement/RotateBody"]
+script = ExtResource("6_5v3fq")
+to = NodePath("../../Idle")
+event = &"stop"
+delay_in_seconds = "0.0"
+
+[node name="Moving" type="Node" parent="Behavior/InfantryMovement"]
+script = ExtResource("5_dm74v")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="waypoint_reached" type="Node" parent="Behavior/InfantryMovement/Moving"]
+script = ExtResource("6_5v3fq")
+to = NodePath("../../Idle")
+event = &"waypoint_reached"
+delay_in_seconds = "0.0"
+
+[node name="stop" type="Node" parent="Behavior/InfantryMovement/Moving"]
+script = ExtResource("6_5v3fq")
+to = NodePath("../../Idle")
+event = &"stop"
+delay_in_seconds = "0.0"
+
+[node name="Communicator" parent="." instance=ExtResource("7_vpmsw")]
+
+[node name="EnemyTracker" parent="." instance=ExtResource("8_jlshk")]
+
+[node name="ExplorePlanner" parent="." instance=ExtResource("9_jdknj")]
+
+[node name="GroupPlanner" parent="." instance=ExtResource("10_ifef1")]
+
+[node name="InfantryAttackPlanner" parent="." instance=ExtResource("11_sovdj")]
+
+[node name="ObstacleMap" parent="." instance=ExtResource("12_th5gn")]
+
+[node name="Pathfinder" parent="." instance=ExtResource("13_7m2tt")]
+
+[node name="Vision" parent="." instance=ExtResource("14_l426y")]
+
+[node name="CanvasLayer" type="CanvasLayer" parent="."]
+visible = false
+
+[node name="StateChartDebugger" parent="CanvasLayer" instance=ExtResource("15_kgpkx")]
+anchors_preset = 1
+anchor_left = 1.0
+anchor_bottom = 0.0
+offset_left = -542.0
+offset_bottom = 628.0
+grow_horizontal = 0
+grow_vertical = 1
+size_flags_horizontal = 8
+size_flags_vertical = 0
+initial_node_to_watch = NodePath("../../Behavior")
+
+[node name="ShareMapTimer" type="Timer" parent="."]
+wait_time = 5.0
+autostart = true
+
+[connection signal="state_entered" from="Behavior/InfantryMovement" to="." method="_on_infantry_movement_state_entered"]
+[connection signal="state_processing" from="Behavior/InfantryMovement/RotateBody" to="." method="_on_rotate_body_state_processing"]
+[connection signal="state_physics_processing" from="Behavior/InfantryMovement/Moving" to="." method="_on_moving_state_physics_processing"]
+[connection signal="taken" from="Behavior/InfantryMovement/Moving/waypoint_reached" to="." method="_on_waypoint_reached_taken"]
+[connection signal="timeout" from="ShareMapTimer" to="." method="_on_share_map_timeout"]

+ 148 - 0
Godot Exploration - 2d/Platooning/scout.gd

@@ -0,0 +1,148 @@
+extends InfantryBase
+class_name Scout
+
+signal waypoint_reached
+signal clear_pathfinding
+
+var target_waypoint: Vector2
+var _map_initialized: bool = false
+@export var nav_margin: float = 15.0
+
+@onready var behavior: StateChart = $Behavior
+@onready var enemy_tracker: EnemyTracker = $EnemyTracker
+@onready var explore_planner: ExplorePlanner = $ExplorePlanner
+@onready var infantry_attack_planner: InfantryAttackPlanner = $InfantryAttackPlanner
+@onready var obstacle_map: ObstacleMap = $ObstacleMap
+@onready var pathfinder: Pathfinder = $Pathfinder
+@onready var scout_strategy: ScoutStrategy = $ScoutStrategy
+@onready var vision: Vision = $Vision
+
+
+func _ready() -> void:
+	# Propagate the team and strength to the vision component. Vision component can compare these to other units.
+	self.vision.set_team(self.TEAM)
+	self.vision.set_strength(self.STRENGTH)
+	
+	# Connecting all signals between components of the infantry soldier -------#
+	
+	self.clear_pathfinding.connect(self.pathfinder._on_clear_pathfinding)
+	self.waypoint_reached.connect(self.pathfinder._on_waypoint_reached)
+	
+	self.enemy_tracker.enemy_position_changed.connect(self.infantry_attack_planner._on_enemy_tracker_enemy_position_changed)
+	self.enemy_tracker.enemy_position_known.connect(self.scout_strategy._on_enemy_tracker_enemy_position_known)
+	self.enemy_tracker.enemy_position_unsure.connect(self.scout_strategy._on_enemy_tracker_enemy_position_unsure)
+	
+	self.explore_planner.new_destination.connect(self.pathfinder._on_new_destination)
+	self.explore_planner.request_exploration_target.connect(self.obstacle_map._on_explore_planner_request_exploration_target)
+	
+	self.infantry_attack_planner.new_destination.connect(self.pathfinder._on_new_destination)
+	self.infantry_attack_planner.fight.connect(self._on_fight)
+	
+	self.scout_strategy.attack.connect(self.explore_planner._stop_explore_planner)
+	self.scout_strategy.attack.connect(self.infantry_attack_planner._on_strategy_attack)
+	self.scout_strategy.explore.connect(self.explore_planner._on_strategy_explore)
+	self.scout_strategy.explore.connect(self.infantry_attack_planner._stop_attack_planner)
+	self.scout_strategy.new_destination.connect(self.pathfinder._on_new_destination)
+	
+	self.obstacle_map.send_exploration_target.connect(self.explore_planner._on_obstacle_map_send_exploration_target)
+	self.obstacle_map.send_path.connect(self.pathfinder._on_obstacle_map_send_path)
+	self.obstacle_map.update_done.connect(self.vision._on_obstacle_map_update_done)
+	
+	self.pathfinder.destination_reached.connect(self.explore_planner._on_pathfinder_destination_reached)
+	self.pathfinder.new_waypoint.connect(self._on_pathfinder_new_waypoint)
+	self.pathfinder.request_path.connect(self.obstacle_map._on_pathfinder_request_path)
+	
+	self.vision.danger.connect(self.scout_strategy._on_enemy_danger)
+	self.vision.enemy_sighted.connect(self.enemy_tracker._on_enemy_sighted)
+	self.vision.enemy_lost.connect(self.enemy_tracker._on_enemy_lost)
+	self.vision.obstacles_sighted.connect(self.obstacle_map._on_obstacle_sighted)
+	self.vision.ready_to_fight.connect(self.infantry_attack_planner._on_ready_to_fight)
+	self.vision.ready_to_fight.connect(self._on_ready_to_fight)
+	
+	#--------------------------------------------------------------------------#
+
+
+func dies() -> void:
+	# TODO do some more before removing the agent from the scene.
+	# Add information to collector, make sure this agent is not referenced by others
+	self.queue_free()
+
+
+func target_waypoint_reached() -> bool:
+	var x_dif = abs(self.global_position.x - self.target_waypoint.x)
+	var y_dif = abs(self.global_position.y - self.target_waypoint.y)
+	
+	if x_dif <= self.nav_margin and y_dif <= self.nav_margin:
+		return true
+	
+	return false
+
+
+func target_blocked() -> bool:
+	var target_tile = self.obstacle_map.grid.global_to_tile(self.target_waypoint)
+	if self.obstacle_map.grid.get_tile(target_tile).val == 1:
+		return true
+	return false
+
+
+
+# Callable to connect to Pathfinder's new_waypoint signal
+func _on_pathfinder_new_waypoint(waypoint: Vector2) -> void:
+	self.target_waypoint = waypoint
+	self.behavior.send_event("new_waypoint")
+
+
+# Callable to connect to Vision's ready_to_fight signal
+func _on_ready_to_fight() -> void:
+	self.clear_pathfinding.emit()
+	self.behavior.send_event("stop")
+
+
+func _on_fight() -> void:
+	var enemy_strength = self.vision.check_enemy_strength()
+	if enemy_strength >= self.get_strength():
+		# Lose fight resulting in the death of this agent
+		self.dies()
+	else:
+		self.vision.kill()
+
+
+#-----------------------------------------------------------------------------#
+# RotateBody State
+func _on_rotate_body_state_processing(delta: float) -> void:
+	var target_direction = self.global_position.direction_to(self.target_waypoint)
+	self.global_rotation = lerp_angle(self.global_rotation, target_direction.angle(), delta * 5)
+	
+	if self.vision.target_in_front(self.target_waypoint):
+		self.behavior.send_event("move")
+
+
+#-----------------------------------------------------------------------------#
+# Moving State
+func _on_moving_state_physics_processing(delta: float) -> void:
+	if self.target_waypoint_reached():
+		self.behavior.send_event("waypoint_reached")
+		return
+	
+	if self.target_blocked():
+		self.clear_pathfinding.emit()
+		self.behavior.send_event("waypoint_reached")
+		return
+	
+	var target_direction = self.global_position.direction_to(self.target_waypoint)
+	self.velocity = target_direction * self.SPEED
+	
+	var motion = self.velocity * delta
+	self.move_and_collide(motion)
+
+
+func _on_waypoint_reached_taken() -> void:
+	self.waypoint_reached.emit()
+
+
+func _on_infantry_movement_state_entered() -> void:
+	if not self._map_initialized:
+		var world: PlatoonTestInstance = self.get_parent()
+		var dimensions = world.get_map_dimensions()
+		self.obstacle_map.build_empty_map(dimensions)
+		self._map_initialized = true

+ 1 - 0
Godot Exploration - 2d/Platooning/scout.gd.uid

@@ -0,0 +1 @@
+uid://dd2kaccjidxn

+ 112 - 0
Godot Exploration - 2d/Platooning/scout.tscn

@@ -0,0 +1,112 @@
+[gd_scene load_steps=16 format=3 uid="uid://cgp4fxabwp65i"]
+
+[ext_resource type="Script" uid="uid://dd2kaccjidxn" path="res://Platooning/scout.gd" id="1_76ajf"]
+[ext_resource type="Texture2D" uid="uid://dh10j38lptsbq" path="res://assets/kenney_top-down-shooter/PNG/soldier.png" id="2_r52e1"]
+[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="3_vgy1s"]
+[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="4_e527e"]
+[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="5_427n2"]
+[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="6_abj7c"]
+[ext_resource type="PackedScene" uid="uid://b0i3goxsi5vte" path="res://TankWars/Memorizers/enemy_tracker.tscn" id="7_ku2aq"]
+[ext_resource type="PackedScene" uid="uid://bsfcprv20pdnf" path="res://TankWars/TacticalDeciders/explore_planner.tscn" id="8_klob7"]
+[ext_resource type="PackedScene" uid="uid://cctrepqj08p47" path="res://Platooning/TacticalDeciders/infantry_attack_planner.tscn" id="10_1j1wf"]
+[ext_resource type="PackedScene" uid="uid://ccom8jmnsbdwc" path="res://Platooning/StrategicDeciders/scout_strategy.tscn" id="12_h5cnc"]
+[ext_resource type="PackedScene" uid="uid://cxa4n46xuic4k" path="res://TankWars/Memorizers/obstacle_map.tscn" id="12_kxy23"]
+[ext_resource type="PackedScene" uid="uid://cxhtqmgsfi31e" path="res://TankWars/TacticalDeciders/pathfinder.tscn" id="13_vvpy6"]
+[ext_resource type="PackedScene" uid="uid://dwt5d54cictjf" path="res://Platooning/Sensors/vision.tscn" id="14_n0b6e"]
+[ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="15_dhsbo"]
+
+[sub_resource type="CircleShape2D" id="CircleShape2D_13v80"]
+radius = 23.0
+
+[node name="Scout" type="CharacterBody2D"]
+collision_layer = 2
+script = ExtResource("1_76ajf")
+
+[node name="sprite" type="Sprite2D" parent="."]
+texture = ExtResource("2_r52e1")
+
+[node name="collision" type="CollisionShape2D" parent="."]
+shape = SubResource("CircleShape2D_13v80")
+
+[node name="Behavior" type="Node" parent="."]
+script = ExtResource("3_vgy1s")
+metadata/_custom_type_script = "uid://cau6j0o0julfq"
+
+[node name="InfantryMovement" type="Node" parent="Behavior"]
+script = ExtResource("4_e527e")
+initial_state = NodePath("Idle")
+
+[node name="Idle" type="Node" parent="Behavior/InfantryMovement"]
+script = ExtResource("5_427n2")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="new_waypoint" type="Node" parent="Behavior/InfantryMovement/Idle"]
+script = ExtResource("6_abj7c")
+to = NodePath("../../RotateBody")
+event = &"new_waypoint"
+delay_in_seconds = "0.0"
+
+[node name="RotateBody" type="Node" parent="Behavior/InfantryMovement"]
+script = ExtResource("5_427n2")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="move" type="Node" parent="Behavior/InfantryMovement/RotateBody"]
+script = ExtResource("6_abj7c")
+to = NodePath("../../Moving")
+event = &"move"
+delay_in_seconds = "0.0"
+
+[node name="stop" type="Node" parent="Behavior/InfantryMovement/RotateBody"]
+script = ExtResource("6_abj7c")
+to = NodePath("../../Idle")
+event = &"stop"
+delay_in_seconds = "0.0"
+
+[node name="Moving" type="Node" parent="Behavior/InfantryMovement"]
+script = ExtResource("5_427n2")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="waypoint_reached" type="Node" parent="Behavior/InfantryMovement/Moving"]
+script = ExtResource("6_abj7c")
+to = NodePath("../../Idle")
+event = &"waypoint_reached"
+delay_in_seconds = "0.0"
+
+[node name="stop" type="Node" parent="Behavior/InfantryMovement/Moving"]
+script = ExtResource("6_abj7c")
+to = NodePath("../../Idle")
+event = &"stop"
+delay_in_seconds = "0.0"
+
+[node name="EnemyTracker" parent="." instance=ExtResource("7_ku2aq")]
+
+[node name="ExplorePlanner" parent="." instance=ExtResource("8_klob7")]
+
+[node name="InfantryAttackPlanner" parent="." instance=ExtResource("10_1j1wf")]
+
+[node name="ObstacleMap" parent="." instance=ExtResource("12_kxy23")]
+
+[node name="Pathfinder" parent="." instance=ExtResource("13_vvpy6")]
+
+[node name="ScoutStrategy" parent="." instance=ExtResource("12_h5cnc")]
+
+[node name="Vision" parent="." instance=ExtResource("14_n0b6e")]
+
+[node name="CanvasLayer" type="CanvasLayer" parent="."]
+visible = false
+
+[node name="StateChartDebugger" parent="CanvasLayer" instance=ExtResource("15_dhsbo")]
+anchors_preset = 1
+anchor_left = 1.0
+anchor_bottom = 0.0
+offset_left = -542.0
+offset_bottom = 628.0
+grow_horizontal = 0
+grow_vertical = 1
+size_flags_horizontal = 8
+size_flags_vertical = 0
+
+[connection signal="state_entered" from="Behavior/InfantryMovement" to="." method="_on_infantry_movement_state_entered"]
+[connection signal="state_processing" from="Behavior/InfantryMovement/RotateBody" to="." method="_on_rotate_body_state_processing"]
+[connection signal="state_physics_processing" from="Behavior/InfantryMovement/Moving" to="." method="_on_moving_state_physics_processing"]
+[connection signal="taken" from="Behavior/InfantryMovement/Moving/waypoint_reached" to="." method="_on_waypoint_reached_taken"]

+ 37 - 0
Godot Exploration - 2d/examples/lightswitch.tscn

@@ -0,0 +1,37 @@
+[gd_scene load_steps=5 format=3 uid="uid://dqqox43nstlup"]
+
+[ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="1_veg0d"]
+[ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="2_ici4j"]
+[ext_resource type="Script" uid="uid://dyiggrr357tov" path="res://addons/godot_state_charts/atomic_state.gd" id="3_uglt7"]
+[ext_resource type="Script" uid="uid://m8bym6l05tkl" path="res://addons/godot_state_charts/transition.gd" id="4_r4ss6"]
+
+[node name="Lightswitch" type="Node2D"]
+
+[node name="Statechart" type="Node" parent="."]
+script = ExtResource("1_veg0d")
+metadata/_custom_type_script = "uid://cau6j0o0julfq"
+
+[node name="Lightswitch" type="Node" parent="Statechart"]
+script = ExtResource("2_ici4j")
+initial_state = NodePath("off")
+metadata/_custom_type_script = "uid://bou0yn8lpwcuh"
+
+[node name="off" type="Node" parent="Statechart/Lightswitch"]
+script = ExtResource("3_uglt7")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="flip" type="Node" parent="Statechart/Lightswitch/off"]
+script = ExtResource("4_r4ss6")
+to = NodePath("../../on")
+event = &"flip"
+delay_in_seconds = "0.0"
+
+[node name="on" type="Node" parent="Statechart/Lightswitch"]
+script = ExtResource("3_uglt7")
+metadata/_custom_type_script = "uid://dyiggrr357tov"
+
+[node name="flip" type="Node" parent="Statechart/Lightswitch/on"]
+script = ExtResource("4_r4ss6")
+to = NodePath("../../off")
+event = &"flip"
+delay_in_seconds = "0.0"

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 2057
Godot Exploration - 2d/mai3398.tmp


+ 0 - 73
Godot Exploration - 2d/mai9D09.tmp

@@ -1,73 +0,0 @@
-[gd_scene load_steps=8 format=3 uid="uid://bk5y5osc7libt"]
-
-[ext_resource type="PackedScene" uid="uid://cinvnsnbdela7" path="res://actors/player.tscn" id="1_cfvfw"]
-[ext_resource type="Script" path="res://main.gd" id="1_tkbst"]
-[ext_resource type="Script" path="res://Camera2D.gd" id="4_d2gre"]
-[ext_resource type="Script" path="res://FPSctr.gd" id="5_ivfvg"]
-[ext_resource type="Script" path="res://TextEdit.gd" id="6_a052t"]
-[ext_resource type="Script" path="res://OutputHandler.gd" id="6_i0u21"]
-[ext_resource type="PackedScene" uid="uid://b1h250kw14fra" path="res://UI/gui.tscn" id="10_5qbhp"]
-
-[node name="Main" type="Node2D"]
-script = ExtResource("1_tkbst")
-instance_num = 9
-
-[node name="OpenFile" type="FileDialog" parent="."]
-title = "Open File(s)"
-position = Vector2i(0, 36)
-size = Vector2i(750, 400)
-ok_button_text = "Open"
-file_mode = 1
-access = 1
-
-[node name="GAMES" type="Node2D" parent="."]
-
-[node name="Player" parent="." instance=ExtResource("1_cfvfw")]
-position = Vector2(2736, 1241)
-
-[node name="Camera2D" type="Camera2D" parent="Player"]
-position_smoothing_enabled = true
-script = ExtResource("4_d2gre")
-new_zoom = 0.2
-
-[node name="GUI" parent="." instance=ExtResource("10_5qbhp")]
-visible = false
-
-[node name="FPS" type="CanvasLayer" parent="."]
-
-[node name="ctr" type="Label" parent="FPS"]
-offset_right = 40.0
-offset_bottom = 23.0
-text = "FPS: 42"
-script = ExtResource("5_ivfvg")
-
-[node name="instanceUI" type="TextEdit" parent="FPS"]
-visible = false
-offset_left = 510.0
-offset_top = 309.0
-offset_right = 675.0
-offset_bottom = 406.0
-tooltip_text = "Enter in-game instance count"
-text = "4"
-context_menu_enabled = false
-wrap_mode = 1
-script = ExtResource("6_a052t")
-
-[node name="TimeOut" type="Timer" parent="."]
-wait_time = 30.0
-autostart = true
-
-[node name="outputhandler" type="Node" parent="."]
-script = ExtResource("6_i0u21")
-
-[node name="WriteTimer" type="Timer" parent="outputhandler"]
-wait_time = 5.0
-autostart = true
-
-[connection signal="canceled" from="OpenFile" to="." method="_on_open_file_canceled"]
-[connection signal="confirmed" from="OpenFile" to="." method="_on_open_file_confirmed"]
-[connection signal="files_selected" from="OpenFile" to="." method="_on_open_file_files_selected"]
-[connection signal="gui_input" from="FPS/instanceUI" to="FPS/instanceUI" method="_on_gui_input"]
-[connection signal="reset_with_instances" from="FPS/instanceUI" to="." method="_on_instance_ui_reset_with_instances"]
-[connection signal="timeout" from="TimeOut" to="." method="_on_time_out_timeout"]
-[connection signal="timeout" from="outputhandler/WriteTimer" to="outputhandler" method="_on_write_timer_timeout"]

+ 0 - 65
Godot Exploration - 2d/maiCAD6.tmp

@@ -1,65 +0,0 @@
-[gd_scene load_steps=7 format=3 uid="uid://bk5y5osc7libt"]
-
-[ext_resource type="PackedScene" uid="uid://cinvnsnbdela7" path="res://actors/player.tscn" id="1_cfvfw"]
-[ext_resource type="Script" path="res://main.gd" id="1_tkbst"]
-[ext_resource type="Script" path="res://Camera2D.gd" id="4_d2gre"]
-[ext_resource type="Script" path="res://FPSctr.gd" id="5_ivfvg"]
-[ext_resource type="Script" path="res://OutputHandler.gd" id="6_i0u21"]
-[ext_resource type="PackedScene" uid="uid://b1h250kw14fra" path="res://UI/gui.tscn" id="10_5qbhp"]
-
-[node name="Main" type="Node2D"]
-script = ExtResource("1_tkbst")
-instance_num = 4
-
-[node name="OpenFile" type="FileDialog" parent="."]
-title = "Open File(s)"
-position = Vector2i(0, 36)
-size = Vector2i(750, 400)
-ok_button_text = "Open"
-file_mode = 1
-access = 1
-
-[node name="GAMES" type="Node2D" parent="."]
-
-[node name="Player" parent="." instance=ExtResource("1_cfvfw")]
-position = Vector2(2736, 1241)
-
-[node name="Camera2D" type="Camera2D" parent="Player"]
-position_smoothing_enabled = true
-script = ExtResource("4_d2gre")
-new_zoom = 0.2
-
-[node name="GUI" parent="." instance=ExtResource("10_5qbhp")]
-visible = false
-
-[node name="FPS" type="CanvasLayer" parent="."]
-
-[node name="ctr" type="Label" parent="FPS"]
-offset_right = 40.0
-offset_bottom = 23.0
-text = "FPS: 42"
-script = ExtResource("5_ivfvg")
-
-[node name="TimeOut" type="Timer" parent="."]
-wait_time = 30.0
-autostart = true
-
-[node name="outputhandler" type="Node" parent="."]
-script = ExtResource("6_i0u21")
-
-[node name="WriteTimer" type="Timer" parent="outputhandler"]
-wait_time = 5.0
-autostart = true
-
-[node name="TextEdit" type="TextEdit" parent="."]
-offset_left = 303.0
-offset_top = 298.0
-offset_right = 812.0
-offset_bottom = 350.0
-text = "4"
-
-[connection signal="canceled" from="OpenFile" to="." method="_on_open_file_canceled"]
-[connection signal="confirmed" from="OpenFile" to="." method="_on_open_file_confirmed"]
-[connection signal="files_selected" from="OpenFile" to="." method="_on_open_file_files_selected"]
-[connection signal="timeout" from="TimeOut" to="." method="_on_time_out_timeout"]
-[connection signal="timeout" from="outputhandler/WriteTimer" to="outputhandler" method="_on_write_timer_timeout"]

+ 0 - 65
Godot Exploration - 2d/maiEAB1.tmp

@@ -1,65 +0,0 @@
-[gd_scene load_steps=7 format=3 uid="uid://bk5y5osc7libt"]
-
-[ext_resource type="PackedScene" uid="uid://cinvnsnbdela7" path="res://actors/player.tscn" id="1_cfvfw"]
-[ext_resource type="Script" path="res://main.gd" id="1_tkbst"]
-[ext_resource type="Script" path="res://Camera2D.gd" id="4_d2gre"]
-[ext_resource type="Script" path="res://FPSctr.gd" id="5_ivfvg"]
-[ext_resource type="Script" path="res://OutputHandler.gd" id="6_i0u21"]
-[ext_resource type="PackedScene" uid="uid://b1h250kw14fra" path="res://UI/gui.tscn" id="10_5qbhp"]
-
-[node name="Main" type="Node2D"]
-script = ExtResource("1_tkbst")
-instance_num = 4
-
-[node name="OpenFile" type="FileDialog" parent="."]
-title = "Open File(s)"
-position = Vector2i(0, 36)
-size = Vector2i(750, 400)
-ok_button_text = "Open"
-file_mode = 1
-access = 1
-
-[node name="GAMES" type="Node2D" parent="."]
-
-[node name="Player" parent="." instance=ExtResource("1_cfvfw")]
-position = Vector2(2736, 1241)
-
-[node name="Camera2D" type="Camera2D" parent="Player"]
-position_smoothing_enabled = true
-script = ExtResource("4_d2gre")
-new_zoom = 0.2
-
-[node name="GUI" parent="." instance=ExtResource("10_5qbhp")]
-visible = false
-
-[node name="FPS" type="CanvasLayer" parent="."]
-
-[node name="ctr" type="Label" parent="FPS"]
-offset_right = 40.0
-offset_bottom = 23.0
-text = "FPS: 42"
-script = ExtResource("5_ivfvg")
-
-[node name="TimeOut" type="Timer" parent="."]
-wait_time = 30.0
-autostart = true
-
-[node name="outputhandler" type="Node" parent="."]
-script = ExtResource("6_i0u21")
-
-[node name="WriteTimer" type="Timer" parent="outputhandler"]
-wait_time = 5.0
-autostart = true
-
-[node name="TextEdit" type="TextEdit" parent="."]
-offset_left = 303.0
-offset_top = 298.0
-offset_right = 812.0
-offset_bottom = 350.0
-text = "4"
-
-[connection signal="canceled" from="OpenFile" to="." method="_on_open_file_canceled"]
-[connection signal="confirmed" from="OpenFile" to="." method="_on_open_file_confirmed"]
-[connection signal="files_selected" from="OpenFile" to="." method="_on_open_file_files_selected"]
-[connection signal="timeout" from="TimeOut" to="." method="_on_time_out_timeout"]
-[connection signal="timeout" from="outputhandler/WriteTimer" to="outputhandler" method="_on_write_timer_timeout"]

+ 0 - 58
Godot Exploration - 2d/main.tscn1047157524.tmp

@@ -1,58 +0,0 @@
-[gd_scene load_steps=7 format=3 uid="uid://bk5y5osc7libt"]
-
-[ext_resource type="Script" uid="uid://po4wjjg4qnk0" path="res://main.gd" id="1_272bh"]
-[ext_resource type="PackedScene" uid="uid://cinvnsnbdela7" path="res://actors/player.tscn" id="1_cfvfw"]
-[ext_resource type="Script" uid="uid://dmv5ty0jp0usw" path="res://Camera2D.gd" id="4_d2gre"]
-[ext_resource type="Script" uid="uid://dne3na8bihmog" path="res://FPSctr.gd" id="5_ivfvg"]
-[ext_resource type="Script" uid="uid://qgcjii7lqy0a" path="res://OutputHandler.gd" id="6_i0u21"]
-[ext_resource type="PackedScene" uid="uid://b1h250kw14fra" path="res://UI/gui.tscn" id="10_5qbhp"]
-
-[node name="Main" type="Node2D"]
-script = ExtResource("1_272bh")
-instance_num = 10
-timescale = 2.0
-
-[node name="OpenFile" type="FileDialog" parent="."]
-title = "Open File(s)"
-position = Vector2i(0, 36)
-size = Vector2i(750, 400)
-ok_button_text = "Open"
-file_mode = 1
-access = 1
-
-[node name="GAMES" type="Node2D" parent="."]
-
-[node name="Player" parent="." instance=ExtResource("1_cfvfw")]
-position = Vector2(2736, 1241)
-
-[node name="Camera2D" type="Camera2D" parent="Player"]
-position_smoothing_enabled = true
-script = ExtResource("4_d2gre")
-new_zoom = 0.2
-
-[node name="GUI" parent="." instance=ExtResource("10_5qbhp")]
-visible = false
-
-[node name="FPS" type="CanvasLayer" parent="."]
-
-[node name="ctr" type="Label" parent="FPS"]
-offset_right = 40.0
-offset_bottom = 23.0
-text = "FPS: 42"
-script = ExtResource("5_ivfvg")
-
-[node name="TimeOut" type="Timer" parent="."]
-wait_time = 30.0
-
-[node name="outputhandler" type="Node" parent="."]
-script = ExtResource("6_i0u21")
-
-[node name="WriteTimer" type="Timer" parent="outputhandler"]
-wait_time = 5.0
-autostart = true
-
-[connection signal="canceled" from="OpenFile" to="." method="_on_open_file_canceled"]
-[connection signal="confirmed" from="OpenFile" to="." method="_on_open_file_confirmed"]
-[connection signal="files_selected" from="OpenFile" to="." method="_on_open_file_files_selected"]
-[connection signal="timeout" from="TimeOut" to="." method="_on_time_out_timeout"]
-[connection signal="timeout" from="outputhandler/WriteTimer" to="outputhandler" method="_on_write_timer_timeout"]

+ 0 - 58
Godot Exploration - 2d/main.tscn1119918514.tmp

@@ -1,58 +0,0 @@
-[gd_scene load_steps=7 format=3 uid="uid://bk5y5osc7libt"]
-
-[ext_resource type="Script" uid="uid://po4wjjg4qnk0" path="res://main.gd" id="1_272bh"]
-[ext_resource type="PackedScene" uid="uid://cinvnsnbdela7" path="res://actors/player.tscn" id="1_cfvfw"]
-[ext_resource type="Script" uid="uid://dmv5ty0jp0usw" path="res://Camera2D.gd" id="4_d2gre"]
-[ext_resource type="Script" uid="uid://dne3na8bihmog" path="res://FPSctr.gd" id="5_ivfvg"]
-[ext_resource type="Script" uid="uid://qgcjii7lqy0a" path="res://OutputHandler.gd" id="6_i0u21"]
-[ext_resource type="PackedScene" uid="uid://b1h250kw14fra" path="res://UI/gui.tscn" id="10_5qbhp"]
-
-[node name="Main" type="Node2D"]
-script = ExtResource("1_272bh")
-instance_num = 10
-timescale = 2.0
-
-[node name="OpenFile" type="FileDialog" parent="."]
-title = "Open File(s)"
-position = Vector2i(0, 36)
-size = Vector2i(750, 400)
-ok_button_text = "Open"
-file_mode = 1
-access = 1
-
-[node name="GAMES" type="Node2D" parent="."]
-
-[node name="Player" parent="." instance=ExtResource("1_cfvfw")]
-position = Vector2(2736, 1241)
-
-[node name="Camera2D" type="Camera2D" parent="Player"]
-position_smoothing_enabled = true
-script = ExtResource("4_d2gre")
-new_zoom = 0.2
-
-[node name="GUI" parent="." instance=ExtResource("10_5qbhp")]
-visible = false
-
-[node name="FPS" type="CanvasLayer" parent="."]
-
-[node name="ctr" type="Label" parent="FPS"]
-offset_right = 40.0
-offset_bottom = 23.0
-text = "FPS: 42"
-script = ExtResource("5_ivfvg")
-
-[node name="TimeOut" type="Timer" parent="."]
-wait_time = 30.0
-
-[node name="outputhandler" type="Node" parent="."]
-script = ExtResource("6_i0u21")
-
-[node name="WriteTimer" type="Timer" parent="outputhandler"]
-wait_time = 5.0
-autostart = true
-
-[connection signal="canceled" from="OpenFile" to="." method="_on_open_file_canceled"]
-[connection signal="confirmed" from="OpenFile" to="." method="_on_open_file_confirmed"]
-[connection signal="files_selected" from="OpenFile" to="." method="_on_open_file_files_selected"]
-[connection signal="timeout" from="TimeOut" to="." method="_on_time_out_timeout"]
-[connection signal="timeout" from="outputhandler/WriteTimer" to="outputhandler" method="_on_write_timer_timeout"]

+ 0 - 57
Godot Exploration - 2d/main.tscn5454769972.tmp

@@ -1,57 +0,0 @@
-[gd_scene load_steps=7 format=3 uid="uid://bk5y5osc7libt"]
-
-[ext_resource type="Script" uid="uid://po4wjjg4qnk0" path="res://main.gd" id="1_272bh"]
-[ext_resource type="PackedScene" uid="uid://cinvnsnbdela7" path="res://actors/player.tscn" id="1_cfvfw"]
-[ext_resource type="Script" uid="uid://dmv5ty0jp0usw" path="res://Camera2D.gd" id="4_d2gre"]
-[ext_resource type="Script" uid="uid://dne3na8bihmog" path="res://FPSctr.gd" id="5_ivfvg"]
-[ext_resource type="Script" uid="uid://qgcjii7lqy0a" path="res://OutputHandler.gd" id="6_i0u21"]
-[ext_resource type="PackedScene" uid="uid://b1h250kw14fra" path="res://UI/gui.tscn" id="10_5qbhp"]
-
-[node name="Main" type="Node2D"]
-script = ExtResource("1_272bh")
-timescale = 2.0
-
-[node name="OpenFile" type="FileDialog" parent="."]
-title = "Open File(s)"
-position = Vector2i(0, 36)
-size = Vector2i(750, 400)
-ok_button_text = "Open"
-file_mode = 1
-access = 1
-
-[node name="GAMES" type="Node2D" parent="."]
-
-[node name="Player" parent="." instance=ExtResource("1_cfvfw")]
-position = Vector2(2736, 1241)
-
-[node name="Camera2D" type="Camera2D" parent="Player"]
-position_smoothing_enabled = true
-script = ExtResource("4_d2gre")
-new_zoom = 0.2
-
-[node name="GUI" parent="." instance=ExtResource("10_5qbhp")]
-visible = false
-
-[node name="FPS" type="CanvasLayer" parent="."]
-
-[node name="ctr" type="Label" parent="FPS"]
-offset_right = 40.0
-offset_bottom = 23.0
-text = "FPS: 42"
-script = ExtResource("5_ivfvg")
-
-[node name="TimeOut" type="Timer" parent="."]
-wait_time = 30.0
-
-[node name="outputhandler" type="Node" parent="."]
-script = ExtResource("6_i0u21")
-
-[node name="WriteTimer" type="Timer" parent="outputhandler"]
-wait_time = 5.0
-autostart = true
-
-[connection signal="canceled" from="OpenFile" to="." method="_on_open_file_canceled"]
-[connection signal="confirmed" from="OpenFile" to="." method="_on_open_file_confirmed"]
-[connection signal="files_selected" from="OpenFile" to="." method="_on_open_file_files_selected"]
-[connection signal="timeout" from="TimeOut" to="." method="_on_time_out_timeout"]
-[connection signal="timeout" from="outputhandler/WriteTimer" to="outputhandler" method="_on_write_timer_timeout"]

Godot Exploration - 2d/BouncingBalls/sc_semantics.gd → Godot Exploration - 2d/semantic_testing/sc_semantics.gd


Godot Exploration - 2d/BouncingBalls/sc_semantics.gd.uid → Godot Exploration - 2d/semantic_testing/sc_semantics.gd.uid


+ 3 - 3
Godot Exploration - 2d/BouncingBalls/sc_semantics.tscn

@@ -1,7 +1,7 @@
 [gd_scene load_steps=48 format=3 uid="uid://dpw4gqwmpfe5e"]
 
 [ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="1_0ag1n"]
-[ext_resource type="Script" uid="uid://cl75pkl5l8lau" path="res://BouncingBalls/sc_semantics.gd" id="1_7xljh"]
+[ext_resource type="Script" uid="uid://cl75pkl5l8lau" path="res://semantic_testing/sc_semantics.gd" id="1_7xljh"]
 [ext_resource type="Script" uid="uid://dtlmgewt76wtf" path="res://addons/godot_state_charts/parallel_state.gd" id="2_7xljh"]
 [ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="2_umojb"]
 [ext_resource type="Script" uid="uid://bou0yn8lpwcuh" path="res://addons/godot_state_charts/compound_state.gd" id="3_umojb"]
@@ -193,9 +193,9 @@ script = ExtResource("1_7xljh")
 
 [node name="StateChartDebugger" parent="." instance=ExtResource("2_umojb")]
 offset_left = -685.0
-offset_top = -476.0
+offset_top = -502.0
 offset_right = 690.0
-offset_bottom = 464.0
+offset_bottom = 503.0
 size_flags_horizontal = 4
 size_flags_vertical = 4
 initial_node_to_watch = NodePath("../StateChart")

Godot Exploration - 2d/BouncingBalls/semantics_test.gd → Godot Exploration - 2d/semantic_testing/semantics_test.gd


Godot Exploration - 2d/BouncingBalls/semantics_test.gd.uid → Godot Exploration - 2d/semantic_testing/semantics_test.gd.uid


+ 1 - 1
Godot Exploration - 2d/BouncingBalls/semantics_tests.tscn

@@ -1,6 +1,6 @@
 [gd_scene load_steps=8 format=3 uid="uid://c763m4x7kqnwh"]
 
-[ext_resource type="Script" uid="uid://sqfqbmefkx8i" path="res://BouncingBalls/semantics_test.gd" id="1_tdwt6"]
+[ext_resource type="Script" uid="uid://sqfqbmefkx8i" path="res://semantic_testing/semantics_test.gd" id="1_tdwt6"]
 [ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="2_4hxua"]
 [ext_resource type="Script" uid="uid://cau6j0o0julfq" path="res://addons/godot_state_charts/state_chart.gd" id="3_agnct"]
 [ext_resource type="Script" uid="uid://dtlmgewt76wtf" path="res://addons/godot_state_charts/parallel_state.gd" id="4_6wxnv"]

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 616 - 0
illustrations/drawio/SemanticTesting.drawio


BIN
illustrations/images/BigStepMaximality-original.PNG


BIN
illustrations/images/ComboStepMaximality-original.PNG


BIN
illustrations/images/GodotCodingExample.PNG


BIN
illustrations/images/GodotEnvironment.PNG


BIN
illustrations/images/InputEventLifeLine.PNG


BIN
illustrations/images/InputEventLifeline-original.PNG


BIN
illustrations/images/InternalEventLifeline-original.PNG


BIN
illustrations/images/LayersOfAbstraction.PNG


BIN
illustrations/images/coord_exp_quadrant.PNG


BIN
illustrations/images/lightswitch_example.PNG


BIN
illustrations/images/lightswitch_example_godot.PNG


BIN
illustrations/images/semantic_output.PNG