diff --git a/Client/.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.md5 b/Client/.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.md5 new file mode 100644 index 0000000..a86962e --- /dev/null +++ b/Client/.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.md5 @@ -0,0 +1,3 @@ +source_md5="e127b8d3decb280181240c615e8cf87b" +dest_md5="1e9d1cf2df0ac5c1c7d726acf465bd1e" + diff --git a/Client/.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.stex b/Client/.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.stex new file mode 100644 index 0000000..4728ef8 Binary files /dev/null and b/Client/.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.stex differ diff --git a/Client/.import/nature-2609647_1920.jpg-325062f8bab6a30b80009f28beff7f36.md5 b/Client/.import/nature-2609647_1920.jpg-325062f8bab6a30b80009f28beff7f36.md5 new file mode 100644 index 0000000..a86962e --- /dev/null +++ b/Client/.import/nature-2609647_1920.jpg-325062f8bab6a30b80009f28beff7f36.md5 @@ -0,0 +1,3 @@ +source_md5="e127b8d3decb280181240c615e8cf87b" +dest_md5="1e9d1cf2df0ac5c1c7d726acf465bd1e" + diff --git a/Client/.import/nature-2609647_1920.jpg-325062f8bab6a30b80009f28beff7f36.stex b/Client/.import/nature-2609647_1920.jpg-325062f8bab6a30b80009f28beff7f36.stex new file mode 100644 index 0000000..4728ef8 Binary files /dev/null and b/Client/.import/nature-2609647_1920.jpg-325062f8bab6a30b80009f28beff7f36.stex differ diff --git a/Client/.import/nature-2609647_1920.jpg-41da3c7e7abd1fbdb02c0accd389ec03.md5 b/Client/.import/nature-2609647_1920.jpg-41da3c7e7abd1fbdb02c0accd389ec03.md5 new file mode 100644 index 0000000..a86962e --- /dev/null +++ b/Client/.import/nature-2609647_1920.jpg-41da3c7e7abd1fbdb02c0accd389ec03.md5 @@ -0,0 +1,3 @@ +source_md5="e127b8d3decb280181240c615e8cf87b" +dest_md5="1e9d1cf2df0ac5c1c7d726acf465bd1e" + diff --git a/Client/.import/nature-2609647_1920.jpg-41da3c7e7abd1fbdb02c0accd389ec03.stex b/Client/.import/nature-2609647_1920.jpg-41da3c7e7abd1fbdb02c0accd389ec03.stex new file mode 100644 index 0000000..4728ef8 Binary files /dev/null and b/Client/.import/nature-2609647_1920.jpg-41da3c7e7abd1fbdb02c0accd389ec03.stex differ diff --git a/Client/Material/background.jpg b/Client/Material/background.jpg new file mode 100644 index 0000000..a91e991 Binary files /dev/null and b/Client/Material/background.jpg differ diff --git a/Client/Material/background.jpg.import b/Client/Material/background.jpg.import new file mode 100644 index 0000000..751e428 --- /dev/null +++ b/Client/Material/background.jpg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Material/background.jpg" +dest_files=[ "res://.import/background.jpg-3fd0dc8cec44f299d0635e3f8c73732e.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/Scenes/Matchmaking/Client/Network_connection.gd b/Client/Scenes/Matchmaking/Client/Network_connection.gd index 4a0a1f2..a943852 100644 --- a/Client/Scenes/Matchmaking/Client/Network_connection.gd +++ b/Client/Scenes/Matchmaking/Client/Network_connection.gd @@ -1,6 +1,6 @@ extends Node -const SERVER_IP = "willipink.eu" +const SERVER_IP = "127.0.0.1" const SERVER_PORT = 14600 onready var _start_button = get_node("Start_button") @@ -17,8 +17,9 @@ func initialize_connection(): _start_button.text = "Connecting..." func connect_to_server(): - var peer = NetworkedMultiplayerENet.new() - peer.create_client(SERVER_IP, SERVER_PORT) + get_tree().connect("connected_to_server", self, "_connected_to_server") + var peer = WebSocketClient.new() + peer.connect_to_url("ws://" + SERVER_IP + ":" + str(SERVER_PORT), PoolStringArray(), true) get_tree().set_network_peer(peer) func _connected_ok(): diff --git a/Client/Scenes/Matchmaking/Game/Game_manager.gd b/Client/Scenes/Matchmaking/Game/Game_manager.gd index 7c98989..2ac868d 100644 --- a/Client/Scenes/Matchmaking/Game/Game_manager.gd +++ b/Client/Scenes/Matchmaking/Game/Game_manager.gd @@ -2,6 +2,8 @@ extends Spatial var _current_player_index +var _color_codes = [] + var _turn_number var _round_counter = 0 @@ -171,3 +173,12 @@ func _input(event): func _on_Close_pressed(): $Menu_panel.visible = false + +func _on_Blocker_power_up_pressed(): + #TODO: + # select 3 hexes, which will be blocked (make invisible?) + pass # Replace with function body. + +func _on_Reuse_Power_up_pressed(): + # TODO: you can click on hexes, which are already filled + pass # Replace with function body. diff --git a/Client/Scenes/Matchmaking/Game/Game_manager.tscn b/Client/Scenes/Matchmaking/Game/Game_manager.tscn index 617332f..0c269e5 100644 --- a/Client/Scenes/Matchmaking/Game/Game_manager.tscn +++ b/Client/Scenes/Matchmaking/Game/Game_manager.tscn @@ -66,10 +66,10 @@ __meta__ = { } [node name="Player_info" type="Control" parent="GUI"] -margin_left = 1650.14 -margin_top = 68.4775 -margin_right = 1910.14 -margin_bottom = 283.477 +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -260.0 +margin_bottom = 215.0 __meta__ = { "_edit_use_anchors_": false } @@ -98,7 +98,7 @@ 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 +margin_bottom = 215.0 size_flags_horizontal = 3 size_flags_vertical = 3 __meta__ = { @@ -186,11 +186,12 @@ __meta__ = { } [node name="Bottom_left_panel" type="Control" parent="GUI"] -anchor_top = 0.924074 -anchor_right = 0.233333 +anchor_top = 1.0 anchor_bottom = 1.0 +margin_top = -79.9999 +margin_right = 420.0 __meta__ = { -"_edit_use_anchors_": true +"_edit_use_anchors_": false } [node name="VBoxContainer" type="VBoxContainer" parent="GUI/Bottom_left_panel"] @@ -215,14 +216,14 @@ __meta__ = { } [node name="HBoxContainer" type="HBoxContainer" parent="GUI/Bottom_left_panel/VBoxContainer"] -margin_right = 447.0 -margin_bottom = 82.0 +margin_right = 420.0 +margin_bottom = 79.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 +margin_right = 208.0 +margin_bottom = 79.0 size_flags_horizontal = 3 size_flags_vertical = 7 text = "Turn:" @@ -230,14 +231,63 @@ 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 +margin_left = 212.0 +margin_right = 420.0 +margin_bottom = 79.0 size_flags_horizontal = 3 size_flags_vertical = 3 text = "1" valign = 1 +[node name="Bottom_right_panel2" type="Control" parent="GUI"] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -420.0 +margin_top = -79.9999 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="GUI/Bottom_right_panel2"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="GUI/Bottom_right_panel2/VBoxContainer"] +margin_right = 420.0 +margin_bottom = 79.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Blocker_power_up" type="Button" parent="GUI/Bottom_right_panel2/VBoxContainer/HBoxContainer"] +margin_right = 208.0 +margin_bottom = 79.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Blocker" + +[node name="Reuse_Power_up" type="Button" parent="GUI/Bottom_right_panel2/VBoxContainer/HBoxContainer"] +margin_left = 212.0 +margin_right = 420.0 +margin_bottom = 79.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Reuse Hexes" + +[node name="Power_up_3" type="Button" parent="GUI/Bottom_right_panel2/VBoxContainer/HBoxContainer"] +visible = false +margin_left = 282.0 +margin_right = 420.0 +margin_bottom = 79.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + [node name="Menu_panel" type="Control" parent="."] visible = false anchor_left = 0.5 @@ -299,5 +349,7 @@ 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="GUI/Bottom_right_panel2/VBoxContainer/HBoxContainer/Blocker_power_up" to="." method="_on_Blocker_power_up_pressed"] +[connection signal="pressed" from="GUI/Bottom_right_panel2/VBoxContainer/HBoxContainer/Reuse_Power_up" to="." method="_on_Reuse_Power_up_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 index 624fb89..90a52c9 100644 --- a/Client/Scenes/Matchmaking/Game/Map/Hex.gd +++ b/Client/Scenes/Matchmaking/Game/Map/Hex.gd @@ -11,6 +11,9 @@ var _map func _ready(): _is_free = true _map = get_node("/root/Game_manager/Map") + var material = SpatialMaterial.new() + material.albedo_color = Color(1, 0.41, 0.71) + $Cylinder.set_surface_material(0, material) func set_coordinates(x, y): _x = x @@ -25,9 +28,31 @@ func _on_Area_input_event(camera, event, click_position, click_normal, shape_idx 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) + if color_id == 0: + material.albedo_color = Color(0, 0, 0) + + if color_id == 1: + material.albedo_color = Color(0, 0, 1) + + if color_id == 2: + material.albedo_color = Color(0, 1, 0) + + if color_id == 3: + material.albedo_color = Color(0, 1, 1) + + if color_id == 4: + material.albedo_color = Color(1, 0, 0) + + if color_id == 5: + material.albedo_color = Color(1, 0, 1) + + if color_id == 6: + material.albedo_color = Color(1, 1, 0) + + if color_id == 7: + material.albedo_color = Color(1, 1, 1) + $Cylinder.set_surface_material(0, material) func occupy_hex(): diff --git a/Client/Scenes/Matchmaking/Game_room/Game_room.gd b/Client/Scenes/Matchmaking/Game_room/Game_room.gd index bceadf3..6597575 100644 --- a/Client/Scenes/Matchmaking/Game_room/Game_room.gd +++ b/Client/Scenes/Matchmaking/Game_room/Game_room.gd @@ -39,7 +39,7 @@ func _on_Start_button_pressed(): NetworkingSync._players_ready = [] NetworkingSync.close_game() - if len(NetworkingSync._player_in_same_game_room_list) >= 2: + if len(NetworkingSync._player_in_same_game_room_list) >= 1: #TODO change to 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") diff --git a/Client/export_presets.cfg b/Client/export_presets.cfg index 2b02758..6bf66df 100644 --- a/Client/export_presets.cfg +++ b/Client/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Godot_Executables/Client_linux/Client.x86_64" +export_path="../../../../Executables/hexagon_linux.x86_64" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -33,7 +33,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Godot_Executables/Client_windows/Client.exe" +export_path="../../../../Executables/hexagon_win10.exe" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -75,7 +75,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Godot_Executables/Client_web/Client_project.html" +export_path="../../../../Executables/Hexagon_web_rtc/hexagon.html" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -98,7 +98,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Godot_Executables/Client_mac/Client.zip" +export_path="../../../../Executables/hexagon_macOS.zip" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" diff --git a/Client/project.godot b/Client/project.godot index 8521a07..28fa8f7 100644 --- a/Client/project.godot +++ b/Client/project.godot @@ -15,7 +15,7 @@ _global_script_class_icons={ [application] -config/name="Client_project" +config/name="Hexagon_webRTC_client" run/main_scene="res://Scenes/Matchmaking/Menu/Menu.tscn" config/icon="res://icon.png" diff --git a/Server/Scenes/Matchmaking/Server/Server.gd b/Server/Scenes/Matchmaking/Server/Server.gd index 140fd99..783603f 100644 --- a/Server/Scenes/Matchmaking/Server/Server.gd +++ b/Server/Scenes/Matchmaking/Server/Server.gd @@ -9,9 +9,11 @@ func _ready(): start_server() func start_server(): - print("Try to start the server.") - var peer = NetworkedMultiplayerENet.new() - var result = peer.create_server(SERVER_PORT, MAX_PLAYERS) + var peer = WebSocketServer.new() + var result = peer.listen(SERVER_PORT, PoolStringArray(), true) + get_tree().connect("server_disconnected", self, "_close_network") + get_tree().set_network_peer(peer) + print("Server started.") if result != OK: print("Failed creating the server.") diff --git a/Server/export_presets.cfg b/Server/export_presets.cfg index d4770cf..085ba47 100644 --- a/Server/export_presets.cfg +++ b/Server/export_presets.cfg @@ -7,7 +7,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Godot_Executables/Server_linux/Server.x86_64" +export_path="../../../../Executables/hexagon_linux_server.x86_64" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -65,3 +65,26 @@ application/product_name="" application/file_description="" application/copyright="" application/trademarks="" + +[preset.2] + +name="HTML5" +platform="HTML5" +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.2.options] + +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/custom_html_shell="" +html/head_include="" +custom_template/release="" +custom_template/debug="" diff --git a/Server/project.godot b/Server/project.godot index 20cea07..e6a2891 100644 --- a/Server/project.godot +++ b/Server/project.godot @@ -15,7 +15,7 @@ _global_script_class_icons={ [application] -config/name="Server_project" +config/name="Hexagon_webRTC_server" run/main_scene="res://Scenes/Matchmaking/Server/Server.tscn" config/icon="res://icon.png"