commit a3549d357bc534e01b14ef9e2d698ce9d5549d82 Author: Thorben Date: Sat May 9 12:45:05 2020 +0200 initial commit diff --git a/Client/.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.md5 b/Client/.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.md5 new file mode 100644 index 0000000..78513be --- /dev/null +++ b/Client/.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.md5 @@ -0,0 +1,3 @@ +source_md5="73d4e8af5731d88b8d9ed188fd16bd86" +dest_md5="548af57ffd919fd4b0880e4ca16c47ad" + diff --git a/Client/.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.scn b/Client/.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.scn new file mode 100644 index 0000000..68a9fef Binary files /dev/null and b/Client/.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.scn differ diff --git a/Client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/Client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..7b61c3e --- /dev/null +++ b/Client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="47313fa4c47a9963fddd764e1ec6e4a8" +dest_md5="2ded9e7f9060e2b530aab678b135fc5b" + diff --git a/Client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex b/Client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex new file mode 100644 index 0000000..3ca6461 Binary files /dev/null and b/Client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex differ diff --git a/Client/Material/hex.dae b/Client/Material/hex.dae new file mode 100644 index 0000000..e664276 --- /dev/null +++ b/Client/Material/hex.dae @@ -0,0 +1,66 @@ + + + + + Anonymous + Collada Exporter for Blender 2.6+, by Juan Linietsky (juan@codenix.com) + + 2020-02-27T18:22:18Z + 2020-02-27T18:22:18Z + + Z_UP + + + + + + 0.0 1.0 -1.0 0.0 1.0 1.0 0.9922332167625427 0.4999999701976776 1.0 0.9922332167625427 0.4999999701976776 -1.0 0.9922332167625427 0.4999999701976776 -1.0 0.9922332167625427 0.4999999701976776 1.0 0.992233157157898 -0.5000000596046448 1.0 0.992233157157898 -0.5000000596046448 -1.0 0.992233157157898 -0.5000000596046448 -1.0 0.992233157157898 -0.5000000596046448 1.0 -1.001630849373214e-07 -1.0 1.0 -1.001630849373214e-07 -1.0 -1.0 -1.001630849373214e-07 -1.0 -1.0 -1.001630849373214e-07 -1.0 1.0 -0.9922332167625427 -0.49999991059303284 1.0 -0.9922332167625427 -0.49999991059303284 -1.0 0.9922332167625427 0.4999999701976776 1.0 0.0 1.0 1.0 -0.9922332167625427 0.49999991059303284 1.0 -0.9922332167625427 -0.49999991059303284 1.0 -1.001630849373214e-07 -1.0 1.0 0.992233157157898 -0.5000000596046448 1.0 -0.9922332167625427 -0.49999991059303284 -1.0 -0.9922332167625427 -0.49999991059303284 1.0 -0.9922332167625427 0.49999991059303284 1.0 -0.9922332167625427 0.49999991059303284 -1.0 -0.9922332167625427 0.49999991059303284 -1.0 -0.9922332167625427 0.49999991059303284 1.0 0.0 1.0 1.0 0.0 1.0 -1.0 0.0 1.0 -1.0 0.9922332167625427 0.4999999701976776 -1.0 0.992233157157898 -0.5000000596046448 -1.0 -1.001630849373214e-07 -1.0 -1.0 -0.9922332167625427 -0.49999991059303284 -1.0 -0.9922332167625427 0.49999991059303284 -1.0 + + + + + + + + + + 0.45000749826431274 0.8930248022079468 0.0 0.45000749826431274 0.8930248022079468 0.0 0.45000749826431274 0.8930248022079468 0.0 0.45000749826431274 0.8930248022079468 0.0 1.0 -5.960464477539063e-08 0.0 1.0 -5.960464477539063e-08 0.0 1.0 -5.960464477539063e-08 0.0 1.0 -5.960464477539063e-08 0.0 0.4500074088573456 -0.893024742603302 0.0 0.4500074088573456 -0.893024742603302 0.0 0.4500074088573456 -0.893024742603302 0.0 0.4500074088573456 -0.893024742603302 0.0 -0.4500076174736023 -0.8930246829986572 0.0 -0.4500076174736023 -0.8930246829986572 0.0 -0.4500076174736023 -0.8930246829986572 0.0 -0.4500076174736023 -0.8930246829986572 0.0 4.004747466979097e-08 0.0 1.0 4.004747466979097e-08 0.0 1.0 4.004747466979097e-08 0.0 1.0 4.004747466979097e-08 0.0 1.0 4.004747466979097e-08 0.0 1.0 4.004747466979097e-08 0.0 1.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -0.4500075876712799 0.893024742603302 0.0 -0.4500075876712799 0.893024742603302 0.0 -0.4500075876712799 0.893024742603302 0.0 -0.4500075876712799 0.893024742603302 0.0 6.007121555740014e-08 0.0 -1.0 6.007121555740014e-08 0.0 -1.0 6.007121555740014e-08 0.0 -1.0 6.007121555740014e-08 0.0 -1.0 6.007121555740014e-08 0.0 -1.0 6.007121555740014e-08 0.0 -1.0 + + + + + + + + + + + + + + +

0 1 2 3

+

4 5 6 7

+

8 9 10 11

+

12 13 14 15

+

16 17 18 19 20 21

+

22 23 24 25

+

26 27 28 29

+

30 31 32 33 34 35

+
+
+
+
+ + + + 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.10000002384185791 0.0 0.0 0.0 0.0 1.0 + + + + + + + + +
diff --git a/Client/Material/hex.dae.import b/Client/Material/hex.dae.import new file mode 100644 index 0000000..3f97e85 --- /dev/null +++ b/Client/Material/hex.dae.import @@ -0,0 +1,1063 @@ +[remap] + +importer="scene" +type="PackedScene" +path="res://.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.scn" + +[deps] + +source_file="res://Material/hex.dae" +dest_files=[ "res://.import/hex.dae-11b3e3e61b7f8c01f8672d854a6a4c26.scn" ] + +[params] + +nodes/root_type="Spatial" +nodes/root_name="Scene Root" +nodes/root_scale=1.0 +nodes/custom_script="" +nodes/storage=0 +materials/location=1 +materials/storage=1 +materials/keep_on_reimport=true +meshes/compress=true +meshes/ensure_tangents=true +meshes/storage=0 +meshes/light_baking=0 +meshes/lightmap_texel_size=0.1 +skins/use_named_skins=true +external_files/store_in_subdir=false +animation/import=true +animation/fps=15 +animation/filter_script="" +animation/storage=false +animation/keep_custom_tracks=false +animation/optimizer/enabled=true +animation/optimizer/max_linear_error=0.05 +animation/optimizer/max_angular_error=0.01 +animation/optimizer/max_angle=22 +animation/optimizer/remove_unused_tracks=true +animation/clips/amount=0 +animation/clip_1/name="" +animation/clip_1/start_frame=0 +animation/clip_1/end_frame=0 +animation/clip_1/loops=false +animation/clip_2/name="" +animation/clip_2/start_frame=0 +animation/clip_2/end_frame=0 +animation/clip_2/loops=false +animation/clip_3/name="" +animation/clip_3/start_frame=0 +animation/clip_3/end_frame=0 +animation/clip_3/loops=false +animation/clip_4/name="" +animation/clip_4/start_frame=0 +animation/clip_4/end_frame=0 +animation/clip_4/loops=false +animation/clip_5/name="" +animation/clip_5/start_frame=0 +animation/clip_5/end_frame=0 +animation/clip_5/loops=false +animation/clip_6/name="" +animation/clip_6/start_frame=0 +animation/clip_6/end_frame=0 +animation/clip_6/loops=false +animation/clip_7/name="" +animation/clip_7/start_frame=0 +animation/clip_7/end_frame=0 +animation/clip_7/loops=false +animation/clip_8/name="" +animation/clip_8/start_frame=0 +animation/clip_8/end_frame=0 +animation/clip_8/loops=false +animation/clip_9/name="" +animation/clip_9/start_frame=0 +animation/clip_9/end_frame=0 +animation/clip_9/loops=false +animation/clip_10/name="" +animation/clip_10/start_frame=0 +animation/clip_10/end_frame=0 +animation/clip_10/loops=false +animation/clip_11/name="" +animation/clip_11/start_frame=0 +animation/clip_11/end_frame=0 +animation/clip_11/loops=false +animation/clip_12/name="" +animation/clip_12/start_frame=0 +animation/clip_12/end_frame=0 +animation/clip_12/loops=false +animation/clip_13/name="" +animation/clip_13/start_frame=0 +animation/clip_13/end_frame=0 +animation/clip_13/loops=false +animation/clip_14/name="" +animation/clip_14/start_frame=0 +animation/clip_14/end_frame=0 +animation/clip_14/loops=false +animation/clip_15/name="" +animation/clip_15/start_frame=0 +animation/clip_15/end_frame=0 +animation/clip_15/loops=false +animation/clip_16/name="" +animation/clip_16/start_frame=0 +animation/clip_16/end_frame=0 +animation/clip_16/loops=false +animation/clip_17/name="" +animation/clip_17/start_frame=0 +animation/clip_17/end_frame=0 +animation/clip_17/loops=false +animation/clip_18/name="" +animation/clip_18/start_frame=0 +animation/clip_18/end_frame=0 +animation/clip_18/loops=false +animation/clip_19/name="" +animation/clip_19/start_frame=0 +animation/clip_19/end_frame=0 +animation/clip_19/loops=false +animation/clip_20/name="" +animation/clip_20/start_frame=0 +animation/clip_20/end_frame=0 +animation/clip_20/loops=false +animation/clip_21/name="" +animation/clip_21/start_frame=0 +animation/clip_21/end_frame=0 +animation/clip_21/loops=false +animation/clip_22/name="" +animation/clip_22/start_frame=0 +animation/clip_22/end_frame=0 +animation/clip_22/loops=false +animation/clip_23/name="" +animation/clip_23/start_frame=0 +animation/clip_23/end_frame=0 +animation/clip_23/loops=false +animation/clip_24/name="" +animation/clip_24/start_frame=0 +animation/clip_24/end_frame=0 +animation/clip_24/loops=false +animation/clip_25/name="" +animation/clip_25/start_frame=0 +animation/clip_25/end_frame=0 +animation/clip_25/loops=false +animation/clip_26/name="" +animation/clip_26/start_frame=0 +animation/clip_26/end_frame=0 +animation/clip_26/loops=false +animation/clip_27/name="" +animation/clip_27/start_frame=0 +animation/clip_27/end_frame=0 +animation/clip_27/loops=false +animation/clip_28/name="" +animation/clip_28/start_frame=0 +animation/clip_28/end_frame=0 +animation/clip_28/loops=false +animation/clip_29/name="" +animation/clip_29/start_frame=0 +animation/clip_29/end_frame=0 +animation/clip_29/loops=false +animation/clip_30/name="" +animation/clip_30/start_frame=0 +animation/clip_30/end_frame=0 +animation/clip_30/loops=false +animation/clip_31/name="" +animation/clip_31/start_frame=0 +animation/clip_31/end_frame=0 +animation/clip_31/loops=false +animation/clip_32/name="" +animation/clip_32/start_frame=0 +animation/clip_32/end_frame=0 +animation/clip_32/loops=false +animation/clip_33/name="" +animation/clip_33/start_frame=0 +animation/clip_33/end_frame=0 +animation/clip_33/loops=false +animation/clip_34/name="" +animation/clip_34/start_frame=0 +animation/clip_34/end_frame=0 +animation/clip_34/loops=false +animation/clip_35/name="" +animation/clip_35/start_frame=0 +animation/clip_35/end_frame=0 +animation/clip_35/loops=false +animation/clip_36/name="" +animation/clip_36/start_frame=0 +animation/clip_36/end_frame=0 +animation/clip_36/loops=false +animation/clip_37/name="" +animation/clip_37/start_frame=0 +animation/clip_37/end_frame=0 +animation/clip_37/loops=false +animation/clip_38/name="" +animation/clip_38/start_frame=0 +animation/clip_38/end_frame=0 +animation/clip_38/loops=false +animation/clip_39/name="" +animation/clip_39/start_frame=0 +animation/clip_39/end_frame=0 +animation/clip_39/loops=false +animation/clip_40/name="" +animation/clip_40/start_frame=0 +animation/clip_40/end_frame=0 +animation/clip_40/loops=false +animation/clip_41/name="" +animation/clip_41/start_frame=0 +animation/clip_41/end_frame=0 +animation/clip_41/loops=false +animation/clip_42/name="" +animation/clip_42/start_frame=0 +animation/clip_42/end_frame=0 +animation/clip_42/loops=false +animation/clip_43/name="" +animation/clip_43/start_frame=0 +animation/clip_43/end_frame=0 +animation/clip_43/loops=false +animation/clip_44/name="" +animation/clip_44/start_frame=0 +animation/clip_44/end_frame=0 +animation/clip_44/loops=false +animation/clip_45/name="" +animation/clip_45/start_frame=0 +animation/clip_45/end_frame=0 +animation/clip_45/loops=false +animation/clip_46/name="" +animation/clip_46/start_frame=0 +animation/clip_46/end_frame=0 +animation/clip_46/loops=false +animation/clip_47/name="" +animation/clip_47/start_frame=0 +animation/clip_47/end_frame=0 +animation/clip_47/loops=false +animation/clip_48/name="" +animation/clip_48/start_frame=0 +animation/clip_48/end_frame=0 +animation/clip_48/loops=false +animation/clip_49/name="" +animation/clip_49/start_frame=0 +animation/clip_49/end_frame=0 +animation/clip_49/loops=false +animation/clip_50/name="" +animation/clip_50/start_frame=0 +animation/clip_50/end_frame=0 +animation/clip_50/loops=false +animation/clip_51/name="" +animation/clip_51/start_frame=0 +animation/clip_51/end_frame=0 +animation/clip_51/loops=false +animation/clip_52/name="" +animation/clip_52/start_frame=0 +animation/clip_52/end_frame=0 +animation/clip_52/loops=false +animation/clip_53/name="" +animation/clip_53/start_frame=0 +animation/clip_53/end_frame=0 +animation/clip_53/loops=false +animation/clip_54/name="" +animation/clip_54/start_frame=0 +animation/clip_54/end_frame=0 +animation/clip_54/loops=false +animation/clip_55/name="" +animation/clip_55/start_frame=0 +animation/clip_55/end_frame=0 +animation/clip_55/loops=false +animation/clip_56/name="" +animation/clip_56/start_frame=0 +animation/clip_56/end_frame=0 +animation/clip_56/loops=false +animation/clip_57/name="" +animation/clip_57/start_frame=0 +animation/clip_57/end_frame=0 +animation/clip_57/loops=false +animation/clip_58/name="" +animation/clip_58/start_frame=0 +animation/clip_58/end_frame=0 +animation/clip_58/loops=false +animation/clip_59/name="" +animation/clip_59/start_frame=0 +animation/clip_59/end_frame=0 +animation/clip_59/loops=false +animation/clip_60/name="" +animation/clip_60/start_frame=0 +animation/clip_60/end_frame=0 +animation/clip_60/loops=false +animation/clip_61/name="" +animation/clip_61/start_frame=0 +animation/clip_61/end_frame=0 +animation/clip_61/loops=false +animation/clip_62/name="" +animation/clip_62/start_frame=0 +animation/clip_62/end_frame=0 +animation/clip_62/loops=false +animation/clip_63/name="" +animation/clip_63/start_frame=0 +animation/clip_63/end_frame=0 +animation/clip_63/loops=false +animation/clip_64/name="" +animation/clip_64/start_frame=0 +animation/clip_64/end_frame=0 +animation/clip_64/loops=false +animation/clip_65/name="" +animation/clip_65/start_frame=0 +animation/clip_65/end_frame=0 +animation/clip_65/loops=false +animation/clip_66/name="" +animation/clip_66/start_frame=0 +animation/clip_66/end_frame=0 +animation/clip_66/loops=false +animation/clip_67/name="" +animation/clip_67/start_frame=0 +animation/clip_67/end_frame=0 +animation/clip_67/loops=false +animation/clip_68/name="" +animation/clip_68/start_frame=0 +animation/clip_68/end_frame=0 +animation/clip_68/loops=false +animation/clip_69/name="" +animation/clip_69/start_frame=0 +animation/clip_69/end_frame=0 +animation/clip_69/loops=false +animation/clip_70/name="" +animation/clip_70/start_frame=0 +animation/clip_70/end_frame=0 +animation/clip_70/loops=false +animation/clip_71/name="" +animation/clip_71/start_frame=0 +animation/clip_71/end_frame=0 +animation/clip_71/loops=false +animation/clip_72/name="" +animation/clip_72/start_frame=0 +animation/clip_72/end_frame=0 +animation/clip_72/loops=false +animation/clip_73/name="" +animation/clip_73/start_frame=0 +animation/clip_73/end_frame=0 +animation/clip_73/loops=false +animation/clip_74/name="" +animation/clip_74/start_frame=0 +animation/clip_74/end_frame=0 +animation/clip_74/loops=false +animation/clip_75/name="" +animation/clip_75/start_frame=0 +animation/clip_75/end_frame=0 +animation/clip_75/loops=false +animation/clip_76/name="" +animation/clip_76/start_frame=0 +animation/clip_76/end_frame=0 +animation/clip_76/loops=false +animation/clip_77/name="" +animation/clip_77/start_frame=0 +animation/clip_77/end_frame=0 +animation/clip_77/loops=false +animation/clip_78/name="" +animation/clip_78/start_frame=0 +animation/clip_78/end_frame=0 +animation/clip_78/loops=false +animation/clip_79/name="" +animation/clip_79/start_frame=0 +animation/clip_79/end_frame=0 +animation/clip_79/loops=false +animation/clip_80/name="" +animation/clip_80/start_frame=0 +animation/clip_80/end_frame=0 +animation/clip_80/loops=false +animation/clip_81/name="" +animation/clip_81/start_frame=0 +animation/clip_81/end_frame=0 +animation/clip_81/loops=false +animation/clip_82/name="" +animation/clip_82/start_frame=0 +animation/clip_82/end_frame=0 +animation/clip_82/loops=false +animation/clip_83/name="" +animation/clip_83/start_frame=0 +animation/clip_83/end_frame=0 +animation/clip_83/loops=false +animation/clip_84/name="" +animation/clip_84/start_frame=0 +animation/clip_84/end_frame=0 +animation/clip_84/loops=false +animation/clip_85/name="" +animation/clip_85/start_frame=0 +animation/clip_85/end_frame=0 +animation/clip_85/loops=false +animation/clip_86/name="" +animation/clip_86/start_frame=0 +animation/clip_86/end_frame=0 +animation/clip_86/loops=false +animation/clip_87/name="" +animation/clip_87/start_frame=0 +animation/clip_87/end_frame=0 +animation/clip_87/loops=false +animation/clip_88/name="" +animation/clip_88/start_frame=0 +animation/clip_88/end_frame=0 +animation/clip_88/loops=false +animation/clip_89/name="" +animation/clip_89/start_frame=0 +animation/clip_89/end_frame=0 +animation/clip_89/loops=false +animation/clip_90/name="" +animation/clip_90/start_frame=0 +animation/clip_90/end_frame=0 +animation/clip_90/loops=false +animation/clip_91/name="" +animation/clip_91/start_frame=0 +animation/clip_91/end_frame=0 +animation/clip_91/loops=false +animation/clip_92/name="" +animation/clip_92/start_frame=0 +animation/clip_92/end_frame=0 +animation/clip_92/loops=false +animation/clip_93/name="" +animation/clip_93/start_frame=0 +animation/clip_93/end_frame=0 +animation/clip_93/loops=false +animation/clip_94/name="" +animation/clip_94/start_frame=0 +animation/clip_94/end_frame=0 +animation/clip_94/loops=false +animation/clip_95/name="" +animation/clip_95/start_frame=0 +animation/clip_95/end_frame=0 +animation/clip_95/loops=false +animation/clip_96/name="" +animation/clip_96/start_frame=0 +animation/clip_96/end_frame=0 +animation/clip_96/loops=false +animation/clip_97/name="" +animation/clip_97/start_frame=0 +animation/clip_97/end_frame=0 +animation/clip_97/loops=false +animation/clip_98/name="" +animation/clip_98/start_frame=0 +animation/clip_98/end_frame=0 +animation/clip_98/loops=false +animation/clip_99/name="" +animation/clip_99/start_frame=0 +animation/clip_99/end_frame=0 +animation/clip_99/loops=false +animation/clip_100/name="" +animation/clip_100/start_frame=0 +animation/clip_100/end_frame=0 +animation/clip_100/loops=false +animation/clip_101/name="" +animation/clip_101/start_frame=0 +animation/clip_101/end_frame=0 +animation/clip_101/loops=false +animation/clip_102/name="" +animation/clip_102/start_frame=0 +animation/clip_102/end_frame=0 +animation/clip_102/loops=false +animation/clip_103/name="" +animation/clip_103/start_frame=0 +animation/clip_103/end_frame=0 +animation/clip_103/loops=false +animation/clip_104/name="" +animation/clip_104/start_frame=0 +animation/clip_104/end_frame=0 +animation/clip_104/loops=false +animation/clip_105/name="" +animation/clip_105/start_frame=0 +animation/clip_105/end_frame=0 +animation/clip_105/loops=false +animation/clip_106/name="" +animation/clip_106/start_frame=0 +animation/clip_106/end_frame=0 +animation/clip_106/loops=false +animation/clip_107/name="" +animation/clip_107/start_frame=0 +animation/clip_107/end_frame=0 +animation/clip_107/loops=false +animation/clip_108/name="" +animation/clip_108/start_frame=0 +animation/clip_108/end_frame=0 +animation/clip_108/loops=false +animation/clip_109/name="" +animation/clip_109/start_frame=0 +animation/clip_109/end_frame=0 +animation/clip_109/loops=false +animation/clip_110/name="" +animation/clip_110/start_frame=0 +animation/clip_110/end_frame=0 +animation/clip_110/loops=false +animation/clip_111/name="" +animation/clip_111/start_frame=0 +animation/clip_111/end_frame=0 +animation/clip_111/loops=false +animation/clip_112/name="" +animation/clip_112/start_frame=0 +animation/clip_112/end_frame=0 +animation/clip_112/loops=false +animation/clip_113/name="" +animation/clip_113/start_frame=0 +animation/clip_113/end_frame=0 +animation/clip_113/loops=false +animation/clip_114/name="" +animation/clip_114/start_frame=0 +animation/clip_114/end_frame=0 +animation/clip_114/loops=false +animation/clip_115/name="" +animation/clip_115/start_frame=0 +animation/clip_115/end_frame=0 +animation/clip_115/loops=false +animation/clip_116/name="" +animation/clip_116/start_frame=0 +animation/clip_116/end_frame=0 +animation/clip_116/loops=false +animation/clip_117/name="" +animation/clip_117/start_frame=0 +animation/clip_117/end_frame=0 +animation/clip_117/loops=false +animation/clip_118/name="" +animation/clip_118/start_frame=0 +animation/clip_118/end_frame=0 +animation/clip_118/loops=false +animation/clip_119/name="" +animation/clip_119/start_frame=0 +animation/clip_119/end_frame=0 +animation/clip_119/loops=false +animation/clip_120/name="" +animation/clip_120/start_frame=0 +animation/clip_120/end_frame=0 +animation/clip_120/loops=false +animation/clip_121/name="" +animation/clip_121/start_frame=0 +animation/clip_121/end_frame=0 +animation/clip_121/loops=false +animation/clip_122/name="" +animation/clip_122/start_frame=0 +animation/clip_122/end_frame=0 +animation/clip_122/loops=false +animation/clip_123/name="" +animation/clip_123/start_frame=0 +animation/clip_123/end_frame=0 +animation/clip_123/loops=false +animation/clip_124/name="" +animation/clip_124/start_frame=0 +animation/clip_124/end_frame=0 +animation/clip_124/loops=false +animation/clip_125/name="" +animation/clip_125/start_frame=0 +animation/clip_125/end_frame=0 +animation/clip_125/loops=false +animation/clip_126/name="" +animation/clip_126/start_frame=0 +animation/clip_126/end_frame=0 +animation/clip_126/loops=false +animation/clip_127/name="" +animation/clip_127/start_frame=0 +animation/clip_127/end_frame=0 +animation/clip_127/loops=false +animation/clip_128/name="" +animation/clip_128/start_frame=0 +animation/clip_128/end_frame=0 +animation/clip_128/loops=false +animation/clip_129/name="" +animation/clip_129/start_frame=0 +animation/clip_129/end_frame=0 +animation/clip_129/loops=false +animation/clip_130/name="" +animation/clip_130/start_frame=0 +animation/clip_130/end_frame=0 +animation/clip_130/loops=false +animation/clip_131/name="" +animation/clip_131/start_frame=0 +animation/clip_131/end_frame=0 +animation/clip_131/loops=false +animation/clip_132/name="" +animation/clip_132/start_frame=0 +animation/clip_132/end_frame=0 +animation/clip_132/loops=false +animation/clip_133/name="" +animation/clip_133/start_frame=0 +animation/clip_133/end_frame=0 +animation/clip_133/loops=false +animation/clip_134/name="" +animation/clip_134/start_frame=0 +animation/clip_134/end_frame=0 +animation/clip_134/loops=false +animation/clip_135/name="" +animation/clip_135/start_frame=0 +animation/clip_135/end_frame=0 +animation/clip_135/loops=false +animation/clip_136/name="" +animation/clip_136/start_frame=0 +animation/clip_136/end_frame=0 +animation/clip_136/loops=false +animation/clip_137/name="" +animation/clip_137/start_frame=0 +animation/clip_137/end_frame=0 +animation/clip_137/loops=false +animation/clip_138/name="" +animation/clip_138/start_frame=0 +animation/clip_138/end_frame=0 +animation/clip_138/loops=false +animation/clip_139/name="" +animation/clip_139/start_frame=0 +animation/clip_139/end_frame=0 +animation/clip_139/loops=false +animation/clip_140/name="" +animation/clip_140/start_frame=0 +animation/clip_140/end_frame=0 +animation/clip_140/loops=false +animation/clip_141/name="" +animation/clip_141/start_frame=0 +animation/clip_141/end_frame=0 +animation/clip_141/loops=false +animation/clip_142/name="" +animation/clip_142/start_frame=0 +animation/clip_142/end_frame=0 +animation/clip_142/loops=false +animation/clip_143/name="" +animation/clip_143/start_frame=0 +animation/clip_143/end_frame=0 +animation/clip_143/loops=false +animation/clip_144/name="" +animation/clip_144/start_frame=0 +animation/clip_144/end_frame=0 +animation/clip_144/loops=false +animation/clip_145/name="" +animation/clip_145/start_frame=0 +animation/clip_145/end_frame=0 +animation/clip_145/loops=false +animation/clip_146/name="" +animation/clip_146/start_frame=0 +animation/clip_146/end_frame=0 +animation/clip_146/loops=false +animation/clip_147/name="" +animation/clip_147/start_frame=0 +animation/clip_147/end_frame=0 +animation/clip_147/loops=false +animation/clip_148/name="" +animation/clip_148/start_frame=0 +animation/clip_148/end_frame=0 +animation/clip_148/loops=false +animation/clip_149/name="" +animation/clip_149/start_frame=0 +animation/clip_149/end_frame=0 +animation/clip_149/loops=false +animation/clip_150/name="" +animation/clip_150/start_frame=0 +animation/clip_150/end_frame=0 +animation/clip_150/loops=false +animation/clip_151/name="" +animation/clip_151/start_frame=0 +animation/clip_151/end_frame=0 +animation/clip_151/loops=false +animation/clip_152/name="" +animation/clip_152/start_frame=0 +animation/clip_152/end_frame=0 +animation/clip_152/loops=false +animation/clip_153/name="" +animation/clip_153/start_frame=0 +animation/clip_153/end_frame=0 +animation/clip_153/loops=false +animation/clip_154/name="" +animation/clip_154/start_frame=0 +animation/clip_154/end_frame=0 +animation/clip_154/loops=false +animation/clip_155/name="" +animation/clip_155/start_frame=0 +animation/clip_155/end_frame=0 +animation/clip_155/loops=false +animation/clip_156/name="" +animation/clip_156/start_frame=0 +animation/clip_156/end_frame=0 +animation/clip_156/loops=false +animation/clip_157/name="" +animation/clip_157/start_frame=0 +animation/clip_157/end_frame=0 +animation/clip_157/loops=false +animation/clip_158/name="" +animation/clip_158/start_frame=0 +animation/clip_158/end_frame=0 +animation/clip_158/loops=false +animation/clip_159/name="" +animation/clip_159/start_frame=0 +animation/clip_159/end_frame=0 +animation/clip_159/loops=false +animation/clip_160/name="" +animation/clip_160/start_frame=0 +animation/clip_160/end_frame=0 +animation/clip_160/loops=false +animation/clip_161/name="" +animation/clip_161/start_frame=0 +animation/clip_161/end_frame=0 +animation/clip_161/loops=false +animation/clip_162/name="" +animation/clip_162/start_frame=0 +animation/clip_162/end_frame=0 +animation/clip_162/loops=false +animation/clip_163/name="" +animation/clip_163/start_frame=0 +animation/clip_163/end_frame=0 +animation/clip_163/loops=false +animation/clip_164/name="" +animation/clip_164/start_frame=0 +animation/clip_164/end_frame=0 +animation/clip_164/loops=false +animation/clip_165/name="" +animation/clip_165/start_frame=0 +animation/clip_165/end_frame=0 +animation/clip_165/loops=false +animation/clip_166/name="" +animation/clip_166/start_frame=0 +animation/clip_166/end_frame=0 +animation/clip_166/loops=false +animation/clip_167/name="" +animation/clip_167/start_frame=0 +animation/clip_167/end_frame=0 +animation/clip_167/loops=false +animation/clip_168/name="" +animation/clip_168/start_frame=0 +animation/clip_168/end_frame=0 +animation/clip_168/loops=false +animation/clip_169/name="" +animation/clip_169/start_frame=0 +animation/clip_169/end_frame=0 +animation/clip_169/loops=false +animation/clip_170/name="" +animation/clip_170/start_frame=0 +animation/clip_170/end_frame=0 +animation/clip_170/loops=false +animation/clip_171/name="" +animation/clip_171/start_frame=0 +animation/clip_171/end_frame=0 +animation/clip_171/loops=false +animation/clip_172/name="" +animation/clip_172/start_frame=0 +animation/clip_172/end_frame=0 +animation/clip_172/loops=false +animation/clip_173/name="" +animation/clip_173/start_frame=0 +animation/clip_173/end_frame=0 +animation/clip_173/loops=false +animation/clip_174/name="" +animation/clip_174/start_frame=0 +animation/clip_174/end_frame=0 +animation/clip_174/loops=false +animation/clip_175/name="" +animation/clip_175/start_frame=0 +animation/clip_175/end_frame=0 +animation/clip_175/loops=false +animation/clip_176/name="" +animation/clip_176/start_frame=0 +animation/clip_176/end_frame=0 +animation/clip_176/loops=false +animation/clip_177/name="" +animation/clip_177/start_frame=0 +animation/clip_177/end_frame=0 +animation/clip_177/loops=false +animation/clip_178/name="" +animation/clip_178/start_frame=0 +animation/clip_178/end_frame=0 +animation/clip_178/loops=false +animation/clip_179/name="" +animation/clip_179/start_frame=0 +animation/clip_179/end_frame=0 +animation/clip_179/loops=false +animation/clip_180/name="" +animation/clip_180/start_frame=0 +animation/clip_180/end_frame=0 +animation/clip_180/loops=false +animation/clip_181/name="" +animation/clip_181/start_frame=0 +animation/clip_181/end_frame=0 +animation/clip_181/loops=false +animation/clip_182/name="" +animation/clip_182/start_frame=0 +animation/clip_182/end_frame=0 +animation/clip_182/loops=false +animation/clip_183/name="" +animation/clip_183/start_frame=0 +animation/clip_183/end_frame=0 +animation/clip_183/loops=false +animation/clip_184/name="" +animation/clip_184/start_frame=0 +animation/clip_184/end_frame=0 +animation/clip_184/loops=false +animation/clip_185/name="" +animation/clip_185/start_frame=0 +animation/clip_185/end_frame=0 +animation/clip_185/loops=false +animation/clip_186/name="" +animation/clip_186/start_frame=0 +animation/clip_186/end_frame=0 +animation/clip_186/loops=false +animation/clip_187/name="" +animation/clip_187/start_frame=0 +animation/clip_187/end_frame=0 +animation/clip_187/loops=false +animation/clip_188/name="" +animation/clip_188/start_frame=0 +animation/clip_188/end_frame=0 +animation/clip_188/loops=false +animation/clip_189/name="" +animation/clip_189/start_frame=0 +animation/clip_189/end_frame=0 +animation/clip_189/loops=false +animation/clip_190/name="" +animation/clip_190/start_frame=0 +animation/clip_190/end_frame=0 +animation/clip_190/loops=false +animation/clip_191/name="" +animation/clip_191/start_frame=0 +animation/clip_191/end_frame=0 +animation/clip_191/loops=false +animation/clip_192/name="" +animation/clip_192/start_frame=0 +animation/clip_192/end_frame=0 +animation/clip_192/loops=false +animation/clip_193/name="" +animation/clip_193/start_frame=0 +animation/clip_193/end_frame=0 +animation/clip_193/loops=false +animation/clip_194/name="" +animation/clip_194/start_frame=0 +animation/clip_194/end_frame=0 +animation/clip_194/loops=false +animation/clip_195/name="" +animation/clip_195/start_frame=0 +animation/clip_195/end_frame=0 +animation/clip_195/loops=false +animation/clip_196/name="" +animation/clip_196/start_frame=0 +animation/clip_196/end_frame=0 +animation/clip_196/loops=false +animation/clip_197/name="" +animation/clip_197/start_frame=0 +animation/clip_197/end_frame=0 +animation/clip_197/loops=false +animation/clip_198/name="" +animation/clip_198/start_frame=0 +animation/clip_198/end_frame=0 +animation/clip_198/loops=false +animation/clip_199/name="" +animation/clip_199/start_frame=0 +animation/clip_199/end_frame=0 +animation/clip_199/loops=false +animation/clip_200/name="" +animation/clip_200/start_frame=0 +animation/clip_200/end_frame=0 +animation/clip_200/loops=false +animation/clip_201/name="" +animation/clip_201/start_frame=0 +animation/clip_201/end_frame=0 +animation/clip_201/loops=false +animation/clip_202/name="" +animation/clip_202/start_frame=0 +animation/clip_202/end_frame=0 +animation/clip_202/loops=false +animation/clip_203/name="" +animation/clip_203/start_frame=0 +animation/clip_203/end_frame=0 +animation/clip_203/loops=false +animation/clip_204/name="" +animation/clip_204/start_frame=0 +animation/clip_204/end_frame=0 +animation/clip_204/loops=false +animation/clip_205/name="" +animation/clip_205/start_frame=0 +animation/clip_205/end_frame=0 +animation/clip_205/loops=false +animation/clip_206/name="" +animation/clip_206/start_frame=0 +animation/clip_206/end_frame=0 +animation/clip_206/loops=false +animation/clip_207/name="" +animation/clip_207/start_frame=0 +animation/clip_207/end_frame=0 +animation/clip_207/loops=false +animation/clip_208/name="" +animation/clip_208/start_frame=0 +animation/clip_208/end_frame=0 +animation/clip_208/loops=false +animation/clip_209/name="" +animation/clip_209/start_frame=0 +animation/clip_209/end_frame=0 +animation/clip_209/loops=false +animation/clip_210/name="" +animation/clip_210/start_frame=0 +animation/clip_210/end_frame=0 +animation/clip_210/loops=false +animation/clip_211/name="" +animation/clip_211/start_frame=0 +animation/clip_211/end_frame=0 +animation/clip_211/loops=false +animation/clip_212/name="" +animation/clip_212/start_frame=0 +animation/clip_212/end_frame=0 +animation/clip_212/loops=false +animation/clip_213/name="" +animation/clip_213/start_frame=0 +animation/clip_213/end_frame=0 +animation/clip_213/loops=false +animation/clip_214/name="" +animation/clip_214/start_frame=0 +animation/clip_214/end_frame=0 +animation/clip_214/loops=false +animation/clip_215/name="" +animation/clip_215/start_frame=0 +animation/clip_215/end_frame=0 +animation/clip_215/loops=false +animation/clip_216/name="" +animation/clip_216/start_frame=0 +animation/clip_216/end_frame=0 +animation/clip_216/loops=false +animation/clip_217/name="" +animation/clip_217/start_frame=0 +animation/clip_217/end_frame=0 +animation/clip_217/loops=false +animation/clip_218/name="" +animation/clip_218/start_frame=0 +animation/clip_218/end_frame=0 +animation/clip_218/loops=false +animation/clip_219/name="" +animation/clip_219/start_frame=0 +animation/clip_219/end_frame=0 +animation/clip_219/loops=false +animation/clip_220/name="" +animation/clip_220/start_frame=0 +animation/clip_220/end_frame=0 +animation/clip_220/loops=false +animation/clip_221/name="" +animation/clip_221/start_frame=0 +animation/clip_221/end_frame=0 +animation/clip_221/loops=false +animation/clip_222/name="" +animation/clip_222/start_frame=0 +animation/clip_222/end_frame=0 +animation/clip_222/loops=false +animation/clip_223/name="" +animation/clip_223/start_frame=0 +animation/clip_223/end_frame=0 +animation/clip_223/loops=false +animation/clip_224/name="" +animation/clip_224/start_frame=0 +animation/clip_224/end_frame=0 +animation/clip_224/loops=false +animation/clip_225/name="" +animation/clip_225/start_frame=0 +animation/clip_225/end_frame=0 +animation/clip_225/loops=false +animation/clip_226/name="" +animation/clip_226/start_frame=0 +animation/clip_226/end_frame=0 +animation/clip_226/loops=false +animation/clip_227/name="" +animation/clip_227/start_frame=0 +animation/clip_227/end_frame=0 +animation/clip_227/loops=false +animation/clip_228/name="" +animation/clip_228/start_frame=0 +animation/clip_228/end_frame=0 +animation/clip_228/loops=false +animation/clip_229/name="" +animation/clip_229/start_frame=0 +animation/clip_229/end_frame=0 +animation/clip_229/loops=false +animation/clip_230/name="" +animation/clip_230/start_frame=0 +animation/clip_230/end_frame=0 +animation/clip_230/loops=false +animation/clip_231/name="" +animation/clip_231/start_frame=0 +animation/clip_231/end_frame=0 +animation/clip_231/loops=false +animation/clip_232/name="" +animation/clip_232/start_frame=0 +animation/clip_232/end_frame=0 +animation/clip_232/loops=false +animation/clip_233/name="" +animation/clip_233/start_frame=0 +animation/clip_233/end_frame=0 +animation/clip_233/loops=false +animation/clip_234/name="" +animation/clip_234/start_frame=0 +animation/clip_234/end_frame=0 +animation/clip_234/loops=false +animation/clip_235/name="" +animation/clip_235/start_frame=0 +animation/clip_235/end_frame=0 +animation/clip_235/loops=false +animation/clip_236/name="" +animation/clip_236/start_frame=0 +animation/clip_236/end_frame=0 +animation/clip_236/loops=false +animation/clip_237/name="" +animation/clip_237/start_frame=0 +animation/clip_237/end_frame=0 +animation/clip_237/loops=false +animation/clip_238/name="" +animation/clip_238/start_frame=0 +animation/clip_238/end_frame=0 +animation/clip_238/loops=false +animation/clip_239/name="" +animation/clip_239/start_frame=0 +animation/clip_239/end_frame=0 +animation/clip_239/loops=false +animation/clip_240/name="" +animation/clip_240/start_frame=0 +animation/clip_240/end_frame=0 +animation/clip_240/loops=false +animation/clip_241/name="" +animation/clip_241/start_frame=0 +animation/clip_241/end_frame=0 +animation/clip_241/loops=false +animation/clip_242/name="" +animation/clip_242/start_frame=0 +animation/clip_242/end_frame=0 +animation/clip_242/loops=false +animation/clip_243/name="" +animation/clip_243/start_frame=0 +animation/clip_243/end_frame=0 +animation/clip_243/loops=false +animation/clip_244/name="" +animation/clip_244/start_frame=0 +animation/clip_244/end_frame=0 +animation/clip_244/loops=false +animation/clip_245/name="" +animation/clip_245/start_frame=0 +animation/clip_245/end_frame=0 +animation/clip_245/loops=false +animation/clip_246/name="" +animation/clip_246/start_frame=0 +animation/clip_246/end_frame=0 +animation/clip_246/loops=false +animation/clip_247/name="" +animation/clip_247/start_frame=0 +animation/clip_247/end_frame=0 +animation/clip_247/loops=false +animation/clip_248/name="" +animation/clip_248/start_frame=0 +animation/clip_248/end_frame=0 +animation/clip_248/loops=false +animation/clip_249/name="" +animation/clip_249/start_frame=0 +animation/clip_249/end_frame=0 +animation/clip_249/loops=false +animation/clip_250/name="" +animation/clip_250/start_frame=0 +animation/clip_250/end_frame=0 +animation/clip_250/loops=false +animation/clip_251/name="" +animation/clip_251/start_frame=0 +animation/clip_251/end_frame=0 +animation/clip_251/loops=false +animation/clip_252/name="" +animation/clip_252/start_frame=0 +animation/clip_252/end_frame=0 +animation/clip_252/loops=false +animation/clip_253/name="" +animation/clip_253/start_frame=0 +animation/clip_253/end_frame=0 +animation/clip_253/loops=false +animation/clip_254/name="" +animation/clip_254/start_frame=0 +animation/clip_254/end_frame=0 +animation/clip_254/loops=false +animation/clip_255/name="" +animation/clip_255/start_frame=0 +animation/clip_255/end_frame=0 +animation/clip_255/loops=false +animation/clip_256/name="" +animation/clip_256/start_frame=0 +animation/clip_256/end_frame=0 +animation/clip_256/loops=false diff --git a/Client/Scenes/Matchmaking/Client/Network_connection.gd b/Client/Scenes/Matchmaking/Client/Network_connection.gd new file mode 100644 index 0000000..82f634a --- /dev/null +++ b/Client/Scenes/Matchmaking/Client/Network_connection.gd @@ -0,0 +1,45 @@ +extends Node + +const SERVER_IP = "willipink.eu" +const SERVER_PORT = 14600 + +onready var _start_button = get_node("Start_button") +onready var _disconnect_button = get_node("Disconnect_button") +var _connected = false + +func _ready(): + get_tree().connect("connected_to_server", self, "_connected_ok") + initialize_connection() + +func initialize_connection(): + $Try_to_connect_to_server_timer.start() + connect_to_server() + _start_button.text = "Connecting..." + +func connect_to_server(): + print("Try to join the server.") + var peer = NetworkedMultiplayerENet.new() + peer.create_client(SERVER_IP, SERVER_PORT) + get_tree().set_network_peer(peer) + +func _connected_ok(): + $Try_to_connect_to_server_timer.stop() + Player.set_player_id(get_tree().get_network_unique_id()) + _connected = true + _start_button.text = "Start" + _start_button.disabled = false + _disconnect_button.text = "Disconnect" + +func _on_Try_to_connect_to_server_timer_timeout(): + if !_connected: + connect_to_server() + +func disconnect_from_server(): + get_tree().set_network_peer(null) + +func _on_Start_button_pressed(): + get_tree().change_scene("res://Scenes/Matchmaking/Lobby/Lobby.tscn") + +func _on_Disconnect_button_pressed(): + disconnect_from_server() + get_tree().change_scene("res://Scenes/Matchmaking/Menu/Menu.tscn") diff --git a/Client/Scenes/Matchmaking/Client/Network_connection.tscn b/Client/Scenes/Matchmaking/Client/Network_connection.tscn new file mode 100644 index 0000000..cdba751 --- /dev/null +++ b/Client/Scenes/Matchmaking/Client/Network_connection.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://Scenes/Matchmaking/Client/Network_connection.gd" type="Script" id=2] + +[node name="Network_connection" type="Node"] +script = ExtResource( 2 ) + +[node name="Background_image" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 1 ) +stretch_mode = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Start_button" type="Button" parent="."] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -188.5 +margin_top = -70.0 +margin_right = 188.5 +margin_bottom = 70.0 +disabled = true +text = "Connecting..." +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Disconnect_button" type="Button" parent="."] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -188.5 +margin_top = 103.958 +margin_right = 188.5 +margin_bottom = 243.958 +text = "Cancel" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Try_to_connect_to_server_timer" type="Timer" parent="."] +wait_time = 2.0 +[connection signal="pressed" from="Start_button" to="." method="_on_Start_button_pressed"] +[connection signal="pressed" from="Disconnect_button" to="." method="_on_Disconnect_button_pressed"] +[connection signal="timeout" from="Try_to_connect_to_server_timer" to="." method="_on_Try_to_connect_to_server_timer_timeout"] diff --git a/Client/Scenes/Matchmaking/Game/Camera_controller/Camera_controller.gd b/Client/Scenes/Matchmaking/Game/Camera_controller/Camera_controller.gd new file mode 100644 index 0000000..bba5e19 --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Camera_controller/Camera_controller.gd @@ -0,0 +1,36 @@ +extends Spatial + +const MOVE_MARGIN = 20 +const MOVE_SPEED = 15 + +const X_BORDER_LIMIT = 8 +const X_MAP_OFFSET = 2 + +const Z_BORDER_LIMIT = 3 +const Z_MAP_OFFSET = 1 + +onready var cam = $Camera + +func _process(delta): + var mouse_position = get_viewport().get_mouse_position() + calc_move(mouse_position, delta) + +func calc_move(mouse_position, delta): + var screen_size = get_viewport().size + var position = translation + + if mouse_position.x < MOVE_MARGIN: + position.x -= MOVE_SPEED * delta + + if mouse_position.y < MOVE_MARGIN: + position.z -= MOVE_SPEED * delta + + if mouse_position.x > screen_size.x - MOVE_MARGIN: + position.x += MOVE_SPEED * delta + + if mouse_position.y > screen_size.y - MOVE_MARGIN: + position.z += MOVE_SPEED * delta + + position.x = clamp(position.x, -X_BORDER_LIMIT, X_BORDER_LIMIT + X_MAP_OFFSET) + position.z = clamp(position.z, -Z_BORDER_LIMIT - Z_MAP_OFFSET, Z_BORDER_LIMIT - Z_MAP_OFFSET) + translation = position diff --git a/Client/Scenes/Matchmaking/Game/Game_manager.gd b/Client/Scenes/Matchmaking/Game/Game_manager.gd new file mode 100644 index 0000000..ed8991c --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Game_manager.gd @@ -0,0 +1,178 @@ +extends Spatial + +var _current_player_index + +var _turn_number + +var _round_counter = 0 + +var _other_players = [] + +var _map + +var _game_started = false + +var _ability_left = false + +var _previous_hex = null + +func _ready(): + $GUI/Player_name_panel/HBoxContainer/Player_name.text = Player.get_player_name() + _other_players = NetworkingSync._player_in_same_game_room_list.duplicate() + _other_players.erase([Player.get_player_id(), Player.get_player_name()]) + init_game() + fill_player_list() + + if Player.is_host(): + init_game_state() + + NetworkingSync.send_ready_signal() + +func init_game(): + create_map() + _turn_number = 1 + $GUI/Bottom_left_panel/VBoxContainer/HBoxContainer/Turn_indicator.text = str(_turn_number) + +func fill_player_list(): + for player in _other_players: + add_other_players_to_list(player[1]) + +func update_player_list(): + for child in $GUI/Player_info/VBoxContainer/Player_list.get_children(): + child.queue_free() + + fill_player_list() + +func add_other_players_to_list(player_name): + var player = load("res://Scenes/Matchmaking/Game_room/Player_entry.tscn").instance() + player.set_player_name(player_name) + $GUI/Player_info/VBoxContainer/Player_list.add_child(player) + +func create_map(): + _map = load("res://Scenes/Matchmaking/Game/Map/Map.tscn").instance() + add_child(_map) + +func init_game_state(): + yield(NetworkingSync, "all_ready") + var starting_player_index = calculate_stating_player_index() + + set_starting_player(starting_player_index) + for player in _other_players: + rpc_id(player[0], "set_starting_player", starting_player_index) + +func is_my_turn(): + return NetworkingSync._player_in_same_game_room_list[_current_player_index][0] == Player.get_player_id() + +func calculate_stating_player_index(): + return int(rand_range(0, len(NetworkingSync._player_in_same_game_room_list))) + +remote func set_starting_player(starting_player_index): + _current_player_index = starting_player_index + $GUI/Top_panel/Top_panel_container/Player_indicator.text = str(NetworkingSync._player_in_same_game_room_list[_current_player_index][1]) + update_current_player() + + +func update_current_player(): + if is_my_turn(): + _ability_left = true + _round_counter = 0 + _previous_hex = null + $GUI/Bottom_left_panel/VBoxContainer/Next_turn_button.disabled = false + else: + $GUI/Bottom_left_panel/VBoxContainer/Next_turn_button.disabled = true + +func _on_Next_turn_button_pressed(): + next_turn() + +func next_turn(): + next_player() + for player in _other_players: + rpc_id(player[0], "next_player") + _turn_number += 1 + $GUI/Bottom_left_panel/VBoxContainer/HBoxContainer/Turn_indicator.text = str(_turn_number) + +remote func next_player(): + _current_player_index = (_current_player_index + 1) % len(NetworkingSync._player_in_same_game_room_list) + $GUI/Top_panel/Top_panel_container/Player_indicator.text = str(NetworkingSync._player_in_same_game_room_list[_current_player_index][1]) + update_current_player() + +func game_started(): + return _game_started + +func color_the_hex(hex_node): + for player in _other_players: + rpc_id(player[0], "color_the_hex_to_player_color", hex_node._x, hex_node._y) + color_the_hex_to_player_color(hex_node._x, hex_node._y) + +remote func color_the_hex_to_player_color(hex_x, hex_y): + _map._hexes[hex_x][hex_y].set_color(_current_player_index) + +func ability_left(): + return _ability_left + +func get_previous_hex(): + return _previous_hex + +func try_to_occupy_hex(hex_node): + color_the_hex(hex_node) + occupy_hex(hex_node._x, hex_node._y) + for player in _other_players: + rpc_id(player[0], "occupy_hex", hex_node._x, hex_node._y) + + _previous_hex = hex_node + _round_counter += 1 + + if _round_counter >= _turn_number: + next_turn() + else: + if !hex_node.is_any_neighbour_free(): + left_game() + +remote func occupy_hex(hex_x, hex_y): + _map._hexes[hex_x][hex_y].occupy_hex() + +#func _process(delta): +# if len(_other_players) <= 0 and _game_started: +# end_game(true) + +func left_game(): + for player in _other_players: + rpc_id(player[0], "player_left", Player.get_player_id(), Player.get_player_name()) + end_game(false) + +func end_game(is_winning): + if is_winning: + $End_game_panel/Label.text = "You won." + $GUI.visible = false + $End_game_panel.visible = true + +remote func player_left(player_id, player_name): + print("Player: " + str(player_id) + " left.") + _other_players.erase([player_id, player_name]) + NetworkingSync._player_in_same_game_room_list.erase([player_id, player_name]) + update_player_list() + check_for_win() + next_player() + +func check_for_win(): + if len(_other_players) <= 0: + end_game(true) + +func back_to_lobby(): + get_tree().change_scene("res://Scenes/Matchmaking/Lobby/Lobby.tscn") + +func _on_Back_to_lobby_button_pressed(): + back_to_lobby() + +func _on_Surrender_button_pressed(): + $Menu_panel.visible = false + left_game() + +func _input(event): + if Input.is_key_pressed(KEY_ESCAPE) and $Menu_panel.visible: + $Menu_panel.visible = false + elif Input.is_key_pressed(KEY_ESCAPE) and !$Menu_panel.visible: + $Menu_panel.visible = true + +func _on_Close_pressed(): + $Menu_panel.visible = false diff --git a/Client/Scenes/Matchmaking/Game/Game_manager.tscn b/Client/Scenes/Matchmaking/Game/Game_manager.tscn new file mode 100644 index 0000000..617332f --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Game_manager.tscn @@ -0,0 +1,303 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Game/Camera_controller/Camera_controller.gd" type="Script" id=2] +[ext_resource path="res://Scenes/Matchmaking/Game/Game_manager.gd" type="Script" id=3] +[ext_resource path="res://Scenes/Matchmaking/Game/Mouse_controller/Mouse_controller.gd" type="Script" id=4] + +[node name="Game_manager" type="Spatial"] +script = ExtResource( 3 ) + +[node name="End_game_panel" type="Control" parent="."] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ColorRect" type="ColorRect" parent="End_game_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 1.22772 +margin_right = 1.22778 +color = Color( 0.156863, 0.611765, 0.160784, 0.392157 ) + +[node name="Label" type="Label" parent="End_game_panel"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -223.5 +margin_top = -89.0 +margin_right = 223.5 +margin_bottom = 89.0 +text = "You lose" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ColorRect2" type="ColorRect" parent="End_game_panel/Label"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 1, 1, 0.235294 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Back_to_lobby_button" type="Button" parent="End_game_panel"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -183.0 +margin_top = 135.815 +margin_right = 183.0 +margin_bottom = 313.815 +text = "Back to lobby" + +[node name="GUI" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_info" type="Control" parent="GUI"] +margin_left = 1650.14 +margin_top = 68.4775 +margin_right = 1910.14 +margin_bottom = 283.477 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ColorRect" type="ColorRect" parent="GUI/Player_info"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.831373, 0, 0, 0.137255 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="GUI/Player_info"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="GUI/Player_info/VBoxContainer"] +margin_right = 260.0 +margin_bottom = 14.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +text = "Oponents left:" +align = 1 +valign = 1 + +[node name="Player_list" type="VBoxContainer" parent="GUI/Player_info/VBoxContainer"] +margin_top = 18.0 +margin_right = 260.0 +margin_bottom = 214.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_name_panel" type="Control" parent="GUI"] +margin_right = 306.0 +margin_bottom = 40.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="GUI/Player_name_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_name_info_laabel" type="Label" parent="GUI/Player_name_panel/HBoxContainer"] +margin_right = 47.0 +margin_bottom = 40.0 +size_flags_vertical = 3 +text = "Player: " +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_name" type="Label" parent="GUI/Player_name_panel/HBoxContainer"] +margin_left = 51.0 +margin_right = 306.0 +margin_bottom = 40.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Bob" +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Top_panel" type="Control" parent="GUI"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -960.0 +margin_right = 960.0 +margin_bottom = 50.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Top_panel_container" type="HBoxContainer" parent="GUI/Top_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_label" type="Label" parent="GUI/Top_panel/Top_panel_container"] +margin_right = 958.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Turn of:" +align = 2 +valign = 1 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Player_indicator" type="Label" parent="GUI/Top_panel/Top_panel_container"] +margin_left = 962.0 +margin_right = 1920.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Player 1" +valign = 1 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Bottom_left_panel" type="Control" parent="GUI"] +anchor_top = 0.924074 +anchor_right = 0.233333 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="VBoxContainer" type="VBoxContainer" parent="GUI/Bottom_left_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Next_turn_button" type="Button" parent="GUI/Bottom_left_panel/VBoxContainer"] +visible = false +margin_right = 447.0 +margin_bottom = 39.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +disabled = true +text = "Next turn" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="GUI/Bottom_left_panel/VBoxContainer"] +margin_right = 447.0 +margin_bottom = 82.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Turn_label" type="Label" parent="GUI/Bottom_left_panel/VBoxContainer/HBoxContainer"] +margin_right = 221.0 +margin_bottom = 82.0 +size_flags_horizontal = 3 +size_flags_vertical = 7 +text = "Turn:" +align = 2 +valign = 1 + +[node name="Turn_indicator" type="Label" parent="GUI/Bottom_left_panel/VBoxContainer/HBoxContainer"] +margin_left = 225.0 +margin_right = 447.0 +margin_bottom = 82.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "1" +valign = 1 + +[node name="Menu_panel" type="Control" parent="."] +visible = false +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -382.5 +margin_top = -186.0 +margin_right = 382.5 +margin_bottom = 186.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Background" type="ColorRect" parent="Menu_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.235294, 0.219608, 0.301961, 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Surrender_button" type="Button" parent="Menu_panel"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -112.5 +margin_top = -77.5851 +margin_right = 112.5 +margin_bottom = -23.5851 +text = "Surrender" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Close" type="Button" parent="Menu_panel"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -112.5 +margin_top = 35.5883 +margin_right = 112.5 +margin_bottom = 89.5883 +text = "Close" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Camera_base" type="Spatial" parent="."] +script = ExtResource( 2 ) + +[node name="Camera" type="Camera" parent="Camera_base"] +transform = Transform( 1, 0, 0, 0, 0.422618, 0.906308, 0, -0.906308, 0.422618, 12, 12, 12 ) + +[node name="Mouse_controller" type="Spatial" parent="."] +script = ExtResource( 4 ) +[connection signal="tree_exited" from="." to="." method="_on_Game_manager_tree_exited"] +[connection signal="pressed" from="End_game_panel/Back_to_lobby_button" to="." method="_on_Back_to_lobby_button_pressed"] +[connection signal="pressed" from="GUI/Bottom_left_panel/VBoxContainer/Next_turn_button" to="." method="_on_Next_turn_button_pressed"] +[connection signal="pressed" from="Menu_panel/Surrender_button" to="." method="_on_Surrender_button_pressed"] +[connection signal="pressed" from="Menu_panel/Close" to="." method="_on_Close_pressed"] diff --git a/Client/Scenes/Matchmaking/Game/Map/Hex.gd b/Client/Scenes/Matchmaking/Game/Map/Hex.gd new file mode 100644 index 0000000..624fb89 --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Map/Hex.gd @@ -0,0 +1,94 @@ +extends Spatial + +var _is_free +var _x +var _y + +var _neighbours + +var _map + +func _ready(): + _is_free = true + _map = get_node("/root/Game_manager/Map") + +func set_coordinates(x, y): + _x = x + _y = y + +func _on_Area_input_event(camera, event, click_position, click_normal, shape_idx): + if event is InputEventMouseButton: + if event.button_index == BUTTON_LEFT and event.pressed: + get_node("/root/Game_manager/Mouse_controller").left_click_on_hex(self) + + if event.button_index == BUTTON_RIGHT and event.pressed: + get_node("/root/Game_manager/Mouse_controller").right_click_on_hex(self) + +func set_color(color_id): + # TODO: make color better? + var material = SpatialMaterial.new() + material.albedo_color = Color(1, 0, 1) + $Cylinder.set_surface_material(0, material) + +func occupy_hex(): + _is_free = false + +func is_free(): + return _is_free + +func is_any_neighbour_free(): + var is_free = false + for neighbour in get_neighbours(): + if neighbour.is_free(): + is_free = true + continue + return is_free + +func get_neighbours(): + if _neighbours == null: + _neighbours = [] + + # left neighbour + if _x > 0: + _neighbours.append(_map.get_hex_at(_x - 1, _y)) + + # odd-row, starting below + ########## + if _y % 2 == 0: + # top left neighbour if(y%2) + if _x > 0 && _y < _map._map_height - 1: + _neighbours.append(_map.get_hex_at(_x - 1, _y + 1)) + + # top right neighbour if(y%2) + if _y < _map._map_height - 1: + _neighbours.append(_map.get_hex_at(_x, _y + 1)) + + # bottom right neighbour if(y%2) + if _y > 0: + _neighbours.append(_map.get_hex_at(_x, _y - 1)); + # bottom left neighbour if(y%2) + if _x > 0 && _y > 0: + _neighbours.append(_map.get_hex_at(_x - 1, _y - 1)); + ########## + else: + # top left neighbour + if _y < _map._map_height - 1: + _neighbours.append(_map.get_hex_at(_x, _y + 1)); + + # top right neighbour + if _x < _map._map_width - 1 && _y < _map._map_height - 1: + _neighbours.append(_map.get_hex_at(_x + 1, _y + 1)) + # bottom right neighbour + if _x < _map._map_width - 1 && _y > 0: + _neighbours.append(_map.get_hex_at(_x + 1, _y - 1)) + + # bottom left neighbour + if _y > 0: + _neighbours.append(_map.get_hex_at(_x, _y - 1)) + + ########## + ## right neighbour + if _x < _map._map_width - 1: + _neighbours.append(_map.get_hex_at(_x + 1, _y)) + + return _neighbours diff --git a/Client/Scenes/Matchmaking/Game/Map/Hex.tscn b/Client/Scenes/Matchmaking/Game/Map/Hex.tscn new file mode 100644 index 0000000..ab2bab5 --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Map/Hex.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://Material/hex.dae" type="PackedScene" id=1] +[ext_resource path="res://Scenes/Matchmaking/Game/Map/Hex.gd" type="Script" id=2] + +[sub_resource type="SpatialMaterial" id=1] +albedo_color = Color( 0, 0.27451, 1, 1 ) + +[sub_resource type="CylinderShape" id=2] +radius = 0.986306 + +[node name="Hex" instance=ExtResource( 1 )] +script = ExtResource( 2 ) + +[node name="Cylinder" parent="." index="0"] +material/0 = SubResource( 1 ) + +[node name="Area" type="Area" parent="Cylinder" index="0"] + +[node name="CollisionShape" type="CollisionShape" parent="Cylinder/Area" index="0"] +shape = SubResource( 2 ) +[connection signal="input_event" from="Cylinder/Area" to="." method="_on_Area_input_event"] diff --git a/Client/Scenes/Matchmaking/Game/Map/Map.gd b/Client/Scenes/Matchmaking/Game/Map/Map.gd new file mode 100644 index 0000000..231aedb --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Map/Map.gd @@ -0,0 +1,49 @@ +extends Spatial + +export var _map_width = 12 +export var _map_height = 8 + +var _width_offset = 2.0 +var _height_offset = 2.0 * 0.75 +var gap = 0.1 + +var _hexes = [] + +func _ready(): + add_gap_between_hexes() + generate_map() + +func calculate_world_position(grid_position): + var offset = 0 + + if int(grid_position.y) % 2 != 0: + offset = _width_offset / 2 + + var x = grid_position.x * _width_offset + offset + var z = grid_position.y * _height_offset + + return Vector3(x, 0, z) + +func add_gap_between_hexes(): + _width_offset += _width_offset * gap + _height_offset += _height_offset * gap + +func generate_map(): + for x in range(0, _map_width): + _hexes.append([]) + _hexes[x].resize(_map_height) + + for y in range(0, _map_height): + var hex_node = load("res://Scenes/Matchmaking/Game/Map/Hex.tscn").instance() + hex_node.set_coordinates(x, y) + + var position = (calculate_world_position(Vector2(x,y))) + + hex_node.name = "hex_%d_%d" % [x, y] + hex_node.translation = position + + add_child(hex_node) + _hexes[x][y] = hex_node + +func get_hex_at(x, y): + return _hexes[x][y] diff --git a/Client/Scenes/Matchmaking/Game/Map/Map.tscn b/Client/Scenes/Matchmaking/Game/Map/Map.tscn new file mode 100644 index 0000000..4ef98a7 --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Map/Map.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Game/Map/Map.gd" type="Script" id=1] + +[node name="Map" type="Spatial"] +script = ExtResource( 1 ) diff --git a/Client/Scenes/Matchmaking/Game/Mouse_controller/Mouse_controller.gd b/Client/Scenes/Matchmaking/Game/Mouse_controller/Mouse_controller.gd new file mode 100644 index 0000000..06e134d --- /dev/null +++ b/Client/Scenes/Matchmaking/Game/Mouse_controller/Mouse_controller.gd @@ -0,0 +1,25 @@ +extends Spatial + +var _game_manager + +func _ready(): + _game_manager = get_node("/root/Game_manager") + +func left_click_on_hex(hex_node): + if _game_manager.is_my_turn(): + + if _game_manager.ability_left(): + + if hex_node.is_free(): + + if _game_manager.get_previous_hex() != null: + print("try to occupy") + + if hex_node in _game_manager.get_previous_hex().get_neighbours(): + print("Yea") + _game_manager.try_to_occupy_hex(hex_node) + else: + _game_manager.try_to_occupy_hex(hex_node) + +func right_click_on_hex(hex_node): + print("Right click") diff --git a/Client/Scenes/Matchmaking/Game_room/Game_room.gd b/Client/Scenes/Matchmaking/Game_room/Game_room.gd new file mode 100644 index 0000000..7c6a752 --- /dev/null +++ b/Client/Scenes/Matchmaking/Game_room/Game_room.gd @@ -0,0 +1,66 @@ +extends Control + +func _ready(): + for player_id in NetworkingSync._open_games[Player.get_game_id()][3]: + if player_id != Player.get_player_id(): + rpc_id(player_id, "update_game_room_player_list") + + update_game_room_player_list() + +remote func update_game_room_player_list(): + NetworkingSync.send_open_games_request_to_server() + yield(NetworkingSync, "updated_games") + + for child in $Player_list/ScrollContainer/Player_list_container.get_children(): + child.queue_free() + + NetworkingSync._player_in_same_game_room_list = [] + + for player_id in NetworkingSync._open_games[Player.get_game_id()][3]: + add_player_entry_to_list(player_id) + +func add_player_entry_to_list(player_id): + var player = load("res://Scenes/Matchmaking/Game_room/Player_entry.tscn").instance() + var player_name = str(NetworkingSync._open_games[Player.get_game_id()][3][player_id][0]) + player.set_player_name(player_name) + $Player_list/ScrollContainer/Player_list_container.add_child(player) + var player_info = [player_id, player_name] + NetworkingSync._player_in_same_game_room_list.append(player_info) + +func _on_Game_room_tree_entered(): + if Player._is_host: + $Start_button.show() + $Ready_button.hide() + else: + $Start_button.hide() + $Ready_button.hide() # TODO: change this to .show(), if ready-feature is implemented. + +func _on_Start_button_pressed(): + NetworkingSync._players_ready = [] + NetworkingSync.close_game() + + if len(NetworkingSync._player_in_same_game_room_list) >= 2: + for player_id in NetworkingSync._player_in_same_game_room_list: + if player_id[0] != Player.get_player_id(): + rpc_id(player_id[0], "start_game") + start_game() + rpc_id(1, "remove_game_from_game_list", Player.get_game_id()) + +remote func start_game(): + get_tree().change_scene("res://Scenes/Matchmaking/Game/Game_manager.tscn") + +func _on_Leave_button_pressed(): + if Player.is_host(): + #TODO: kick everyone out of the game + NetworkingSync.close_game() + + else: + NetworkingSync.left_game() + yield(NetworkingSync, "updated_games") + for player in NetworkingSync._open_games[Player.get_game_id()][3]: + print(player) + if player != Player.get_player_id(): + rpc_id(player, "update_game_room_player_list") + + Player.set_game_id(0) + get_tree().change_scene("res://Scenes/Matchmaking/Lobby/Lobby.tscn") diff --git a/Client/Scenes/Matchmaking/Game_room/Game_room.tscn b/Client/Scenes/Matchmaking/Game_room/Game_room.tscn new file mode 100644 index 0000000..fce840d --- /dev/null +++ b/Client/Scenes/Matchmaking/Game_room/Game_room.tscn @@ -0,0 +1,88 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://Scenes/Matchmaking/Game_room/Game_room.gd" type="Script" id=2] + +[node name="Game_room" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Background" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 1 ) +expand = true +stretch_mode = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Start_button" type="Button" parent="."] +margin_left = 185.965 +margin_top = 324.728 +margin_right = 522.965 +margin_bottom = 502.728 +text = "Start" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Ready_button" type="Button" parent="."] +visible = false +margin_left = 185.965 +margin_top = 324.728 +margin_right = 522.965 +margin_bottom = 502.728 +text = "Ready" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Leave_button" type="Button" parent="."] +margin_left = 179.497 +margin_top = 615.335 +margin_right = 526.497 +margin_bottom = 810.335 +text = "Leave" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_list" type="Control" parent="."] +anchor_left = 0.314583 +anchor_top = 0.266667 +anchor_right = 0.939583 +anchor_bottom = 0.822222 +margin_left = -3.99939 +margin_top = 1.99963 +margin_right = -3.99939 +margin_bottom = 2.00024 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="ColorRect" type="ColorRect" parent="Player_list"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.282353, 0.0235294, 0.0235294, 0.823529 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ScrollContainer" type="ScrollContainer" parent="Player_list"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_list_container" type="VBoxContainer" parent="Player_list/ScrollContainer"] +margin_right = 1200.0 +size_flags_horizontal = 3 +[connection signal="tree_entered" from="." to="." method="_on_Game_room_tree_entered"] +[connection signal="pressed" from="Start_button" to="." method="_on_Start_button_pressed"] +[connection signal="pressed" from="Leave_button" to="." method="_on_Leave_button_pressed"] diff --git a/Client/Scenes/Matchmaking/Game_room/Player_entry.gd b/Client/Scenes/Matchmaking/Game_room/Player_entry.gd new file mode 100644 index 0000000..464b44d --- /dev/null +++ b/Client/Scenes/Matchmaking/Game_room/Player_entry.gd @@ -0,0 +1,4 @@ +extends HBoxContainer + +func set_player_name(player_name): + $Player_name_label.text = player_name diff --git a/Client/Scenes/Matchmaking/Game_room/Player_entry.tscn b/Client/Scenes/Matchmaking/Game_room/Player_entry.tscn new file mode 100644 index 0000000..c235384 --- /dev/null +++ b/Client/Scenes/Matchmaking/Game_room/Player_entry.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Game_room/Player_entry.gd" type="Script" id=1] + +[node name="Player_entry" type="HBoxContainer"] +margin_right = 800.0 +margin_bottom = 40.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Player_name_label" type="Label" parent="."] +margin_right = 800.0 +margin_bottom = 40.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Player 1" +valign = 1 diff --git a/Client/Scenes/Matchmaking/Lobby/Game_information.gd b/Client/Scenes/Matchmaking/Lobby/Game_information.gd new file mode 100644 index 0000000..be618f4 --- /dev/null +++ b/Client/Scenes/Matchmaking/Lobby/Game_information.gd @@ -0,0 +1,33 @@ +extends Node + +var _game_id +var _game_name +var _max_players +var _player_list + +func _init(game_id, game_name, max_players): + _game_id = game_id + _game_name = game_name + _max_players = max_players + _player_list = {} + +func get_parsable_game_information(): + return [_game_id, _game_name, _max_players, _player_list] + +func add_player_to_game(player): + _player_list.append(player) + +func remove_player_from_game(): + pass + +func set_game_id(game_id): + _game_id = game_id + +func set_game_name(game_name): + _game_name = game_name + +func set_max_players(max_players): + _max_players = max_players + +func is_full(): + return _max_players <= len(_player_list) diff --git a/Client/Scenes/Matchmaking/Lobby/Games_entry.gd b/Client/Scenes/Matchmaking/Lobby/Games_entry.gd new file mode 100644 index 0000000..47719b6 --- /dev/null +++ b/Client/Scenes/Matchmaking/Lobby/Games_entry.gd @@ -0,0 +1,28 @@ +extends Button + +var _game_name +var _max_players +var _game_id + +func set_game_id(game_id): + _game_id = game_id + +func set_game_name(game_name): + _game_name = game_name + +func set_max_players(max_players): + _max_players = max_players + +func update_gui(): + $HBoxContainer/Game_name.text = _game_name + $HBoxContainer/Number_of_player.text = str(len(NetworkingSync._open_games[_game_id][3])) + "/" + str(_max_players) + +func _on_Games_entry_pressed(): + NetworkingSync.send_open_games_request_to_server() + yield(NetworkingSync, "updated_games") + if _game_id in NetworkingSync._open_games and !is_full(): + NetworkingSync.join_game(_game_id) + +func is_full(): + var number_of_players = len(NetworkingSync._open_games[_game_id][3]) + return number_of_players >= _max_players diff --git a/Client/Scenes/Matchmaking/Lobby/Games_entry.tscn b/Client/Scenes/Matchmaking/Lobby/Games_entry.tscn new file mode 100644 index 0000000..cceb3d8 --- /dev/null +++ b/Client/Scenes/Matchmaking/Lobby/Games_entry.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Lobby/Games_entry.gd" type="Script" id=1] + +[node name="Games_entry" type="Button"] +margin_right = 661.0 +margin_bottom = 77.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Game_name" type="Label" parent="HBoxContainer"] +margin_right = 80.0 +margin_bottom = 77.0 +size_flags_vertical = 1 +text = "Game_name" +valign = 1 + +[node name="Number_of_player" type="Label" parent="HBoxContainer"] +margin_left = 84.0 +margin_right = 661.0 +margin_bottom = 77.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "2/2" +align = 2 +valign = 1 +[connection signal="pressed" from="." to="." method="_on_Games_entry_pressed"] diff --git a/Client/Scenes/Matchmaking/Lobby/Lobby.gd b/Client/Scenes/Matchmaking/Lobby/Lobby.gd new file mode 100644 index 0000000..9b6a9ec --- /dev/null +++ b/Client/Scenes/Matchmaking/Lobby/Lobby.gd @@ -0,0 +1,80 @@ +extends Control + +const MIN_PLAYERS = 2 +const MAX_PLAYERS = 8 +const MIN_GAME_NAME_LENGTH = 1 +const MAX_GAME_NAME_LENGTH = 20 + +func _on_Refresh_button_pressed(): + refresh_game_list() + +func refresh_game_list(): + NetworkingSync.send_open_games_request_to_server() + yield(NetworkingSync, "updated_games") + for child in $Lobby/Games_list/Open_games/VBoxContainer.get_children(): + child.queue_free() + + for game in NetworkingSync.get_open_games().values(): + add_entry_to_lobby(game[0], game[1], game[2]) + +func add_entry_to_lobby(game_id, game_name, max_players): + var new_game = load("res://Scenes/Matchmaking/Lobby/Games_entry.tscn").instance() + new_game.set_game_id(game_id) + new_game.set_game_name(game_name) + new_game.set_max_players(max_players) + new_game.name = "Game_entry_" + game_name + new_game.update_gui() + $Lobby/Games_list/Open_games/VBoxContainer.add_child(new_game) + +func _on_Create_game_button_pressed(): + $Lobby.hide() + $Lobby_game_creation_panel.show() + +func _on_Ok_button_pressed(): + create_game_room() + +func _on_Cancel_button_pressed(): + $Lobby_game_creation_panel.hide() + $Lobby.show() + +func _on_Exit_button_pressed(): + get_tree().change_scene("res://Scenes/Matchmaking/Menu/Menu.tscn") + +func _on_Lobby_controller_tree_entered(): + refresh_game_list() + +func _on_Game_name_line_edit_text_changed(new_text): + check_input_fields() + +func _on_Number_of_players_line_edit_text_changed(new_text): + check_input_fields() + +func is_number_of_players_text_field_ok(): + var result = false + var text_field = $Lobby_game_creation_panel/HBoxContainer2/Number_of_players_line_edit.text + if int(text_field) >= MIN_PLAYERS and int(text_field) <= MAX_PLAYERS: + result = true + return result + +func is_game_name_text_field_ok(): + var result = false + var text_field = $Lobby_game_creation_panel/HBoxContainer/Game_name_line_edit.text + if len(text_field) <= MAX_GAME_NAME_LENGTH and len(text_field) >= MIN_GAME_NAME_LENGTH: + result = true + return result + +func check_input_fields(): + if is_number_of_players_text_field_ok() and is_game_name_text_field_ok(): + $Lobby_game_creation_panel/Ok_button.disabled = false + else: + $Lobby_game_creation_panel/Ok_button.disabled = true + +func _input(ev): + if Input.is_key_pressed(KEY_ENTER) and not $Lobby_game_creation_panel/Ok_button.disabled: + create_game_room() + +func create_game_room(): + var game_name = $Lobby_game_creation_panel/HBoxContainer/Game_name_line_edit.text + var max_players = int($Lobby_game_creation_panel/HBoxContainer2/Number_of_players_line_edit.text) + var game_id = get_tree().get_network_unique_id() + NetworkingSync.create_game([game_id, game_name, max_players, {}], Player) diff --git a/Client/Scenes/Matchmaking/Lobby/Lobby.tscn b/Client/Scenes/Matchmaking/Lobby/Lobby.tscn new file mode 100644 index 0000000..99cefe5 --- /dev/null +++ b/Client/Scenes/Matchmaking/Lobby/Lobby.tscn @@ -0,0 +1,221 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Lobby/Lobby.gd" type="Script" id=1] +[ext_resource path="res://icon.png" type="Texture" id=2] + +[node name="Lobby_controller" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Lobby_background" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 2 ) +stretch_mode = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Lobby" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Games_list" type="Control" parent="Lobby"] +anchor_left = 0.31283 +anchor_top = 0.147956 +anchor_right = 0.965434 +anchor_bottom = 0.834067 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Background" type="ColorRect" parent="Lobby/Games_list"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.196078, 0.254902, 0.352941, 0.843137 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Open_games" type="ScrollContainer" parent="Lobby/Games_list"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="Lobby/Games_list/Open_games"] +margin_right = 1253.0 +size_flags_horizontal = 3 + +[node name="Lobby_buttons" type="Control" parent="Lobby"] +anchor_left = 0.0234375 +anchor_top = 0.407407 +anchor_right = 0.283854 +anchor_bottom = 0.796296 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Background" type="ColorRect" parent="Lobby/Lobby_buttons"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -3.05176e-05 +margin_bottom = -20.0 +color = Color( 0.196078, 0.254902, 0.352941, 0.843137 ) +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Create_game_button" type="Button" parent="Lobby/Lobby_buttons"] +margin_left = 20.0 +margin_top = 20.0 +margin_right = 480.0 +margin_bottom = 80.0 +text = "Create Game" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Search_game_button" type="Button" parent="Lobby/Lobby_buttons"] +margin_left = 20.0 +margin_top = 120.0 +margin_right = 480.0 +margin_bottom = 180.0 +disabled = true +text = "Search Game" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Refresh_button" type="Button" parent="Lobby/Lobby_buttons"] +margin_left = 20.0 +margin_top = 220.0 +margin_right = 480.0 +margin_bottom = 280.0 +text = "Refresh" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Exit_button" type="Button" parent="Lobby/Lobby_buttons"] +margin_left = 20.0 +margin_top = 320.0 +margin_right = 480.0 +margin_bottom = 380.0 +text = "Exit" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Auto_refresh_timer" type="Timer" parent="Lobby"] + +[node name="Lobby_game_creation_panel" type="Control" parent="."] +visible = false +anchor_left = 0.183854 +anchor_top = 0.200463 +anchor_right = 0.816146 +anchor_bottom = 0.799537 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Background" type="ColorRect" parent="Lobby_game_creation_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_top = 1.75809 +margin_bottom = 1.75806 +color = Color( 0.360784, 0.360784, 0.360784, 0.823529 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="Lobby_game_creation_panel"] +anchor_left = 0.0881384 +anchor_top = 0.0772798 +anchor_right = 0.911862 +anchor_bottom = 0.200927 +margin_bottom = -40.0 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Game_name_label" type="Label" parent="Lobby_game_creation_panel/HBoxContainer"] +margin_right = 78.0 +margin_bottom = 39.0 +size_flags_vertical = 3 +text = "Gamename:" +valign = 1 + +[node name="Game_name_line_edit" type="LineEdit" parent="Lobby_game_creation_panel/HBoxContainer"] +margin_left = 82.0 +margin_right = 1000.0 +margin_bottom = 39.0 +size_flags_horizontal = 3 + +[node name="HBoxContainer2" type="HBoxContainer" parent="Lobby_game_creation_panel"] +anchor_left = 0.0881384 +anchor_top = 0.278207 +anchor_right = 0.911862 +anchor_bottom = 0.401855 +margin_bottom = -40.0 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Max_player_label" type="Label" parent="Lobby_game_creation_panel/HBoxContainer2"] +margin_right = 80.0 +margin_bottom = 40.0 +size_flags_vertical = 3 +text = "Max Players:" +valign = 1 + +[node name="Number_of_players_line_edit" type="LineEdit" parent="Lobby_game_creation_panel/HBoxContainer2"] +margin_left = 84.0 +margin_right = 1000.0 +margin_bottom = 40.0 +size_flags_horizontal = 3 + +[node name="Ok_button" type="Button" parent="Lobby_game_creation_panel"] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -457.0 +margin_top = -247.0 +margin_right = -57.0 +margin_bottom = -147.0 +disabled = true +text = "Ok" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Cancel_button" type="Button" parent="Lobby_game_creation_panel"] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = 43.0001 +margin_top = -247.0 +margin_right = 443.0 +margin_bottom = -147.0 +text = "Cancel" +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="tree_entered" from="." to="." method="_on_Lobby_controller_tree_entered"] +[connection signal="pressed" from="Lobby/Lobby_buttons/Create_game_button" to="." method="_on_Create_game_button_pressed"] +[connection signal="pressed" from="Lobby/Lobby_buttons/Refresh_button" to="." method="_on_Refresh_button_pressed"] +[connection signal="pressed" from="Lobby/Lobby_buttons/Exit_button" to="." method="_on_Exit_button_pressed"] +[connection signal="text_changed" from="Lobby_game_creation_panel/HBoxContainer/Game_name_line_edit" to="." method="_on_Game_name_line_edit_text_changed"] +[connection signal="text_changed" from="Lobby_game_creation_panel/HBoxContainer2/Number_of_players_line_edit" to="." method="_on_Number_of_players_line_edit_text_changed"] +[connection signal="pressed" from="Lobby_game_creation_panel/Ok_button" to="." method="_on_Ok_button_pressed"] +[connection signal="pressed" from="Lobby_game_creation_panel/Cancel_button" to="." method="_on_Cancel_button_pressed"] diff --git a/Client/Scenes/Matchmaking/Menu/Menu.gd b/Client/Scenes/Matchmaking/Menu/Menu.gd new file mode 100644 index 0000000..93cfcf1 --- /dev/null +++ b/Client/Scenes/Matchmaking/Menu/Menu.gd @@ -0,0 +1,22 @@ +extends Node + +func _on_Button_pressed(): + connect_to_server() + + +func _on_LineEdit_text_changed(new_text): + if len(new_text) <= 0 or len(new_text) >= 20: + $GUI/Start_button.disabled = true + else: + $GUI/Start_button.disabled = false + +func _input(ev): + if Input.is_key_pressed(KEY_ENTER) and not $GUI/Start_button.disabled: + connect_to_server() + +func connect_to_server(): + Player.set_player_name($GUI/LineEdit.text) + get_tree().change_scene("res://Scenes/Matchmaking/Client/Network_connection.tscn") + +func _on_Exit_button_pressed(): + get_tree().quit() diff --git a/Client/Scenes/Matchmaking/Menu/Menu.tscn b/Client/Scenes/Matchmaking/Menu/Menu.tscn new file mode 100644 index 0000000..7aa9637 --- /dev/null +++ b/Client/Scenes/Matchmaking/Menu/Menu.tscn @@ -0,0 +1,59 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Menu/Menu.gd" type="Script" id=1] + +[node name="Menu" type="Node"] +script = ExtResource( 1 ) + +[node name="GUI" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Start_button" type="Button" parent="GUI"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -134.5 +margin_top = 91.7361 +margin_right = 134.5 +margin_bottom = 162.736 +disabled = true +text = "Connect to Server" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Exit_button" type="Button" parent="GUI"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -134.5 +margin_top = 193.832 +margin_right = 134.5 +margin_bottom = 264.832 +text = "Exit" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="LineEdit" type="LineEdit" parent="GUI"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -300.0 +margin_top = -15.0 +margin_right = 300.0 +margin_bottom = 15.0 +placeholder_text = "Playername..." +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="pressed" from="GUI/Start_button" to="." method="_on_Button_pressed"] +[connection signal="pressed" from="GUI/Exit_button" to="." method="_on_Exit_button_pressed"] +[connection signal="text_changed" from="GUI/LineEdit" to="." method="_on_LineEdit_text_changed"] diff --git a/Client/Scenes/Matchmaking/Networking/Networking_sync.gd b/Client/Scenes/Matchmaking/Networking/Networking_sync.gd new file mode 100644 index 0000000..bd53580 --- /dev/null +++ b/Client/Scenes/Matchmaking/Networking/Networking_sync.gd @@ -0,0 +1,53 @@ +extends Node + +signal updated_games +signal all_ready + +var _open_games = {} +var _player_in_same_game_room_list = [] +var _players_ready = [] + +func send_open_games_request_to_server(): + rpc_id(1, "get_open_games_from_server", get_tree().get_network_unique_id()) + +remote func update_open_games(open_games): + _open_games = open_games + emit_signal("updated_games") + +func get_open_games(): + return _open_games + +func create_game(game_information, host_player): + Player.set_game_id(host_player.get_player_id()) + Player.set_host(true) + rpc_id(1, "add_game_to_game_list", host_player.get_player_id(), game_information, host_player.get_parsable_player()) + yield(NetworkingSync, "updated_games") + get_tree().change_scene("res://Scenes/Matchmaking/Game_room/Game_room.tscn") + +func join_game(game_id): + Player.set_game_id(game_id) + Player.set_host(false) + rpc_id(1, "join_open_game", game_id, Player.get_parsable_player()) + get_tree().change_scene("res://Scenes/Matchmaking/Game_room/Game_room.tscn") + +func left_game(): + rpc_id(1, "remove_player_from_open_game", Player.get_game_id(), Player.get_player_id()) + send_open_games_request_to_server() + +func _on_Server_is_reachable_timeout(): + print("Server is reachable.") + # TODO: check if connection still exists. + +func close_game(): + rpc_id(1, "remove_game_from_game_list", Player.get_game_id()) + +func send_ready_signal(): + if Player.is_host(): + send_host_ready_signal(Player.get_player_id()) + else: + rpc_id(Player.get_game_id(), "send_host_ready_signal", Player.get_player_id()) + +remote func send_host_ready_signal(id): + _players_ready.append(id) + if len(_players_ready) == len(_player_in_same_game_room_list): + emit_signal("all_ready") diff --git a/Client/Scenes/Matchmaking/Networking/Networking_sync.tscn b/Client/Scenes/Matchmaking/Networking/Networking_sync.tscn new file mode 100644 index 0000000..7c50e90 --- /dev/null +++ b/Client/Scenes/Matchmaking/Networking/Networking_sync.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Networking/Networking_sync.gd" type="Script" id=1] + +[node name="Networking" type="Node"] +script = ExtResource( 1 ) + +[node name="Server_is_reachable_timer" type="Timer" parent="."] +[connection signal="timeout" from="Server_is_reachable_timer" to="." method="_on_Server_is_reachable_timeout"] diff --git a/Client/Scenes/Matchmaking/Player/Player.gd b/Client/Scenes/Matchmaking/Player/Player.gd new file mode 100644 index 0000000..1b10eb5 --- /dev/null +++ b/Client/Scenes/Matchmaking/Player/Player.gd @@ -0,0 +1,33 @@ +extends Node + +var _player_id +var _player_name +var _game_id +var _is_host + +func set_player_name(player_name): + _player_name = player_name + +func set_player_id(player_id): + _player_id = player_id + +func set_host(is_host): + _is_host = is_host + +func is_host(): + return _is_host + +func get_player_name(): + return _player_name + +func get_player_id(): + return _player_id + +func set_game_id(game_id): + _game_id = game_id + +func get_game_id(): + return _game_id + +func get_parsable_player(): + return [_player_name, _player_id, _game_id, _is_host] diff --git a/Client/Scenes/Matchmaking/Player/Player.tscn b/Client/Scenes/Matchmaking/Player/Player.tscn new file mode 100644 index 0000000..78e22c3 --- /dev/null +++ b/Client/Scenes/Matchmaking/Player/Player.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Player/Player.gd" type="Script" id=1] + +[node name="Player" type="Node"] +script = ExtResource( 1 ) diff --git a/Client/export_presets.cfg b/Client/export_presets.cfg new file mode 100644 index 0000000..9f97791 --- /dev/null +++ b/Client/export_presets.cfg @@ -0,0 +1,67 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../Godot_Executables/Client.x86_64" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/64_bits=true +binary_format/embed_pck=false +custom_template/release="" +custom_template/debug="" + +[preset.1] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../Godot_Executables/Client.exe" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.1.options] + +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/64_bits=true +binary_format/embed_pck=false +custom_template/release="" +custom_template/debug="" +codesign/enable=false +codesign/identity="" +codesign/password="" +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PoolStringArray( ) +application/icon="" +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" diff --git a/Client/icon.png b/Client/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/Client/icon.png differ diff --git a/Client/icon.png.import b/Client/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/Client/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Client/project.godot b/Client/project.godot new file mode 100644 index 0000000..8521a07 --- /dev/null +++ b/Client/project.godot @@ -0,0 +1,30 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="Client_project" +run/main_scene="res://Scenes/Matchmaking/Menu/Menu.tscn" +config/icon="res://icon.png" + +[autoload] + +Player="*res://Scenes/Matchmaking/Player/Player.tscn" +NetworkingSync="*res://Scenes/Matchmaking/Networking/Networking_sync.tscn" + +[display] + +window/size/width=1920 +window/size/height=1080 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3112fca --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 twille00 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Server/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/Server/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..7b61c3e --- /dev/null +++ b/Server/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="47313fa4c47a9963fddd764e1ec6e4a8" +dest_md5="2ded9e7f9060e2b530aab678b135fc5b" + diff --git a/Server/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex b/Server/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex new file mode 100644 index 0000000..3ca6461 Binary files /dev/null and b/Server/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex differ diff --git a/Server/Scenes/Matchmaking/Networking/Networking_sync.gd b/Server/Scenes/Matchmaking/Networking/Networking_sync.gd new file mode 100644 index 0000000..3fbe61d --- /dev/null +++ b/Server/Scenes/Matchmaking/Networking/Networking_sync.gd @@ -0,0 +1,26 @@ +extends Node +# {game_id:[_game_id, _game_name, _max_players, _player_list]} # player_list is a dict +# {game_id:[_game_id, _game_name, _max_players, {player_id:[_player_name, _player_id, _game_id, _is_host]}]} +var _open_games = {} + +var _players_online = [] + +remote func get_open_games_from_server(id): + rpc_id(id, "update_open_games", _open_games) + +remote func add_game_to_game_list(game_id, game_information, host_player): + _open_games[game_id] = game_information + add_player_to_open_game(game_id, host_player) + get_open_games_from_server(game_id) + +remote func join_open_game(game_id, player_information): + add_player_to_open_game(game_id, player_information) + +func add_player_to_open_game(game_id, player_information): + _open_games[game_id][3][player_information[1]] = player_information + +remote func remove_player_from_open_game(game_id, player_id): + _open_games[game_id][3].erase(player_id) + +remote func remove_game_from_game_list(game_id): + _open_games.erase(game_id) diff --git a/Server/Scenes/Matchmaking/Networking/Networking_sync.tscn b/Server/Scenes/Matchmaking/Networking/Networking_sync.tscn new file mode 100644 index 0000000..dd79554 --- /dev/null +++ b/Server/Scenes/Matchmaking/Networking/Networking_sync.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Networking/Networking_sync.gd" type="Script" id=1] + +[node name="Networking" type="Node"] +script = ExtResource( 1 ) diff --git a/Server/Scenes/Matchmaking/Server/Server.gd b/Server/Scenes/Matchmaking/Server/Server.gd new file mode 100644 index 0000000..5ae7128 --- /dev/null +++ b/Server/Scenes/Matchmaking/Server/Server.gd @@ -0,0 +1,32 @@ +extends Node + +const SERVER_PORT = 14600 +const MAX_PLAYERS = 1000 + +func _ready(): + get_tree().connect("network_peer_connected", self, "_player_connected") + get_tree().connect("network_peer_disconnected", self, "_player_disconnected") + start_server() + +func start_server(): + print("Try to start the server.") + var peer = NetworkedMultiplayerENet.new() + var result = peer.create_server(SERVER_PORT, MAX_PLAYERS) + + if result != OK: + print("Failed creating the server.") + return + else: + print("Created the server.") + + get_tree().set_network_peer(peer) + +func _player_connected(id): + print(str(id) + " connected to server.") + NetworkingSync._players_online.append(id) + +func _player_disconnected(id): + print(str(id) + " left the game.") + NetworkingSync._players_online.erase(id) + if id in NetworkingSync._open_games: + NetworkingSync.remove_game_from_game_list(id) diff --git a/Server/Scenes/Matchmaking/Server/Server.tscn b/Server/Scenes/Matchmaking/Server/Server.tscn new file mode 100644 index 0000000..8eacacc --- /dev/null +++ b/Server/Scenes/Matchmaking/Server/Server.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Matchmaking/Server/Server.gd" type="Script" id=1] + +[node name="Server" type="Node"] +script = ExtResource( 1 ) diff --git a/Server/export_presets.cfg b/Server/export_presets.cfg new file mode 100644 index 0000000..b242810 --- /dev/null +++ b/Server/export_presets.cfg @@ -0,0 +1,67 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../Godot_Executables/Server.x86_64" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/64_bits=true +binary_format/embed_pck=false +custom_template/release="" +custom_template/debug="" + +[preset.1] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.1.options] + +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/64_bits=true +binary_format/embed_pck=false +custom_template/release="" +custom_template/debug="" +codesign/enable=false +codesign/identity="" +codesign/password="" +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PoolStringArray( ) +application/icon="" +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" diff --git a/Server/icon.png b/Server/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/Server/icon.png differ diff --git a/Server/icon.png.import b/Server/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/Server/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Server/project.godot b/Server/project.godot new file mode 100644 index 0000000..20cea07 --- /dev/null +++ b/Server/project.godot @@ -0,0 +1,24 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="Server_project" +run/main_scene="res://Scenes/Matchmaking/Server/Server.tscn" +config/icon="res://icon.png" + +[autoload] + +NetworkingSync="*res://Scenes/Matchmaking/Networking/Networking_sync.tscn"