From 364babd356eb6bb180ec59c97d482d4c1fec9725 Mon Sep 17 00:00:00 2001 From: Panthavma Date: Sun, 25 Jun 2023 22:45:37 +0200 Subject: [PATCH] Bringing Kronian Titans performance optimizations and profiler, plus some other improvments. v0.53.2 update --- assets/icons/editor/stateflags/EFLock.png | Bin 0 -> 358 bytes .../icons/editor/stateflags/EFLock.png.import | 35 ++ assets/icons/editor/stateflags/EFTODOANIM.png | Bin 0 -> 505 bytes .../editor/stateflags/EFTODOANIM.png.import | 35 ++ assets/icons/editor/stateflags/EFTODOBUG.png | Bin 0 -> 473 bytes .../editor/stateflags/EFTODOBUG.png.import | 35 ++ .../icons/editor/stateflags/EFTODODESIGN.png | Bin 0 -> 473 bytes .../editor/stateflags/EFTODODESIGN.png.import | 35 ++ .../editor/stateflags/EFTODOFRAMEDATA.png | Bin 0 -> 449 bytes .../stateflags/EFTODOFRAMEDATA.png.import | 35 ++ .../editor/stateflags/EFTODOMOMENTUM.png | Bin 0 -> 451 bytes .../stateflags/EFTODOMOMENTUM.png.import | 35 ++ .../icons/editor/stateflags/EFTODOSOUND.png | Bin 0 -> 462 bytes .../editor/stateflags/EFTODOSOUND.png.import | 35 ++ assets/icons/editor/stateflags/EFTODOVFX.png | Bin 0 -> 496 bytes .../editor/stateflags/EFTODOVFX.png.import | 35 ++ editor/CastagneEditorCharacter.tscn | 334 +++++++---- editor/tools/CETool-Compile.gd | 8 +- editor/tools/CETool-Inputs.tscn | 6 +- editor/tools/CETool-Perf.gd | 110 ++++ editor/tools/CETool-Perf.tscn | 524 ++++++++++++++++++ example/fighter/baston/Baston.casp | 2 +- modules/CastagneModule.gd | 12 + modules/castagne/CMEditor.gd | 46 +- modules/coreset/Base-Attacks.casp | 21 +- modules/coreset/CMCore.gd | 12 +- modules/coreset/CMInput.gd | 38 +- modules/physics/CMPhysics2D.gd | 165 +++--- 28 files changed, 1323 insertions(+), 235 deletions(-) create mode 100644 assets/icons/editor/stateflags/EFLock.png create mode 100644 assets/icons/editor/stateflags/EFLock.png.import create mode 100644 assets/icons/editor/stateflags/EFTODOANIM.png create mode 100644 assets/icons/editor/stateflags/EFTODOANIM.png.import create mode 100644 assets/icons/editor/stateflags/EFTODOBUG.png create mode 100644 assets/icons/editor/stateflags/EFTODOBUG.png.import create mode 100644 assets/icons/editor/stateflags/EFTODODESIGN.png create mode 100644 assets/icons/editor/stateflags/EFTODODESIGN.png.import create mode 100644 assets/icons/editor/stateflags/EFTODOFRAMEDATA.png create mode 100644 assets/icons/editor/stateflags/EFTODOFRAMEDATA.png.import create mode 100644 assets/icons/editor/stateflags/EFTODOMOMENTUM.png create mode 100644 assets/icons/editor/stateflags/EFTODOMOMENTUM.png.import create mode 100644 assets/icons/editor/stateflags/EFTODOSOUND.png create mode 100644 assets/icons/editor/stateflags/EFTODOSOUND.png.import create mode 100644 assets/icons/editor/stateflags/EFTODOVFX.png create mode 100644 assets/icons/editor/stateflags/EFTODOVFX.png.import create mode 100644 editor/tools/CETool-Perf.gd create mode 100644 editor/tools/CETool-Perf.tscn diff --git a/assets/icons/editor/stateflags/EFLock.png b/assets/icons/editor/stateflags/EFLock.png new file mode 100644 index 0000000000000000000000000000000000000000..c84004c16091739fd9d2ad860c05905e9f447235 GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7a$D;Kb?2i11Zh|kH}&M z25w;xW@MN(M*=9wUgGKN%Kn^9jKkVAax2>{ppa~4NJNQqer|4RUI~!Pz~Eeznpl#W zqEMb$lA+-4=^K!um&y(lKjrD-7!q;#?ev4ZEQ%biKPPJ*meM^Y^|sk|r=go;OsxKd ziWwdM)S1~F-5$@0nC0HF;SKw01E(v0d=xfti8CrPc`Hn^5Ed-dE-d%gUhk*AE} zHTB3|hC;t>9#e#QloqUe>ynU_8(tF@!8B1}-b$ZXk0nc=%vQX&_qp@*w^#GF%LYn> zNbF0E@LH#9{PvnLN7-o+#YeK1=dS$G@~PeM+VTMd9|RT1GAuUxGb7>hGUqDpIbz}Q n&b!^$?>)T#*Ma%>JD0y<&M5ra9K0;~AjrF(u6{1-oD!MeuupPQSSR|4cRFgO>bCYGe8 zD3oWGWGJ|M`Ua%vrLr?HFvfbiIEF+VJ{le?)TY4Ub1b>!7~f;bz3lhB&D>7+r+v1( z>@BrngWi-KV)vS~-@4xtTVEqp#$TkHxL8bsQ%U)8roB)5CB{=cOrlJMQt7;`*Drlr zSNv(sCjRr6Joer?uIn6gx>ba=$4Fbecaqz*<@`x)&L*etZIRDBx^}_a^RF*6{JNBp zdTR4ATgL1=FJzVFF0?#mH#+d`%DJrSV8$Bwc_p~ppa~4NJNQqer|4RUI~!Pz~Eeznpl#W zqEMb$lA+-4=^K!um&(q-z-a5~;usQf_-Ob=-XjVeqK_rcy)ZcULheq#X^V4!cl0E+ zy_c10ZRA8Ygz|K=?Q|&Ec13o!^v0_nT2xP3K3ODpBCyzXnf39=tPNMQbKl(dRNh`8 zaL0ioTK1(iuhKia1DBnfD^wX~mG|E{{$XRSoWrh2-S^4|JkvAVw3#Mwf7!MC>34NE zAuHoUYTjj{jzM#SrR{|zd%gowHhV94S_gS~zHId}@@f_4OZ!z|b1SmooJqYa>(<85 z>Unfx)>bHL)Z$ zMWH;iBtya7(>EYRFO{8vfzj5}#W5t}@Yyg&p~DIsF2~cK^w##|f06$pWIRPlKy}-h zCzB*%A|gC)Xf<8F^wCQo=V?if+>x+{oZ6EU(lCwRGpOm=vd)gV51spLY} z8$Vwwym-2}=}1`M>q$u`*C}~i_Nri;;KDG;SdOt&z?A!gc=HQoW+8vE{qy`bhHT21 zD0J4HD=Af~=+`E-jg!t@ZrozkamDOO;KhxvXST%!REAcp(a~kRuw&}7#PgS4B(1FV zZn-x(uT%cG+}iJYTZ7y_zj>6oG3U^}X)eRVTXVLpeOjNM&wMx6HIbvH7Zk#t Lu6{1-oD!MtBhJ zlTu56Jh7D%({SaQ%lMo%vGBp%8!;Z5ZL*D9pA^KsYTK0MtzE3XT+DPzQeD`!-U}L! z3mUXV7m0A!#t9sMA+KU9b3~cJ;=T3``$MNcS~1LdGwr#yf@^x^u^@)X5=oZ(ceFjW zqvSNsAZPT21P4{l>hC}a{O0ecW z*z_oJeffE&)mPKrH~Df!WxW@DD$?L}zJ9JUnfx)>bHL)Z$ zMWH;iBtya7(>EYRFO{8vfl=Ml#W5t}@ZGSBysZWtIiAN0+}dCE+-0s`^H4Ep$%>QN zkEWkubbo*1hL+mnlc#3|f6%Oc@UZPc?pe&(7NZnFeuImqvt$HMxZ zFGcd?Iwg<(sw19~FNKfVe`We}sH09}!j+t9@!o~CD*|RcTdlbJb(`(J5QPjO?Uy#D zDys#brk=gK=gjp9;jX#YU$+H`Cxlh#98?fBl#B`0BPKx#K0K?uXS<^)EhN^+)q~ pPs!>3?Cl3qV&+WecrbHrBJ-p}k=_&E?(qhNrKhW(%Q~loCIH2GxTpXC literal 0 HcmV?d00001 diff --git a/assets/icons/editor/stateflags/EFTODOMOMENTUM.png.import b/assets/icons/editor/stateflags/EFTODOMOMENTUM.png.import new file mode 100644 index 0000000..34801bb --- /dev/null +++ b/assets/icons/editor/stateflags/EFTODOMOMENTUM.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/EFTODOMOMENTUM.png-53a6f8499d512048f5ea327eb99e3fca.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://castagne/assets/icons/editor/stateflags/EFTODOMOMENTUM.png" +dest_files=[ "res://.import/EFTODOMOMENTUM.png-53a6f8499d512048f5ea327eb99e3fca.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=2 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=0 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/icons/editor/stateflags/EFTODOSOUND.png b/assets/icons/editor/stateflags/EFTODOSOUND.png new file mode 100644 index 0000000000000000000000000000000000000000..b755b5e1e407fc015a18be0756a3079ff4041dbe GIT binary patch literal 462 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7a$D;Kb?2i11Zh|kH}&M z25w;xW@MN(M*=9wUgGKN%Kn^9Ow`)y?icM0ppa~4NJNQqer|4RUI~!Pz~Eeznpl#W zqEMb$lA+-4=^K!um&(q-z-Z*@;usQf_-Ob=-lGZ}B8MgBZai$UxcWm~mU9QwqHiCs zhkR`KypDBM>m=g`yA*TzYJ_HUubft*v|+l;x@g;gvfS+Sc~4BFc&}c%xA%40F%4z* z1AAo`Mcw=8>iFa)Z;_465p{+icgoM$Ew?{@pYg$?+@JfHCzVV~%VE9Xaoyp=;l(X3 z-esbWK~pEZkKUyl^L59s%I^``ie4)MLqoU=`$}rqVnW?Y?p@ZMDQtQ=b(X(O<$2!J zr+iAnG3F`0N!3>8c{`;imhHIad1b;U-=?dd#C$@}eqJ12QN<*pxK1Yh-y`XOET;N% z@h|q;lz4T8Z?${Fx_j01C&u}W$G%M!>^ZO?r`&(WEgtuTJ?4w9b6)1wS-#n!Cni|> zwAuA7|Ma&RTP3*_Fdf+*gm49GhRs3uHw6^4e^a1`1YBS3j3^P67`;usQf_-OcT-XjV;${mJQ$?b`5-%k7$dGbu?UhYIc ztFMl8EH-KucD=C@msQ_+Ry#)8T>gp3U19Bv*_R8$m`|UPh3Vg+jy#c!tZk>>7w|{SEb8h}DBHDgz2}<1sYxEI-L9y* zJgAA8{WoT*m_+1S10}1d0$!ed%(Wr^ls)b@Z@HdVn9P$Ccw=eHR>3O`C*P!Q-L`un z+lEr!mmiqf{f&d)%K3F(buO9nM7!Nj#`v^)$i9tVy!h`_>0H?~XJP_(&b??q-wf8n zH_z#BpT(aud+Mgu@orZp&osLq^(|=2G=3E^2j5K}XI*nXo$jQq>^jR=YdK?z)S83| jwqIYd@iINQdwheuDWhIlQQwvKpn&&u^>bP0l+XkKEw98I literal 0 HcmV?d00001 diff --git a/assets/icons/editor/stateflags/EFTODOVFX.png.import b/assets/icons/editor/stateflags/EFTODOVFX.png.import new file mode 100644 index 0000000..c4929d7 --- /dev/null +++ b/assets/icons/editor/stateflags/EFTODOVFX.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/EFTODOVFX.png-7aade965119a96d27b75a339522b40f2.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://castagne/assets/icons/editor/stateflags/EFTODOVFX.png" +dest_files=[ "res://.import/EFTODOVFX.png-7aade965119a96d27b75a339522b40f2.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=2 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=0 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/editor/CastagneEditorCharacter.tscn b/editor/CastagneEditorCharacter.tscn index 9423602..fc11781 100644 --- a/editor/CastagneEditorCharacter.tscn +++ b/editor/CastagneEditorCharacter.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://castagne/editor/CastagneEditorCharacterEdit.gd" type="Script" id=1] [ext_resource path="res://castagne/editor/EditorTheme.tres" type="Theme" id=2] [ext_resource path="res://castagne/editor/MovingBackground.tres" type="Material" id=3] [ext_resource path="res://castagne/editor/CharacterEditor/CECPopupNewState.gd" type="Script" id=4] [ext_resource path="res://icon.png" type="Texture" id=5] +[ext_resource path="res://castagne/assets/icons/editor/stateflags/EFLock.png" type="Texture" id=6] [ext_resource path="res://castagne/editor/CharacterEditor/CECCodeWarning.tscn" type="PackedScene" id=12] [ext_resource path="res://castagne/editor/CharacterEditor/CECPopupRenameState.gd" type="Script" id=13] [ext_resource path="res://castagne/editor/CharacterEditor/CECPopupNewEntity.gd" type="Script" id=14] @@ -46,24 +47,24 @@ __meta__ = { } [node name="EngineVPC" type="ViewportContainer" parent="EngineVP"] -margin_top = 56.027 -margin_right = 768.0 -margin_bottom = 487.973 +margin_top = 92.0405 +margin_right = 1152.0 +margin_bottom = 739.959 stretch = true __meta__ = { "_edit_use_anchors_": false } [node name="Viewport" type="Viewport" parent="EngineVP/EngineVPC"] -size = Vector2( 768, 431 ) +size = Vector2( 1152, 647 ) handle_input_locally = false render_target_update_mode = 3 gui_disable_input = true [node name="FocusEngine" type="ToolButton" parent="EngineVP"] -margin_top = 56.027 -margin_right = 768.0 -margin_bottom = 487.973 +margin_top = 92.0405 +margin_right = 1152.0 +margin_bottom = 739.959 action_mode = 0 [node name="TopBar" type="Panel" parent="."] @@ -88,7 +89,7 @@ text = "Save" [node name="Label" type="Label" parent="TopBar/HBoxContainer"] margin_left = 99.0 -margin_right = 768.0 +margin_right = 1152.0 margin_bottom = 32.0 size_flags_horizontal = 3 size_flags_vertical = 1 @@ -146,18 +147,18 @@ __meta__ = { [node name="Match" type="VBoxContainer" parent="BottomPanel/BMiniPanel/HBox"] margin_right = 148.0 -margin_bottom = 128.0 +margin_bottom = 200.0 [node name="ResetExecuteMove" type="Button" parent="BottomPanel/BMiniPanel/HBox/Match"] margin_right = 148.0 -margin_bottom = 38.0 +margin_bottom = 110.0 size_flags_vertical = 3 text = "Execute Move" [node name="ExecuteMoveData" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Match"] -margin_top = 42.0 +margin_top = 114.0 margin_right = 148.0 -margin_bottom = 62.0 +margin_bottom = 134.0 [node name="MoveToExec" type="LineEdit" parent="BottomPanel/BMiniPanel/HBox/Match/ExecuteMoveData"] margin_right = 64.0 @@ -175,9 +176,9 @@ allow_greater = true allow_lesser = true [node name="Reset1" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Match"] -margin_top = 66.0 +margin_top = 138.0 margin_right = 148.0 -margin_bottom = 84.0 +margin_bottom = 156.0 [node name="ResetGround" type="Button" parent="BottomPanel/BMiniPanel/HBox/Match/Reset1"] margin_right = 72.0 @@ -201,9 +202,9 @@ __meta__ = { } [node name="Reset2" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Match"] -margin_top = 88.0 +margin_top = 160.0 margin_right = 148.0 -margin_bottom = 106.0 +margin_bottom = 178.0 [node name="ResetCorner" type="Button" parent="BottomPanel/BMiniPanel/HBox/Match/Reset2"] margin_right = 72.0 @@ -227,9 +228,9 @@ toggle_mode = true text = "Focus on character" [node name="MatchType" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Match"] -margin_top = 110.0 +margin_top = 182.0 margin_right = 148.0 -margin_bottom = 128.0 +margin_bottom = 200.0 [node name="ResetMatchTraining" type="Button" parent="BottomPanel/BMiniPanel/HBox/Match/MatchType"] margin_right = 148.0 @@ -250,16 +251,16 @@ text = "Normal" [node name="Middle" type="VBoxContainer" parent="BottomPanel/BMiniPanel/HBox"] margin_left = 152.0 -margin_right = 673.0 -margin_bottom = 128.0 +margin_right = 1057.0 +margin_bottom = 200.0 size_flags_horizontal = 3 [node name="TopBar" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Middle"] -margin_right = 521.0 +margin_right = 905.0 margin_bottom = 18.0 [node name="Flow" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Middle/TopBar"] -margin_right = 250.0 +margin_right = 634.0 margin_bottom = 18.0 size_flags_horizontal = 3 @@ -291,8 +292,8 @@ margin_bottom = 18.0 text = "Next Frame" [node name="VSeparator" type="VSeparator" parent="BottomPanel/BMiniPanel/HBox/Middle/TopBar"] -margin_left = 254.0 -margin_right = 258.0 +margin_left = 638.0 +margin_right = 642.0 margin_bottom = 18.0 [node name="Phase" type="Label" parent="BottomPanel/BMiniPanel/HBox/Middle/TopBar"] @@ -318,8 +319,8 @@ margin_bottom = 20.0 text = "T" [node name="Other" type="HBoxContainer" parent="BottomPanel/BMiniPanel/HBox/Middle/TopBar"] -margin_left = 262.0 -margin_right = 521.0 +margin_left = 646.0 +margin_right = 905.0 margin_bottom = 18.0 [node name="Blocking" type="Button" parent="BottomPanel/BMiniPanel/HBox/Middle/TopBar/Other"] @@ -353,35 +354,35 @@ text = "Hide Gizmos" [node name="MiniTool" type="Control" parent="BottomPanel/BMiniPanel/HBox/Middle"] margin_top = 22.0 -margin_right = 521.0 -margin_bottom = 128.0 +margin_right = 905.0 +margin_bottom = 200.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Reload" type="VBoxContainer" parent="BottomPanel/BMiniPanel/HBox"] -margin_left = 677.0 -margin_right = 736.0 -margin_bottom = 128.0 +margin_left = 1061.0 +margin_right = 1120.0 +margin_bottom = 200.0 [node name="Reload" type="Button" parent="BottomPanel/BMiniPanel/HBox/Reload"] margin_right = 59.0 -margin_bottom = 84.0 +margin_bottom = 156.0 size_flags_vertical = 3 shortcut = SubResource( 4 ) text = "Reload" [node name="ChangeTool" type="Button" parent="BottomPanel/BMiniPanel/HBox/Reload"] -margin_top = 88.0 +margin_top = 160.0 margin_right = 59.0 -margin_bottom = 106.0 +margin_bottom = 178.0 rect_pivot_offset = Vector2( 10, 10 ) size_flags_horizontal = 3 text = "Tools" [node name="BigToolExpand" type="Button" parent="BottomPanel/BMiniPanel/HBox/Reload"] -margin_top = 110.0 +margin_top = 182.0 margin_right = 59.0 -margin_bottom = 128.0 +margin_bottom = 200.0 rect_pivot_offset = Vector2( 10, 10 ) size_flags_horizontal = 3 text = "^^" @@ -489,19 +490,19 @@ scroll_horizontal_enabled = false [node name="PanelContainer" type="PanelContainer" parent="CodePanel/CustomEditor"] self_modulate = Color( 0.701961, 0.517647, 0.0235294, 1 ) -margin_right = 496.0 -margin_bottom = 424.0 +margin_right = 752.0 +margin_bottom = 676.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="List" type="VBoxContainer" parent="CodePanel/CustomEditor/PanelContainer"] margin_left = 7.0 margin_top = 7.0 -margin_right = 489.0 -margin_bottom = 417.0 +margin_right = 745.0 +margin_bottom = 669.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List"] -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 14.0 text = "Main Variables" align = 1 @@ -509,24 +510,24 @@ valign = 2 [node name="HSeparator" type="HSeparator" parent="CodePanel/CustomEditor/PanelContainer/List"] margin_top = 18.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 22.0 [node name="Test" type="HBoxContainer" parent="CodePanel/CustomEditor/PanelContainer/List"] margin_top = 26.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 50.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test"] margin_top = 5.0 -margin_right = 239.0 +margin_right = 367.0 margin_bottom = 19.0 size_flags_horizontal = 3 text = "Animation Name" [node name="TextEdit" type="TextEdit" parent="CodePanel/CustomEditor/PanelContainer/List/Test"] -margin_left = 243.0 -margin_right = 482.0 +margin_left = 371.0 +margin_right = 738.0 margin_bottom = 24.0 rect_min_size = Vector2( 0, 24 ) size_flags_horizontal = 3 @@ -534,118 +535,118 @@ text = "Stand" [node name="Test2" type="HBoxContainer" parent="CodePanel/CustomEditor/PanelContainer/List"] margin_top = 54.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 78.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test2"] margin_top = 5.0 -margin_right = 239.0 +margin_right = 367.0 margin_bottom = 19.0 size_flags_horizontal = 3 text = "Frame Advantage" [node name="TextEdit" type="SpinBox" parent="CodePanel/CustomEditor/PanelContainer/List/Test2"] -margin_left = 243.0 -margin_right = 482.0 +margin_left = 371.0 +margin_right = 738.0 margin_bottom = 24.0 rect_min_size = Vector2( 0, 24 ) size_flags_horizontal = 3 [node name="Test3" type="HBoxContainer" parent="CodePanel/CustomEditor/PanelContainer/List"] margin_top = 82.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 106.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test3"] margin_top = 5.0 -margin_right = 239.0 +margin_right = 367.0 margin_bottom = 19.0 size_flags_horizontal = 3 text = "Damage" [node name="TextEdit" type="SpinBox" parent="CodePanel/CustomEditor/PanelContainer/List/Test3"] -margin_left = 243.0 -margin_right = 482.0 +margin_left = 371.0 +margin_right = 738.0 margin_bottom = 24.0 rect_min_size = Vector2( 0, 24 ) size_flags_horizontal = 3 [node name="Test4" type="VBoxContainer" parent="CodePanel/CustomEditor/PanelContainer/List"] margin_top = 110.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 172.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test4"] -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 14.0 text = "Hurtbox" align = 1 [node name="HBoxContainer" type="HBoxContainer" parent="CodePanel/CustomEditor/PanelContainer/List/Test4"] margin_top = 18.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 38.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer"] margin_top = 3.0 -margin_right = 117.0 +margin_right = 181.0 margin_bottom = 17.0 size_flags_horizontal = 3 text = "Back" align = 2 [node name="SpinBox" type="SpinBox" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer"] -margin_left = 121.0 -margin_right = 239.0 +margin_left = 185.0 +margin_right = 367.0 margin_bottom = 20.0 size_flags_horizontal = 3 [node name="Label2" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer"] -margin_left = 243.0 +margin_left = 371.0 margin_top = 3.0 -margin_right = 360.0 +margin_right = 552.0 margin_bottom = 17.0 size_flags_horizontal = 3 text = "Front" align = 2 [node name="SpinBox2" type="SpinBox" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer"] -margin_left = 364.0 -margin_right = 482.0 +margin_left = 556.0 +margin_right = 738.0 margin_bottom = 20.0 size_flags_horizontal = 3 [node name="HBoxContainer2" type="HBoxContainer" parent="CodePanel/CustomEditor/PanelContainer/List/Test4"] margin_top = 42.0 -margin_right = 482.0 +margin_right = 738.0 margin_bottom = 62.0 [node name="Label" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer2"] margin_top = 3.0 -margin_right = 117.0 +margin_right = 181.0 margin_bottom = 17.0 size_flags_horizontal = 3 text = "Bottom" align = 2 [node name="SpinBox" type="SpinBox" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer2"] -margin_left = 121.0 -margin_right = 239.0 +margin_left = 185.0 +margin_right = 367.0 margin_bottom = 20.0 size_flags_horizontal = 3 [node name="Label2" type="Label" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer2"] -margin_left = 243.0 +margin_left = 371.0 margin_top = 3.0 -margin_right = 360.0 +margin_right = 552.0 margin_bottom = 17.0 size_flags_horizontal = 3 text = "Top" align = 2 [node name="SpinBox2" type="SpinBox" parent="CodePanel/CustomEditor/PanelContainer/List/Test4/HBoxContainer2"] -margin_left = 364.0 -margin_right = 482.0 +margin_left = 556.0 +margin_right = 738.0 margin_bottom = 20.0 size_flags_horizontal = 3 @@ -678,8 +679,8 @@ __meta__ = { } [node name="List" type="VBoxContainer" parent="CodePanel/WarningsList"] -margin_right = 472.0 -margin_bottom = 324.0 +margin_right = 728.0 +margin_bottom = 522.0 size_flags_horizontal = 3 size_flags_vertical = 3 alignment = 2 @@ -773,7 +774,7 @@ __meta__ = { } [node name="List" type="VBoxContainer" parent="CodePanel/Navigation/ChooseState/StateList/Scroll"] -margin_right = 724.0 +margin_right = 1108.0 size_flags_horizontal = 3 __meta__ = { "_edit_use_anchors_": false @@ -791,7 +792,7 @@ __meta__ = { } [node name="Label" type="Label" parent="CodePanel/Navigation/ChooseState/Menu"] -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 14.0 text = "--- State Management ---" align = 1 @@ -799,7 +800,7 @@ valign = 2 [node name="OpenState" type="Button" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 18.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 36.0 text = "Open State" __meta__ = { @@ -808,13 +809,13 @@ __meta__ = { [node name="NewState" type="Button" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 40.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 58.0 text = "New State" [node name="NewEntity" type="Button" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 62.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 80.0 text = "New Entity" __meta__ = { @@ -823,7 +824,7 @@ __meta__ = { [node name="OverrideState" type="Button" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 84.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 102.0 disabled = true text = "Override State" @@ -833,7 +834,7 @@ __meta__ = { [node name="RenameState" type="Button" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 106.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 124.0 disabled = true text = "Rename State" @@ -843,14 +844,14 @@ __meta__ = { [node name="DeleteState" type="Button" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 128.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 146.0 disabled = true text = "Delete State" [node name="Space" type="Label" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 150.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 164.0 size_flags_vertical = 9 text = " " @@ -859,7 +860,7 @@ valign = 2 [node name="CatFiler" type="Label" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 168.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 182.0 size_flags_vertical = 9 text = "--- Filtering (X/Y) ---" @@ -868,25 +869,25 @@ valign = 2 [node name="OpenCloseStates" type="HBoxContainer" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 186.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 204.0 [node name="NavOpenCategories" type="Button" parent="CodePanel/Navigation/ChooseState/Menu/OpenCloseStates"] -margin_right = 122.0 +margin_right = 180.0 margin_bottom = 18.0 size_flags_horizontal = 3 text = "Open Categories" [node name="NavCloseCategories" type="Button" parent="CodePanel/Navigation/ChooseState/Menu/OpenCloseStates"] -margin_left = 126.0 -margin_right = 243.0 +margin_left = 184.0 +margin_right = 364.0 margin_bottom = 18.0 size_flags_horizontal = 3 text = "Close" [node name="ToggleHelpers" type="CheckButton" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 208.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 244.0 pressed = true text = "Show helpers with states" @@ -897,7 +898,7 @@ __meta__ = { [node name="ToggleShowVariables" type="CheckButton" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 248.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 284.0 text = "Show all variables" align = 2 @@ -907,7 +908,7 @@ __meta__ = { [node name="ToggleOverridableStates" type="CheckButton" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 288.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 324.0 text = "Show overridable states" align = 2 @@ -917,7 +918,7 @@ __meta__ = { [node name="ToggleAllStates" type="CheckButton" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 328.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 364.0 text = "Show from all files" align = 2 @@ -927,7 +928,7 @@ __meta__ = { [node name="FilterNumber" type="Label" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 368.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 382.0 size_flags_vertical = 9 text = "Filter by Flag" @@ -936,7 +937,7 @@ valign = 2 [node name="ToggleShowAllFlags" type="CheckButton" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 386.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 422.0 text = "Show unused flags" align = 2 @@ -946,12 +947,12 @@ __meta__ = { [node name="Flags" type="GridContainer" parent="CodePanel/Navigation/ChooseState/Menu"] margin_top = 426.0 -margin_right = 243.0 +margin_right = 364.0 margin_bottom = 462.0 columns = 4 [node name="Button2" type="Button" parent="CodePanel/Navigation/ChooseState/Menu/Flags"] -margin_right = 61.0 +margin_right = 91.0 margin_bottom = 36.0 rect_min_size = Vector2( 36, 36 ) size_flags_horizontal = 3 @@ -961,9 +962,9 @@ clip_text = true expand_icon = true [node name="Spacer" type="Label" parent="CodePanel/Navigation/ChooseState/Menu"] -margin_top = 470.0 -margin_right = 243.0 -margin_bottom = 484.0 +margin_top = 730.0 +margin_right = 364.0 +margin_bottom = 744.0 size_flags_vertical = 10 align = 1 valign = 2 @@ -1516,23 +1517,146 @@ margin_right = -8.0 margin_bottom = -8.0 [node name="TutorialContinue" type="Button" parent="Popups/Window/Tutorial/Buttons"] -margin_right = 520.0 +margin_right = 904.0 margin_bottom = 40.0 size_flags_horizontal = 3 text = "Continue Tutorial / Skip" [node name="TutorialReset" type="Button" parent="Popups/Window/Tutorial/Buttons"] -margin_left = 524.0 -margin_right = 652.0 +margin_left = 908.0 +margin_right = 1036.0 margin_bottom = 40.0 text = "Reset CASP script" [node name="TutorialQuit" type="Button" parent="Popups/Window/Tutorial/Buttons"] -margin_left = 656.0 -margin_right = 752.0 +margin_left = 1040.0 +margin_right = 1136.0 margin_bottom = 40.0 text = "Quit Tutorial" +[node name="MoveState" type="Panel" parent="Popups/Window"] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="Title" type="Label" parent="Popups/Window/MoveState"] +anchor_right = 1.0 +margin_bottom = 24.0 +text = "Move State" +align = 1 +valign = 1 + +[node name="States" type="VBoxContainer" parent="Popups/Window/MoveState"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 16.0 +margin_top = 24.0 +margin_right = -16.0 +margin_bottom = -56.0 +alignment = 1 + +[node name="ProtoDefine" type="HBoxContainer" parent="Popups/Window/MoveState/States"] +margin_top = 250.0 +margin_right = 1120.0 +margin_bottom = 282.0 +rect_min_size = Vector2( 0, 32 ) +alignment = 1 + +[node name="Lock" type="TextureRect" parent="Popups/Window/MoveState/States/ProtoDefine"] +margin_right = 32.0 +margin_bottom = 32.0 +texture = ExtResource( 6 ) + +[node name="Unlock" type="Control" parent="Popups/Window/MoveState/States/ProtoDefine"] +visible = false +margin_left = 36.0 +margin_right = 68.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 0 ) + +[node name="Color" type="ColorRect" parent="Popups/Window/MoveState/States/ProtoDefine"] +margin_left = 36.0 +margin_right = 753.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +color = Color( 0.0235294, 0.254902, 0.0156863, 1 ) + +[node name="File" type="Label" parent="Popups/Window/MoveState/States/ProtoDefine/Color"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "res://filepath/of/file.casp" +align = 1 +valign = 1 + +[node name="MoveUp" type="Button" parent="Popups/Window/MoveState/States/ProtoDefine"] +margin_left = 757.0 +margin_right = 936.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.5 +text = "Move Up" + +[node name="MoveDown" type="Button" parent="Popups/Window/MoveState/States/ProtoDefine"] +margin_left = 940.0 +margin_right = 1120.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.5 +text = "Move Down" + +[node name="ProtoUndef" type="HBoxContainer" parent="Popups/Window/MoveState/States"] +margin_top = 286.0 +margin_right = 1120.0 +margin_bottom = 318.0 +rect_min_size = Vector2( 0, 32 ) +alignment = 1 + +[node name="Lock" type="TextureRect" parent="Popups/Window/MoveState/States/ProtoUndef"] +visible = false +margin_right = 32.0 +margin_bottom = 32.0 +texture = ExtResource( 6 ) + +[node name="Unlock" type="Control" parent="Popups/Window/MoveState/States/ProtoUndef"] +margin_right = 32.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 0 ) + +[node name="Color" type="ColorRect" parent="Popups/Window/MoveState/States/ProtoUndef"] +margin_left = 36.0 +margin_right = 756.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +color = Color( 0.254902, 0.0156863, 0.0156863, 1 ) + +[node name="File" type="Label" parent="Popups/Window/MoveState/States/ProtoUndef/Color"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "res://filepath/of/file.casp" +align = 1 +valign = 1 + +[node name="Override" type="Button" parent="Popups/Window/MoveState/States/ProtoUndef"] +margin_left = 760.0 +margin_right = 1120.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +text = "Override" + +[node name="Buttons" type="HBoxContainer" parent="Popups/Window/MoveState"] +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 8.0 +margin_top = -48.0 +margin_right = -8.0 +margin_bottom = -8.0 + [connection signal="pressed" from="EngineVP/FocusEngine" to="." method="FocusGame"] [connection signal="pressed" from="TopBar/HBoxContainer/Back" to="." method="_on_Back_pressed"] [connection signal="pressed" from="TopBar/HBoxContainer/Save" to="." method="_on_Save_pressed"] diff --git a/editor/tools/CETool-Compile.gd b/editor/tools/CETool-Compile.gd index 99b8b54..75d6dfa 100644 --- a/editor/tools/CETool-Compile.gd +++ b/editor/tools/CETool-Compile.gd @@ -166,10 +166,12 @@ func ParseFighterScript(script, linePrefix = ""): if(fref.get_function() in branchFunctionsFuncrefsNames): fname = fref.get_function().right(11) # InstructionX - t += fname + str(a[1][2]) + ":\n" + t += linePrefix+fname + str(a[1][2]) + ":\n" t += ParseFighterScript(a[1][0], linePrefix + " ") - t += linePrefix+"else\n" - t += ParseFighterScript(a[1][1], linePrefix + " ") + var elseT = ParseFighterScript(a[1][1], linePrefix + " ") + if(!(elseT.strip_edges().empty())): + t += linePrefix+"else\n" + t += elseT t += linePrefix+"endif\n" else: t += linePrefix + fname + "(" diff --git a/editor/tools/CETool-Inputs.tscn b/editor/tools/CETool-Inputs.tscn index 22ad976..bf9603e 100644 --- a/editor/tools/CETool-Inputs.tscn +++ b/editor/tools/CETool-Inputs.tscn @@ -15,7 +15,7 @@ __meta__ = { } [node name="Controls" type="HBoxContainer" parent="InputVisu"] -margin_right = 1280.0 +margin_right = 1920.0 margin_bottom = 24.0 rect_min_size = Vector2( 0, 24 ) @@ -49,8 +49,8 @@ text = "Device: Null" [node name="Players" type="Control" parent="InputVisu"] margin_top = 28.0 -margin_right = 1280.0 -margin_bottom = 720.0 +margin_right = 1920.0 +margin_bottom = 1080.0 size_flags_vertical = 3 [node name="Grid" type="GridContainer" parent="InputVisu/Players"] diff --git a/editor/tools/CETool-Perf.gd b/editor/tools/CETool-Perf.gd new file mode 100644 index 0000000..f8e9cf5 --- /dev/null +++ b/editor/tools/CETool-Perf.gd @@ -0,0 +1,110 @@ +extends "res://castagne/editor/tools/CastagneEditorTool.gd" + +var perfLabel +var perfBar +var perfGFXLabel +var perfPhases +var perfPhysics + +var frameTimerStart = -1 +var frameTimerTotal = -1 +var phaseTimers = {} + +func SetupTool(): + toolName = "Performance" + toolDescription = "In progress." + perfLabel = $PerfSmall/FrameTime/FrameTime + perfBar = $PerfSmall/FrameTime/BudgetBar + perfGFXLabel = $PerfSmall/FrameTime/GraphicsTime + perfPhases = $PerfSmall/Phases + perfPhysics = $PerfSmall/Physics + ResetTimer() + +func OnEngineRestarting(engine, _battleInitData): + ResetTimer() + +func OnEngineRestarted(engine): + var editorModule = engine.configData.GetModuleSlot(Castagne.MODULE_SLOTS_BASE.EDITOR) + editorModule.connect("EngineTick_FramePreStart", self, "EngineTick_FramePreStart") + editorModule.connect("EngineTick_FrameEnd", self, "EngineTick_FrameEnd") + + for p in ["Init", "Input", "Action", "Physics", "Reaction"]: + editorModule.connect("EngineTick_"+p+"Start", self, "PhaseTimerStart", [p]) + editorModule.connect("EngineTick_"+p+"StartEntity", self, "PhaseTimerStartEntity", [p]) + editorModule.connect("EngineTick_"+p+"EndEntity", self, "PhaseTimerEndEntity", [p]) + editorModule.connect("EngineTick_"+p+"End", self, "PhaseTimerEnd", [p]) + + ResetTimer() + +func OnEngineInitError(_engine): + ResetTimer() + +func ResetTimer(): + frameTimerStart=-1 + frameTimerTotal=-1 + phaseTimers = {} + perfLabel.set_text("Time unavailable") + perfGFXLabel.set_text("Update Graphics: Time unavailable") + perfBar.set_value(0) + for r in perfPhases.get_children(): + UpdatePhaseTimer(r) + UpdatePhysicsTimer() + +func PhaseTimerStart(_stateHandle, phase): + phaseTimers[phase] = { + "Start":OS.get_ticks_usec(), + "CodeStart":-1, "CodeEnd":-1, "End":-1 + } +func PhaseTimerStartEntity(_stateHandle, phase): + phaseTimers[phase]["CodeStart"] = OS.get_ticks_usec() +func PhaseTimerEndEntity(_stateHandle, phase): + if(phaseTimers[phase]["CodeEnd"] == -1): + phaseTimers[phase]["CodeEnd"] = OS.get_ticks_usec() +func PhaseTimerEnd(_stateHandle, phase): + phaseTimers[phase]["End"] = OS.get_ticks_usec() + +func UpdatePhaseTimer(phaseRoot): + var phaseName = phaseRoot.get_name() + if(!phaseTimers.has(phaseName)): + phaseRoot.get_node("TotalTime").set_text("/") + phaseRoot.get_node("StartTime").set_text("/") + phaseRoot.get_node("CodeTime").set_text("/") + phaseRoot.get_node("EndTime").set_text("/") + return + var phaseData = phaseTimers[phaseName] + + phaseRoot.get_node("TotalTime").set_text(str((phaseData["End"] - phaseData["Start"])/1000.0) + "ms") + phaseRoot.get_node("StartTime").set_text(str((phaseData["CodeStart"] - phaseData["Start"])/1000.0) + "ms") + phaseRoot.get_node("CodeTime").set_text(str((phaseData["CodeEnd"] - phaseData["CodeStart"])/1000.0) + "ms") + phaseRoot.get_node("EndTime").set_text(str((phaseData["End"] - phaseData["CodeEnd"])/1000.0) + "ms") + +func UpdatePhysicsTimer(pm = null): + if(pm == null): + for n in ["Total", "Setup", "EnvTotal", "EnvSetup", "EnvMain", "AtkTotal", "AtkSetup", "AtkMain"]: + perfPhysics.get_node(n).set_text("/") + return + + perfPhysics.get_node("Total").set_text("Total: "+str((pm._castProfiling_PhysicsEnd - pm._castProfiling_PhysicsStart)/1000.0) + "ms") + perfPhysics.get_node("Setup").set_text("Physics Setup: "+str((pm._castProfiling_PhysicsSetupDone - pm._castProfiling_PhysicsStart)/1000.0) + "ms") + perfPhysics.get_node("EnvTotal").set_text("Env Total: "+str((pm._castProfiling_EnvColEnd - pm._castProfiling_PhysicsSetupDone)/1000.0) + "ms") + perfPhysics.get_node("EnvSetup").set_text("Env Setup: "+str((pm._castProfiling_Env_SetupDone - pm._castProfiling_PhysicsStart)/1000.0) + "ms") + perfPhysics.get_node("EnvMain").set_text("Env Resolve: "+str((pm._castProfiling_EnvColEnd - pm._castProfiling_Env_SetupDone)/1000.0) + "ms") + perfPhysics.get_node("AtkTotal").set_text("Attack Total: "+str((pm._castProfiling_PhysicsEnd - pm._castProfiling_EnvColEnd)/1000.0) + "ms") + perfPhysics.get_node("AtkSetup").set_text("Attack Setup: "+str((pm._castProfiling_Atk_SetupDone - pm._castProfiling_EnvColEnd)/1000.0) + "ms") + perfPhysics.get_node("AtkMain").set_text("Attack Resolve: "+str((pm._castProfiling_PhysicsEnd - pm._castProfiling_Atk_SetupDone)/1000.0) + "ms") + +func EngineTick_FramePreStart(_stateHandle): + frameTimerStart = OS.get_ticks_usec() + +func EngineTick_FrameEnd(stateHandle): + var engine = stateHandle.Engine() + #frameTimerTotal = OS.get_ticks_usec() - frameTimerStart + frameTimerTotal = OS.get_ticks_usec() - engine._castProfilingTickStart + var gfxTime = engine._castProfilingGraphicsEnd - engine._castProfilingGraphicsStart + perfLabel.set_text(str(frameTimerTotal/1000.0)+"ms") + perfGFXLabel.set_text("Update Graphics: " + str(gfxTime / 1000.0) +"ms") + perfBar.set_value(frameTimerTotal) + + UpdatePhysicsTimer(stateHandle.ConfigData().GetModuleSlot(Castagne.MODULE_SLOTS_BASE.PHYSICS)) + for r in perfPhases.get_children(): + UpdatePhaseTimer(r) diff --git a/editor/tools/CETool-Perf.tscn b/editor/tools/CETool-Perf.tscn new file mode 100644 index 0000000..5c48891 --- /dev/null +++ b/editor/tools/CETool-Perf.tscn @@ -0,0 +1,524 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://castagne/editor/tools/CETool-Perf.gd" type="Script" id=1] + +[node name="Performance" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) + +[node name="PerfSmall" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +alignment = 1 + +[node name="FrameTime" type="HBoxContainer" parent="PerfSmall"] +margin_right = 1920.0 +margin_bottom = 484.0 +size_flags_vertical = 3 + +[node name="BudgetBar" type="ProgressBar" parent="PerfSmall/FrameTime"] +margin_top = 234.0 +margin_right = 382.0 +margin_bottom = 250.0 +rect_min_size = Vector2( 0, 16 ) +size_flags_horizontal = 3 +size_flags_vertical = 4 +size_flags_stretch_ratio = 0.5 +max_value = 16600.0 +step = 1.0 +value = 50.0 + +[node name="FrameTime" type="Label" parent="PerfSmall/FrameTime"] +margin_left = 386.0 +margin_top = 235.0 +margin_right = 1151.0 +margin_bottom = 249.0 +size_flags_horizontal = 3 +text = "xx.xxxms" + +[node name="GraphicsTime" type="Label" parent="PerfSmall/FrameTime"] +margin_left = 1155.0 +margin_top = 235.0 +margin_right = 1920.0 +margin_bottom = 249.0 +size_flags_horizontal = 3 +text = "Graphics: xx.xxxms" + +[node name="Physics" type="GridContainer" parent="PerfSmall"] +margin_top = 488.0 +margin_right = 1920.0 +margin_bottom = 972.0 +size_flags_vertical = 3 +columns = 3 + +[node name="Total" type="Label" parent="PerfSmall/Physics"] +margin_right = 638.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="Setup" type="Label" parent="PerfSmall/Physics"] +margin_left = 642.0 +margin_right = 1279.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +text = "Setup: XX.xxms" + +[node name="Total3" type="Label" parent="PerfSmall/Physics"] +margin_left = 1283.0 +margin_right = 1920.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 + +[node name="EnvTotal" type="Label" parent="PerfSmall/Physics"] +margin_top = 18.0 +margin_right = 638.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="EnvSetup" type="Label" parent="PerfSmall/Physics"] +margin_left = 642.0 +margin_top = 18.0 +margin_right = 1279.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="EnvMain" type="Label" parent="PerfSmall/Physics"] +margin_left = 1283.0 +margin_top = 18.0 +margin_right = 1920.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="AtkTotal" type="Label" parent="PerfSmall/Physics"] +margin_top = 36.0 +margin_right = 638.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="AtkSetup" type="Label" parent="PerfSmall/Physics"] +margin_left = 642.0 +margin_top = 36.0 +margin_right = 1279.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="AtkMain" type="Label" parent="PerfSmall/Physics"] +margin_left = 1283.0 +margin_top = 36.0 +margin_right = 1920.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +text = "Total: XX.xxms" + +[node name="Phases" type="GridContainer" parent="PerfSmall"] +margin_top = 976.0 +margin_right = 1920.0 +margin_bottom = 1080.0 +columns = 2 + +[node name="Init" type="HBoxContainer" parent="PerfSmall/Phases"] +margin_right = 958.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 + +[node name="Icon" type="Control" parent="PerfSmall/Phases/Init"] +margin_right = 32.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 32 ) + +[node name="PhaseName" type="Label" parent="PerfSmall/Phases/Init"] +margin_left = 36.0 +margin_top = 9.0 +margin_right = 187.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "Init:" + +[node name="TotalTime" type="Label" parent="PerfSmall/Phases/Init"] +margin_left = 191.0 +margin_top = 9.0 +margin_right = 493.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "XX.xxms" + +[node name="StartTime" type="Label" parent="PerfSmall/Phases/Init"] +margin_left = 497.0 +margin_top = 9.0 +margin_right = 648.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="CodeTime" type="Label" parent="PerfSmall/Phases/Init"] +margin_left = 652.0 +margin_top = 9.0 +margin_right = 803.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="EndTime" type="Label" parent="PerfSmall/Phases/Init"] +margin_left = 807.0 +margin_top = 9.0 +margin_right = 958.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="Input" type="HBoxContainer" parent="PerfSmall/Phases"] +margin_left = 962.0 +margin_right = 1920.0 +margin_bottom = 32.0 +size_flags_horizontal = 3 + +[node name="Icon" type="Control" parent="PerfSmall/Phases/Input"] +margin_right = 32.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 32 ) + +[node name="PhaseName" type="Label" parent="PerfSmall/Phases/Input"] +margin_left = 36.0 +margin_top = 9.0 +margin_right = 187.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "Input:" + +[node name="TotalTime" type="Label" parent="PerfSmall/Phases/Input"] +margin_left = 191.0 +margin_top = 9.0 +margin_right = 493.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "XX.xxms" + +[node name="StartTime" type="Label" parent="PerfSmall/Phases/Input"] +margin_left = 497.0 +margin_top = 9.0 +margin_right = 648.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="CodeTime" type="Label" parent="PerfSmall/Phases/Input"] +margin_left = 652.0 +margin_top = 9.0 +margin_right = 803.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="EndTime" type="Label" parent="PerfSmall/Phases/Input"] +margin_left = 807.0 +margin_top = 9.0 +margin_right = 958.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="Action" type="HBoxContainer" parent="PerfSmall/Phases"] +margin_top = 36.0 +margin_right = 958.0 +margin_bottom = 68.0 +size_flags_horizontal = 3 + +[node name="Icon" type="Control" parent="PerfSmall/Phases/Action"] +margin_right = 32.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 32 ) + +[node name="PhaseName" type="Label" parent="PerfSmall/Phases/Action"] +margin_left = 36.0 +margin_top = 9.0 +margin_right = 187.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "Action:" + +[node name="TotalTime" type="Label" parent="PerfSmall/Phases/Action"] +margin_left = 191.0 +margin_top = 9.0 +margin_right = 493.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "XX.xxms" + +[node name="StartTime" type="Label" parent="PerfSmall/Phases/Action"] +margin_left = 497.0 +margin_top = 9.0 +margin_right = 648.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="CodeTime" type="Label" parent="PerfSmall/Phases/Action"] +margin_left = 652.0 +margin_top = 9.0 +margin_right = 803.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="EndTime" type="Label" parent="PerfSmall/Phases/Action"] +margin_left = 807.0 +margin_top = 9.0 +margin_right = 958.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="Physics" type="HBoxContainer" parent="PerfSmall/Phases"] +margin_left = 962.0 +margin_top = 36.0 +margin_right = 1920.0 +margin_bottom = 68.0 +size_flags_horizontal = 3 + +[node name="Icon" type="Control" parent="PerfSmall/Phases/Physics"] +margin_right = 32.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 32 ) + +[node name="PhaseName" type="Label" parent="PerfSmall/Phases/Physics"] +margin_left = 36.0 +margin_top = 9.0 +margin_right = 187.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "Physics:" + +[node name="TotalTime" type="Label" parent="PerfSmall/Phases/Physics"] +margin_left = 191.0 +margin_top = 9.0 +margin_right = 493.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "XX.xxms" + +[node name="StartTime" type="Label" parent="PerfSmall/Phases/Physics"] +margin_left = 497.0 +margin_top = 9.0 +margin_right = 648.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="CodeTime" type="Label" parent="PerfSmall/Phases/Physics"] +margin_left = 652.0 +margin_top = 9.0 +margin_right = 803.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="EndTime" type="Label" parent="PerfSmall/Phases/Physics"] +margin_left = 807.0 +margin_top = 9.0 +margin_right = 958.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="Reaction" type="HBoxContainer" parent="PerfSmall/Phases"] +margin_top = 72.0 +margin_right = 958.0 +margin_bottom = 104.0 +size_flags_horizontal = 3 + +[node name="Icon" type="Control" parent="PerfSmall/Phases/Reaction"] +margin_right = 32.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 32 ) + +[node name="PhaseName" type="Label" parent="PerfSmall/Phases/Reaction"] +margin_left = 36.0 +margin_top = 9.0 +margin_right = 187.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "Reaction:" + +[node name="TotalTime" type="Label" parent="PerfSmall/Phases/Reaction"] +margin_left = 191.0 +margin_top = 9.0 +margin_right = 493.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 2.0 +text = "XX.xxms" + +[node name="StartTime" type="Label" parent="PerfSmall/Phases/Reaction"] +margin_left = 497.0 +margin_top = 9.0 +margin_right = 648.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="CodeTime" type="Label" parent="PerfSmall/Phases/Reaction"] +margin_left = 652.0 +margin_top = 9.0 +margin_right = 803.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="EndTime" type="Label" parent="PerfSmall/Phases/Reaction"] +margin_left = 807.0 +margin_top = 9.0 +margin_right = 958.0 +margin_bottom = 23.0 +size_flags_horizontal = 3 +text = "XX.xxms" + +[node name="EntityAnalyser" type="Control" parent="."] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="EntityList" type="VBoxContainer" parent="EntityAnalyser"] +visible = false +anchor_right = 0.2 +anchor_bottom = 1.0 +alignment = 1 + +[node name="Label2" type="Label" parent="EntityAnalyser/EntityList"] +margin_top = 447.0 +margin_right = 384.0 +margin_bottom = 461.0 +text = "--- State Selection ---" +align = 1 + +[node name="StateName" type="LineEdit" parent="EntityAnalyser/EntityList"] +margin_top = 465.0 +margin_right = 384.0 +margin_bottom = 489.0 +text = "Character" + +[node name="Label" type="Label" parent="EntityAnalyser/EntityList"] +margin_top = 493.0 +margin_right = 384.0 +margin_bottom = 507.0 +text = "--- Phase Selection ---" +align = 1 + +[node name="Phases" type="GridContainer" parent="EntityAnalyser/EntityList"] +margin_top = 511.0 +margin_right = 384.0 +margin_bottom = 579.0 +columns = 2 + +[node name="Init" type="Button" parent="EntityAnalyser/EntityList/Phases"] +margin_right = 190.0 +margin_bottom = 20.0 +hint_tooltip = "Init phase is executed once for each new entity. This is used for states beginning with Init--" +size_flags_horizontal = 3 +text = "Init" + +[node name="Freeze" type="Button" parent="EntityAnalyser/EntityList/Phases"] +margin_left = 194.0 +margin_right = 384.0 +margin_bottom = 20.0 +hint_tooltip = "Freeze phase is activated on command for elements like hitstun, or super freeze. This is a different main loop type." +size_flags_horizontal = 3 +text = "Freeze" + +[node name="Action" type="Button" parent="EntityAnalyser/EntityList/Phases"] +margin_top = 24.0 +margin_right = 190.0 +margin_bottom = 44.0 +hint_tooltip = "Main phase where behavior is set up. Most of the time, the only phase you need to be concerned with." +size_flags_horizontal = 3 +text = "Action" + +[node name="Reaction" type="Button" parent="EntityAnalyser/EntityList/Phases"] +margin_left = 194.0 +margin_top = 24.0 +margin_right = 384.0 +margin_bottom = 44.0 +hint_tooltip = "Phase executed after the physics resolution. Mostly useful to react to hits or movement changes, and where the transitions are actually made." +size_flags_horizontal = 3 +text = "Reaction" + +[node name="AI" type="Button" parent="EntityAnalyser/EntityList/Phases"] +margin_top = 48.0 +margin_right = 190.0 +margin_bottom = 68.0 +hint_tooltip = "Phase used to drive AI behavior by pressing buttons. Executed before the Action phase." +size_flags_horizontal = 3 +text = "AI" + +[node name="Manual" type="Button" parent="EntityAnalyser/EntityList/Phases"] +margin_left = 194.0 +margin_top = 48.0 +margin_right = 384.0 +margin_bottom = 68.0 +hint_tooltip = "Special phase used internally by the engine to force full execution at times." +size_flags_horizontal = 3 +text = "Manual" + +[node name="Label3" type="Label" parent="EntityAnalyser/EntityList"] +margin_top = 583.0 +margin_right = 384.0 +margin_bottom = 597.0 +text = "--- Variables ---" +align = 1 + +[node name="VariablesTotal" type="Label" parent="EntityAnalyser/EntityList"] +margin_top = 601.0 +margin_right = 384.0 +margin_bottom = 632.0 +text = "Global: 0 / Players: 0 / Entities: 0 +Total: 0" +align = 1 + +[node name="Main" type="VBoxContainer" parent="EntityAnalyser"] +visible = false +anchor_left = 0.2 +anchor_right = 1.0 +anchor_bottom = 1.0 +alignment = 1 + +[node name="Label" type="Label" parent="EntityAnalyser/Main"] +margin_right = 1536.0 +margin_bottom = 14.0 +text = "--- Code Visualisation ---" +align = 1 + +[node name="State" type="Label" parent="EntityAnalyser/Main"] +margin_top = 18.0 +margin_right = 1536.0 +margin_bottom = 32.0 +text = "State: " +align = 1 + +[node name="HSeparator" type="HSeparator" parent="EntityAnalyser/Main"] +margin_top = 36.0 +margin_right = 1536.0 +margin_bottom = 40.0 + +[node name="Display" type="TextEdit" parent="EntityAnalyser/Main"] +margin_top = 44.0 +margin_right = 1536.0 +margin_bottom = 1080.0 +size_flags_vertical = 3 +text = "FUNCTION 1() +FUNCTION 2()" +readonly = true +highlight_current_line = true +syntax_highlighting = true +show_line_numbers = true + +[connection signal="text_changed" from="EntityAnalyser/EntityList/StateName" to="." method="_on_StateName_text_changed"] diff --git a/example/fighter/baston/Baston.casp b/example/fighter/baston/Baston.casp index 8037370..68b5f34 100644 --- a/example/fighter/baston/Baston.casp +++ b/example/fighter/baston/Baston.casp @@ -534,7 +534,7 @@ def ProjectileSpeed int() = 2000 def HitboxWidth int() = 2000 def HitboxHeight int() = 2000 -Call(ProjectileCore) +Call(ProjectileBasic) AttackDamage(ProjectileDamage) AttackHitstunBlockstun(ProjectileHitstun, ProjectileBlockstun) diff --git a/modules/CastagneModule.gd b/modules/CastagneModule.gd index 7699b4b..1f8572c 100644 --- a/modules/CastagneModule.gd +++ b/modules/CastagneModule.gd @@ -29,6 +29,9 @@ func FramePreStart(_stateHandle): # Called at the beginning of each frame func FrameStart(_stateHandle): pass +# Called at the end of each frame +func FrameEnd(_stateHandle): + pass # AI Phase: Helpful to execute the AI logic for an entity and create fake button presses @@ -217,6 +220,9 @@ func RegisterFunction(functionName, nbArguments, flags = null, documentation = n if(flags.has("Transition")): print("CHANGE TO REACTION: "+functionName) + if(flags.has("EditorOnly")): + flags += ["NoFunc"] + if(flags.has("AllPhases")): flags += ["Init", "Action", "Reaction"] @@ -234,6 +240,9 @@ func RegisterFunction(functionName, nbArguments, flags = null, documentation = n if(has_method("Gizmo"+functionName)): gizmoFunc = funcref(self, "Gizmo"+functionName) + if(parseFunc == null and flags.has("NoFunc")): + parseFunc = funcref(self, "ParseFunc_NoFunc") + if(parseFunc == null and actionFunc == null): Castagne.Error(functionName+" : Parse function or Action func couldn't be found.") return @@ -269,6 +278,9 @@ func RegisterFunction(functionName, nbArguments, flags = null, documentation = n moduleDocumentationCategories[currentCategory]["Functions"].append(funcData) _moduleFunctions[functionName] = funcData +func ParseFunc_NoFunc(_parser, _args, _parseData): + return null + # Registers a flag for the documentation func RegisterFlag(flagName, documentation = null): if(documentation == null): diff --git a/modules/castagne/CMEditor.gd b/modules/castagne/CMEditor.gd index 6b69798..3fe71ff 100644 --- a/modules/castagne/CMEditor.gd +++ b/modules/castagne/CMEditor.gd @@ -3,6 +3,9 @@ extends "../CastagneModule.gd" var gizmoDisplayScript = preload("res://castagne/modules/castagne/CMEditor-GizmoDisplay.gd") var gizmoDisplay = null +signal EngineTick_FramePreStart +signal EngineTick_FrameStart +signal EngineTick_FrameEnd signal EngineTick_AIStart signal EngineTick_AIStartEntity signal EngineTick_AIEndEntity @@ -36,7 +39,7 @@ func ModuleSetup(): RegisterCategory("Castagne Editor") RegisterConfig("Editor-SelectedCharacter", 0, {"Flags":["Hidden"]}) RegisterConfig("Editor-DocumentationFolders", "res://castagne/docs", {"Flags":["Advanced"]}) - RegisterConfig("Editor-Tools", "res://castagne/editor/tools/CETool-Compile.tscn, res://castagne/editor/tools/CETool-Inputs.tscn", {"Flags":["Advanced"]}) + RegisterConfig("Editor-Tools", "res://castagne/editor/tools/CETool-Compile.tscn, res://castagne/editor/tools/CETool-Inputs.tscn, res://castagne/editor/tools/CETool-Perf.tscn", {"Flags":["Advanced"]}) RegisterConfig("Editor-LockCastagneFiles", true, {"Flags":["Advanced"]}) RegisterConfig("Editor-LockBaseSkeleton", false, {"Flags":["Advanced"]}) RegisterConfig("Editor-OnlyAllowCustomEditors", false) @@ -57,16 +60,23 @@ func ModuleSetup(): RegisterConfig("EditorCharacterOrder", [], {"Flags":["Hidden"]}) RegisterCategory("Editor") - RegisterFunction("_Category", [1]) - RegisterFunction("_Overridable", [0,1]) - RegisterFunction("_BaseState", [0]) - RegisterFunction("_StateFlag", [1]) - RegisterFunction("_Helper", [0]) - RegisterFunction("_Overriding", [0]) + RegisterFunction("_Category", [1], ["EditorOnly"]) + RegisterFunction("_Overridable", [0,1], ["EditorOnly"]) + RegisterFunction("_BaseState", [0], ["EditorOnly"]) + RegisterFunction("_StateFlag", [1], ["EditorOnly"]) + RegisterFunction("_Helper", [0], ["EditorOnly"]) + RegisterFunction("_Overriding", [0], ["EditorOnly"]) RegisterStateFlag("Warning") RegisterStateFlag("Error") RegisterStateFlag("TODO") + RegisterStateFlag("TODOVFX") + RegisterStateFlag("TODOSOUND") + RegisterStateFlag("TODOANIM") + RegisterStateFlag("TODOBUG") + RegisterStateFlag("TODOFRAMEDATA") + RegisterStateFlag("TODOMOMENTUM") + RegisterStateFlag("TODODESIGN") RegisterStateFlag("CASTTODO") RegisterStateFlag("Overridable") RegisterStateFlag("Overriding") @@ -95,6 +105,7 @@ func BattleInit(stateHandle, _battleInitData): var runStop = false var runSlowmo = 0 func FramePreStart(stateHandle): + emit_signal("EngineTick_FramePreStart", stateHandle) UpdateGizmos(stateHandle) if(runStop): @@ -102,6 +113,11 @@ func FramePreStart(stateHandle): elif(runSlowmo > 1): stateHandle.GlobalSet("_SkipFrame", stateHandle.GlobalGet("_TrueFrameID") % runSlowmo > 0) +func FrameStart(stateHandle): + emit_signal("EngineTick_FrameStart", stateHandle) +func FrameEnd(stateHandle): + emit_signal("EngineTick_FrameEnd", stateHandle) + func AIPhaseStart(stateHandle): emit_signal("EngineTick_AIStart", stateHandle) func AIPhaseStartEntity(stateHandle): @@ -152,22 +168,6 @@ func FreezePhaseEnd(stateHandle): emit_signal("EngineTick_FreezeEnd", stateHandle) -func _Category(_args, _stateHandle): - pass -func _Overridable(_args, _stateHandle): - pass -func _BaseState(_args, _stateHandle): - pass -func _StateDoc(_args, _stateHandle): - pass -func _StateFlag(_args, _stateHandle): - pass -func _Helper(_args, _stateHandle): - pass -func _Overriding(_args, _stateHandle): - pass - - var currentGizmos = [] var currentLine = 0 var mainEID = null diff --git a/modules/coreset/Base-Attacks.casp b/modules/coreset/Base-Attacks.casp index 58796ca..ba8c990 100644 --- a/modules/coreset/Base-Attacks.casp +++ b/modules/coreset/Base-Attacks.casp @@ -798,7 +798,7 @@ def ProjectileSpeed int() = 1000 def HitboxWidth int() = 2000 def HitboxHeight int() = 2000 -Call(ProjectileCore) +Call(ProjectileBasic) Move(ProjectileSpeed) @@ -954,8 +954,8 @@ LAirThrow: else Transition(ATTACK_Throw_Ground_HeldState, ATTACK_Throw_GoToHoldingPriority) endif -:ProjectileCore: -## Common behavior for projectile entities +:ProjectileBasic: +## Simple basic projectile #_Category(Attacks/Helpers) _BaseState() ## CASTDO Warnings and category @@ -965,8 +965,6 @@ def ProjectileDamage int() = 1000 def ProjectileHitstun int() = 60 def ProjectileBlockstun int() = 60 -def DestroyOnGroundHit bool() = 1 -def DestroyOnWallHit bool() = 1 F1: AttackDamage(ProjectileDamage) @@ -974,11 +972,22 @@ F1: AttackBlockstun(ProjectileBlockstun) endif +Call(ProjectileCore) +:ProjectileCore: +## Common behavior for projectile entities +#_Category(Attacks/Helpers) +_BaseState() +## CASTDO Warnings and category + +def DestroyOnGroundHit bool() = 1 +def DestroyOnWallHit bool() = 1 +def DestroyAfterTime int() = 300 + Colbox(500, 500) SetColboxPhantom() SetColboxLayer(0) -F300+: +FDestroyAfterTime+: Flag(DestroyProjectile) endif diff --git a/modules/coreset/CMCore.gd b/modules/coreset/CMCore.gd index a3f5f46..1825990 100644 --- a/modules/coreset/CMCore.gd +++ b/modules/coreset/CMCore.gd @@ -14,25 +14,25 @@ func ModuleSetup(): RegisterCategory("Variables", { "Description": "These functions are focused on basic variable and flag manipulation."}) - RegisterFunction("Flag", [1], ["AllPhases"], { + RegisterFunction("Flag", [1], null, { "Description": "Raises a flag. Flags are reset at the beginning of each frame and allow you to communicate easily between modules. Flags are tested with L branches.", "Arguments": ["Flag name"], "Flags":["Basic"], "Types": ["str"], }) - RegisterFunction("Unflag", [1], ["AllPhases"], { + RegisterFunction("Unflag", [1], null, { "Description": "Unsets a flag, if it was set earlier.", "Arguments": ["Flag name"], "Flags":["Basic"], "Types": ["str"], }) - RegisterFunction("FlagNext", [1], ["AllPhases"], { + RegisterFunction("FlagNext", [1], null, { "Description": "Raises a flag at the beginning of the next frame.", "Arguments": ["Flag name"], "Flags":["Basic"], "Types": ["str"], }) - RegisterFunction("UnflagNext", [1], ["AllPhases"], { + RegisterFunction("UnflagNext", [1], null, { "Description": "Unsets a flag for the next frame, if it was set earlier with FlagNext.", "Arguments": ["Flag name"], "Flags":["Basic"], @@ -189,13 +189,13 @@ This can be overriden by other modules (mainly, FlowFighting which will target t "Description":"Sets a variable in the target entity. This will be applied at the end of the phase, or at initialization for new entities.", "Arguments":["Variable name on target entity", "Variable Value"], "Flags":["Intermediate"], - "Types": ["var", "int"], + "Types": ["str", "int"], }) RegisterFunction("SetStrInTarget", [2], null, { "Description":"Sets a variable in the target entity. This will be applied at the end of the phase, or at initialization for new entities.", "Arguments":["Variable name on target entity", "Variable Value"], "Flags":["Intermediate"], - "Types": ["var", "str"], + "Types": ["str", "str"], }) RegisterFunction("FlagInTarget", [1], null, { "Description":"Sets a flag in the target. This will be applied at the end of the phase, but doesn't carry over to the next frame, meaning you'll most likely only access it in Reaction phase.", diff --git a/modules/coreset/CMInput.gd b/modules/coreset/CMInput.gd index 534582e..20f4dc4 100644 --- a/modules/coreset/CMInput.gd +++ b/modules/coreset/CMInput.gd @@ -72,24 +72,23 @@ func ModuleSetup(): RegisterVariableEntity("_InputTransitionList", [], ["ResetEachFrame"], {"Description":"List of the input transitions to watch for."}) RegisterConfig("InputTransitionDefaultPriority", 1000, {"Description":"The default Transition priority for InputTransition."}) - RegisterModule("Motion Inputs", null, {"Description":"Module handling motion inputs, allowing them to used as part of the input and attack cancel systems."}) - - RegisterCategory("Motion Inputs", {"Description":"System for detecting when motion input has been performed by a player."}) - RegisterConfig("DirectionalInputBuffer", 60, {"Description":"Number of frames the module retains the directional inputs from. This value should be greater than the longest motion input times the individual input interval for that motion."}) - RegisterConfig("ShortMotionInterval", 12, {"Description":"Maximum number of frames between inputs for a motion to remain valid. This value is for motions with three directions or less."}) - RegisterConfig("LongMotionInterval", 8, {"Description":"Maximum number of frames between inputs for a motion to remain valid. This value is for motions with more than three directions."}) - RegisterConfig("ButtonInterval", 8, {"Description":"Maximum number of frames between motion input and pressing the button for a motion to remain valid."}) - RegisterConfig("MinChargeTime", 30, {"Description":"Minimum number of frames for a direction to be held for a valid charge input."}) + RegisterConfig("EnableMotionInputs", true, {"Description":"Toggle to disable motion inputs engine-wide.", "Flags":["Basic"]}) + + RegisterConfig("DirectionalInputBuffer", 60, {"Description":"Number of frames the module retains the directional inputs from. This value should be greater than the longest motion input times the individual input interval for that motion.", "Flags":["Advanced"]}) + RegisterConfig("ShortMotionInterval", 12, {"Description":"Maximum number of frames between inputs for a motion to remain valid. This value is for motions with three directions or less.", "Flags":["Advanced"]}) + RegisterConfig("LongMotionInterval", 8, {"Description":"Maximum number of frames between inputs for a motion to remain valid. This value is for motions with more than three directions.", "Flags":["Advanced"]}) + RegisterConfig("ButtonInterval", 8, {"Description":"Maximum number of frames between motion input and pressing the button for a motion to remain valid.", "Flags":["Advanced"]}) + RegisterConfig("MinChargeTime", 30, {"Description":"Minimum number of frames for a direction to be held for a valid charge input.", "Flags":["Advanced"]}) #the above three values determine the number of frames between inputs in a motion. By default, shorter motions have more leniency. RegisterConfig("ValidMotionInputs","236, 214, 623, 421, 41236, 63214, 22, [4]6, [2]8",{"Description":"Motion inputs in numpad notation that the system will check for."}) - RegisterVariableEntity("_DirectionalInputLog", [], {"Description":"Array containing just the raw directional inputs for a player on each frame. Inputs are held for a number of frames equal to the buffer config variable."}) - RegisterVariableEntity("_ChargeInputLog", [], {"Description":"Array containing the inputs that have been held long enough to charge on each frame. Diagonal inputs also add the cardinal direction inputs. Inputs are held for a number of frames equal to the buffer config variable."}) - RegisterVariableEntity("_ChargeTime", {"Up":0,"Down":0,"Forward":0,"Back":0},{"Description":"Dict containing the number of frames each direction has been held."}) - RegisterVariableEntity("_PerformedMotions", [], {"Description":"Array containing the motions that have been performed by the player."}) + RegisterVariableEntity("_DirectionalInputLog", [], null, {"Description":"Array containing just the raw directional inputs for a player on each frame. Inputs are held for a number of frames equal to the buffer config variable."}) + RegisterVariableEntity("_ChargeInputLog", [], null, {"Description":"Array containing the inputs that have been held long enough to charge on each frame. Diagonal inputs also add the cardinal direction inputs. Inputs are held for a number of frames equal to the buffer config variable."}) + RegisterVariableEntity("_ChargeTime", {"Up":0,"Down":0,"Forward":0,"Back":0}, null, {"Description":"Dict containing the number of frames each direction has been held."}) + RegisterVariableEntity("_PerformedMotions", [], ["ResetEachFrame"], {"Description":"Array containing the motions that have been performed by the player."}) var _castagneInputScript = load("res://castagne/engine/CastagneInput.gd") func OnModuleRegistration(configData): @@ -193,15 +192,16 @@ func InputPhase(stateHandle, activeEIDs): stateHandle.EntitySet("_Inputs", inputs) func InputPhaseEndEntity(stateHandle): - LogDirectionalInputs(stateHandle) + if(stateHandle.ConfigData().Get("EnableMotionInputs")): + LogDirectionalInputs(stateHandle) - var validMotions = Castagne.SplitStringToArray(stateHandle.ConfigData().Get("ValidMotionInputs")) - var motions = [] + var validMotions = Castagne.SplitStringToArray(stateHandle.ConfigData().Get("ValidMotionInputs")) + var motions = [] - for m in validMotions: - if MotionInputCheck(stateHandle, m): - motions += [m] - stateHandle.EntitySet("_PerformedMotions", motions) + for m in validMotions: + if MotionInputCheck(stateHandle, m): + motions += [m] + stateHandle.EntitySet("_PerformedMotions", motions) func ReactionPhaseStartEntity(stateHandle): var inputTransition = FindCorrectInputTransition(stateHandle) diff --git a/modules/physics/CMPhysics2D.gd b/modules/physics/CMPhysics2D.gd index 868f199..c48ac26 100644 --- a/modules/physics/CMPhysics2D.gd +++ b/modules/physics/CMPhysics2D.gd @@ -372,7 +372,7 @@ func ModuleSetup(): RegisterConfig("ArenaSize", 180000) RegisterConfig("ArenaMaxPlayerDistance", 75000) - RegisterConfig("PhysicsNbBuckets", 4) + RegisterConfig("PhysicsNbBuckets", 1) func BattleInit(stateHandle, _battleInitData): engine.physicsModule = self @@ -936,12 +936,37 @@ func GetTargetPositionRelativeToSelf(args, stateHandle): # -------------------------------------------------------------------------------------------------- # Physics code +var _castProfiling_PhysicsStart = -1 +var _castProfiling_PhysicsSetupDone = -1 +var _castProfiling_Env_SetupDone = -1 +var _castProfiling_EnvColEnd = -1 +var _castProfiling_Atk_SetupDone = -1 +var _castProfiling_PhysicsEnd = -1 + func PhysicsPhase(stateHandle, activeEIDs): - # 1. Colbox and Environment Collisions + _castProfiling_PhysicsStart = OS.get_ticks_usec() + + # 1. Setup data needed + PhysicsPhaseSetup(stateHandle, activeEIDs) + _castProfiling_PhysicsSetupDone = OS.get_ticks_usec() + + # 2. Colbox and Environment Collisions PhysicsPhaseEnvironment(stateHandle, activeEIDs) + _castProfiling_EnvColEnd = OS.get_ticks_usec() - # 2. Attack collisions + # 3. Attack collisions PhysicsPhaseAttack(stateHandle, activeEIDs) + _castProfiling_PhysicsEnd = OS.get_ticks_usec() + +var ppAttackModule +var ppStateHandlesByEID +func PhysicsPhaseSetup(stateHandle, activeEIDs): + ppAttackModule = stateHandle.ConfigData().GetModuleSlot(Castagne.MODULE_SLOTS_BASE.ATTACKS) + ppStateHandlesByEID = {} + for eid in activeEIDs: + stateHandle.PointToEntity(eid) + var entityStateHandle = stateHandle.CloneStateHandle() + ppStateHandlesByEID[eid] = entityStateHandle func PhysicsPhaseEnvironment(stateHandle, activeEIDs): # Checks environment collisions for each entity separately @@ -952,14 +977,14 @@ func PhysicsPhaseEnvironment(stateHandle, activeEIDs): var envConstraints = GetEnvironmentConstraints(stateHandle) var colboxes = [] for eid in activeEIDs: - stateHandle.PointToEntity(eid) - var c = stateHandle.EntityGet("_Colbox") + var entityStateHandle = ppStateHandlesByEID[eid] + var c = entityStateHandle.EntityGet("_Colbox") if(c == null): continue c = c.duplicate() - c["Phantom"] = stateHandle.EntityGet("_ColboxPhantom") - c["Mode"] = stateHandle.EntityGet("_ColboxMode") - c["Layer"] = stateHandle.EntityGet("_ColboxLayer") + c["Phantom"] = entityStateHandle.EntityGet("_ColboxPhantom") + c["Mode"] = entityStateHandle.EntityGet("_ColboxMode") + c["Layer"] = entityStateHandle.EntityGet("_ColboxLayer") colboxes.push_back(c) var nbColboxes = colboxes.size() @@ -990,9 +1015,9 @@ func PhysicsPhaseEnvironment(stateHandle, activeEIDs): #var positions = {} for eid in activeEIDs: - stateHandle.PointToEntity(eid) + var entityStateHandle = ppStateHandlesByEID[eid] #positions[eid] = [stateHandle.EntityGet("_PositionX"), stateHandle.EntityGet("_PositionY")] - var movement = [stateHandle.EntityGet("_MovementX"), stateHandle.EntityGet("_MovementY")] + var movement = [entityStateHandle.EntityGet("_MovementX"), entityStateHandle.EntityGet("_MovementY")] var bucketMovement = [movement[0]/nbBuckets, movement[1]/nbBuckets] var buckets = [] for i in range(nbBuckets): @@ -1001,33 +1026,35 @@ func PhysicsPhaseEnvironment(stateHandle, activeEIDs): buckets[0][1] += movement[1]%nbBuckets movementBuckets[eid] = buckets + _castProfiling_Env_SetupDone = OS.get_ticks_usec() + # Main Loop for loopID in nbBuckets: # Apply movement for eid in activeEIDs: var movement = movementBuckets[eid][loopID] - stateHandle.PointToEntity(eid) - stateHandle.EntityAdd("_PositionX", movement[0]) - stateHandle.EntityAdd("_PositionY", movement[1]) + var entityStateHandle = ppStateHandlesByEID[eid] + entityStateHandle.EntityAdd("_PositionX", movement[0]) + entityStateHandle.EntityAdd("_PositionY", movement[1]) # Do colbox interactions for colboxCol in validColboxCollisions: var colboxA = colboxes[colboxCol[0]] var colboxB = colboxes[colboxCol[1]] - PhysicsEnv_ColboxColbox(stateHandle, colboxA, colboxB) + PhysicsEnv_ColboxColbox(colboxA, colboxB) # Do environment constraints for envCol in validEnvironmentCollisions: var colbox = colboxes[envCol[0]] var envConstraint = envConstraints[envCol[1]] - var movement = PhysicsEnv_ApplyEnvConstraint(stateHandle, colbox, envConstraint) + var movement = PhysicsEnv_ApplyEnvConstraint(colbox, envConstraint) -func PhysicsEnv_ApplyEnvConstraint(stateHandle, colbox, envc): +func PhysicsEnv_ApplyEnvConstraint(colbox, envc): var movement = [0,0] var envcType = envc["Type"] - stateHandle.PointToEntity(colbox["Owner"]) - var colpos = GetBoxPosition(stateHandle, colbox) + var entityStateHandle = ppStateHandlesByEID[colbox["Owner"]] + var colpos = GetBoxPosition(entityStateHandle, colbox) if(envcType == ENVC_TYPES.AAPlane): var envcDir = envc["Dir"] @@ -1041,20 +1068,20 @@ func PhysicsEnv_ApplyEnvConstraint(stateHandle, colbox, envc): var flag = null if(envcDir == ENVC_AAPLANE_DIR.Right): - colboxPos = colpos["Left"] + colboxPos = colpos[0] moveXMult = -1 flag = "PFWall" elif(envcDir == ENVC_AAPLANE_DIR.Up): - colboxPos = colpos["Down"] + colboxPos = colpos[2] moveYMult = -1 flag = "PFGrounded" elif(envcDir == ENVC_AAPLANE_DIR.Left): - colboxPos = colpos["Right"] + colboxPos = colpos[1] moveXMult = 1 invertAxis = -1 flag = "PFWall" elif(envcDir == ENVC_AAPLANE_DIR.Down): - colboxPos = colpos["Up"] + colboxPos = colpos[3] moveYMult = 1 invertAxis = -1 flag = "PFCeiling" @@ -1065,50 +1092,48 @@ func PhysicsEnv_ApplyEnvConstraint(stateHandle, colbox, envc): var diff = (colboxPos - envcPos) * invertAxis var margin = 10 # TODO CAST 54 Config if(diff <= margin): - EntitySetFlag(stateHandle, flag) + EntitySetFlag(entityStateHandle, flag) if(diff < 0): - stateHandle.EntityAdd("_PositionX", diff * moveXMult) - stateHandle.EntityAdd("_PositionY", diff * moveYMult) + entityStateHandle.EntityAdd("_PositionX", diff * moveXMult) + entityStateHandle.EntityAdd("_PositionY", diff * moveYMult) if(envcStopMomentum): if(moveYMult != 0): - stateHandle.EntitySet("_MomentumY", max(stateHandle.EntityGet("_MomentumY")*invertAxis, 0)*invertAxis) + entityStateHandle.EntitySet("_MomentumY", max(entityStateHandle.EntityGet("_MomentumY")*invertAxis, 0)*invertAxis) else: ModuleError("PhysicsEnv: Env Constraint of unknown type: "+ str(envcType)) -func PhysicsEnv_ColboxColbox(stateHandle, colboxA, colboxB): - stateHandle.PointToEntity(colboxA["Owner"]) - var colposA = GetBoxPosition(stateHandle, colboxA) - var prevXA = stateHandle.EntityGet("_PrevPositionX") +func PhysicsEnv_ColboxColbox(colboxA, colboxB): + var entityStateHandleA = ppStateHandlesByEID[colboxA["Owner"]] + var colposA = GetBoxPosition(entityStateHandleA, colboxA) + var prevXA = entityStateHandleA.EntityGet("_PrevPositionX") - stateHandle.PointToEntity(colboxB["Owner"]) - var colposB = GetBoxPosition(stateHandle, colboxB) - var prevXB = stateHandle.EntityGet("_PrevPositionX") + var entityStateHandleB = ppStateHandlesByEID[colboxB["Owner"]] + var colposB = GetBoxPosition(entityStateHandleB, colboxB) + var prevXB = entityStateHandleB.EntityGet("_PrevPositionX") # Check collision if(!AreBoxesOverlapping(colposA, colposB)): return var overlap = 0 - if(colposA["Left"] < colposB["Left"]): - overlap = colposA["Right"] - colposB["Left"] + if(colposA[0] < colposB[0]): + overlap = colposA[1] - colposB[0] else: - overlap = colposB["Right"] - colposA["Left"] + overlap = colposB[1] - colposA[0] - var centerHA = (colposA["Right"] + colposA["Left"])/2 - var centerVA = (colposA["Up"] + colposA["Down"])/2 - var centerHB = (colposB["Right"] + colposB["Left"])/2 - var centerVB = (colposB["Up"] + colposB["Down"])/2 + var centerHA = (colposA[1] + colposA[0])/2 + var centerVA = (colposA[3] + colposA[2])/2 + var centerHB = (colposB[1] + colposB[0])/2 + var centerVB = (colposB[3] + colposB[2])/2 var pushbackDirA = (-1 if prevXB > prevXA else 1) if(prevXA == prevXB): pushbackDirA = (-1 if centerHB > centerHA else 1) # TODO Take facing into account and other heuristics - stateHandle.PointToEntity(colboxA["Owner"]) - stateHandle.EntityAdd("_PositionX", pushbackDirA*overlap/2) - stateHandle.PointToEntity(colboxB["Owner"]) - stateHandle.EntityAdd("_PositionX", -pushbackDirA*overlap/2) + entityStateHandleA.EntityAdd("_PositionX", pushbackDirA*overlap/2) + entityStateHandleB.EntityAdd("_PositionX", -pushbackDirA*overlap/2) # TODO Control of pushback # TODO Check for wall ? @@ -1142,23 +1167,24 @@ func PhysicsPhaseAttack(stateHandle, activeEIDs): var aaBoxes = {} # [hurtbox, hitbox, friendlyfire], if null ignore collision # Build EID List + var posKeys = ["Left", "Right", "Down", "Up"] for eid in activeEIDs: - stateHandle.PointToEntity(eid) + var entityStateHandle = ppStateHandlesByEID[eid] var hurt = [] var hurtboxAA = null - var entityHurtboxList = stateHandle.EntityGet("_Hurtboxes") + var entityHurtboxList = entityStateHandle.EntityGet("_Hurtboxes") for hurtboxOriginal in entityHurtboxList: var h = hurtboxOriginal.duplicate() - var pos = GetBoxPosition(stateHandle, hurtboxOriginal) + var pos = GetBoxPosition(entityStateHandle, hurtboxOriginal) if(hurtboxAA == null): hurtboxAA = pos else: ExpandAABox(hurtboxAA, pos) - for k in pos: - h[k] = pos[k] + for i in range(4): + h[i] = pos[i] h["Hitbox"] = false hurt.push_back(h) @@ -1167,18 +1193,18 @@ func PhysicsPhaseAttack(stateHandle, activeEIDs): var ffHit = [] var hitboxAA = null var ffHitboxAA = null - var entityHitboxList = stateHandle.EntityGet("_Hitboxes") + var entityHitboxList = entityStateHandle.EntityGet("_Hitboxes") for hitboxOriginal in entityHitboxList: var h = hitboxOriginal.duplicate() - var pos = GetBoxPosition(stateHandle, hitboxOriginal) + var pos = GetBoxPosition(entityStateHandle, hitboxOriginal) if(hitboxAA == null): hitboxAA = pos else: ExpandAABox(hitboxAA, pos) - for k in pos: - h[k] = pos[k] + for i in range(4): + h[i] = pos[i] h["Hitbox"] = true var hitboxFriendlyFire = h["AttackData"]["Flags"].has("FriendlyFire") @@ -1212,6 +1238,8 @@ func PhysicsPhaseAttack(stateHandle, activeEIDs): hitboxes[eid] = hit friendlyFireHitboxes[eid] = ffHit + _castProfiling_Atk_SetupDone = OS.get_ticks_usec() + # Gather potential character collisions for eidAID in range(activeEIDs.size()-1): var eidA = activeEIDs[eidAID] @@ -1219,10 +1247,8 @@ func PhysicsPhaseAttack(stateHandle, activeEIDs): var eidB = activeEIDs[eidBID] var aaBoxesA = aaBoxes[eidA] var aaBoxesB = aaBoxes[eidB] - stateHandle.PointToEntity(eidA) - var pidA = stateHandle.EntityGet("_Player") - stateHandle.PointToEntity(eidB) - var pidB = stateHandle.EntityGet("_Player") + var pidA = ppStateHandlesByEID[eidA].EntityGet("_Player") + var pidB = ppStateHandlesByEID[eidB].EntityGet("_Player") var sameTeam = (pidA == pidB) var aaHitboxID = (2 if sameTeam else 1) @@ -1236,11 +1262,10 @@ func PhysicsPhaseAttack(stateHandle, activeEIDs): PhysicsAtk_HandleAttackDefend(stateHandle, eidB, eidA, atkH, hurtboxes[eidA]) func PhysicsAtk_HandleAttackDefend(stateHandle, attackerEID, defenderEID, attackerHitboxes, defenderHurtboxes): - var attackModule = stateHandle.ConfigData().GetModuleSlot(Castagne.MODULE_SLOTS_BASE.ATTACKS) for hitbox in attackerHitboxes: for hurtbox in defenderHurtboxes: if(AreBoxesOverlapping(hitbox, hurtbox)): - if(attackModule.HandleHit(stateHandle, attackerEID, hitbox, defenderEID, hurtbox)): + if(ppAttackModule.HandleHit(stateHandle, attackerEID, hitbox, defenderEID, hurtbox)): return true return false @@ -1320,21 +1345,23 @@ func GetBoxPosition(stateHandle, box): var cornerBR = TransformPosEntityToWorld([box["Right"], box["Down"],0], stateHandle) var facingHV = GetFacingHV(stateHandle) if(facingHV[0] >= 0): - return {"Left":cornerTL[0], "Right":cornerBR[0],"Down":cornerBR[1],"Up":cornerTL[1]} + return [cornerTL[0],cornerBR[0],cornerBR[1],cornerTL[1]] + #return {"Left":cornerTL[0], "Right":cornerBR[0],"Down":cornerBR[1],"Up":cornerTL[1]} else: - return {"Left":cornerBR[0], "Right":cornerTL[0],"Down":cornerBR[1],"Up":cornerTL[1]} + return [cornerBR[0],cornerTL[0],cornerBR[1],cornerTL[1]] + #return {"Left":cornerBR[0], "Right":cornerTL[0],"Down":cornerBR[1],"Up":cornerTL[1]} func AreBoxesOverlapping(boxA, boxB): - return (boxA["Right"] > boxB["Left"] - and boxA["Left"] < boxB["Right"] - and boxA["Up"] > boxB["Down"] - and boxA["Down"] < boxB["Up"]) + return (boxA[1] > boxB[0] + and boxA[0] < boxB[1] + and boxA[3] > boxB[2] + and boxA[2] < boxB[3]) func ExpandAABox(aabox, newBox): - aabox["Left"] = min(aabox["Left"], newBox["Left"]) - aabox["Right"] = max(aabox["Right"], newBox["Right"]) - aabox["Down"] = min(aabox["Down"], newBox["Down"]) - aabox["Up"] = max(aabox["Up"], newBox["Up"]) + aabox[0] = min(aabox[0], newBox[0]) + aabox[1] = max(aabox[1], newBox[1]) + aabox[2] = min(aabox[2], newBox[2]) + aabox[3] = max(aabox[3], newBox[3]) func GetFacingHV(stateHandle, facingType = FACING_TYPE.Physics): var facings = ["Physics", "Attack", "Block", "Model"]