Skip to content

Commit

Permalink
Updating networking example to Godot 4 Alpha 9.
Browse files Browse the repository at this point in the history
There are some typo's in configuration settings, so I expect this to break in Alpha 10 :(
  • Loading branch information
MitchMakesThings committed Jun 5, 2022
1 parent d39099f commit 32549e3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 24 deletions.
20 changes: 8 additions & 12 deletions Networking/Explained/Multiplayer/Characters/Aliens/Player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ colors = PackedColorArray(0, 0.278431, 0.486275, 1, 0, 0.576471, 1, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_cduq7"]
gradient = SubResource( "Gradient_168qg" )

[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_t66em"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_34p3j"]
properties/0/path = NodePath(":sync_position")
properties/0/spawn = true
properties/0/sync = true
properties/1/path = NodePath(":sync_is_jumping")
properties/1/spawn = false
properties/1/path = NodePath(":sync_velocity")
properties/1/spawn = true
properties/1/sync = true
properties/2/path = NodePath(":sync_velocity")
properties/2/spawn = false
properties/2/path = NodePath(":sync_is_jumping")
properties/2/spawn = true
properties/2/sync = true

[node name="Player" type="CharacterBody2D"]
Expand Down Expand Up @@ -67,22 +67,18 @@ offset_left = -56.0
offset_top = -29.0
offset_right = -16.0
offset_bottom = 11.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="TextureProgressBar" type="TextureProgressBar" parent="UI"]
offset_right = 15.0
offset_bottom = 66.0
value = 100.0
texture_under = SubResource( "GradientTexture1D_lsl6q" )
texture_progress = SubResource( "GradientTexture1D_cduq7" )
fill_mode = 3
nine_patch_stretch = true
texture_under = SubResource( "GradientTexture1D_lsl6q" )
texture_progress = SubResource( "GradientTexture1D_cduq7" )

[node name="Networking" type="Node" parent="."]
script = ExtResource( "4_h5uv8" )

[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="Networking"]
root_path = NodePath("..")
resource = SubResource( "SceneReplicationConfig_t66em" )
congiruation = SubResource( "SceneReplicationConfig_34p3j" )
5 changes: 2 additions & 3 deletions Networking/Explained/Multiplayer/Items/blue_button.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8apkt"]
size = Vector2(64, 61)

[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ja6x7"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ntf3m"]
properties/0/path = NodePath(":isPressed")
properties/0/spawn = true
properties/0/sync = true
Expand All @@ -27,8 +27,7 @@ position = Vector2(0, -29)
shape = SubResource( "RectangleShape2D_8apkt" )

[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_interval = 0.5
resource = SubResource( "SceneReplicationConfig_ja6x7" )
congiruation = SubResource( "SceneReplicationConfig_ntf3m" )

[connection signal="body_entered" from="." to="." method="_on_blue_button_body_entered"]
5 changes: 2 additions & 3 deletions Networking/Explained/Multiplayer/System/game_state.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="Script" path="res://System/game_state.gd" id="1_g0bil"]

[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_4l240"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_bylt0"]
properties/0/path = NodePath(":button_press_count")
properties/0/spawn = true
properties/0/sync = true
Expand All @@ -11,6 +11,5 @@ properties/0/sync = true
script = ExtResource( "1_g0bil" )

[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath("..")
replication_interval = 1.0
resource = SubResource( "SceneReplicationConfig_4l240" )
congiruation = SubResource( "SceneReplicationConfig_bylt0" )
2 changes: 1 addition & 1 deletion Networking/Explained/Multiplayer/System/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func start_network(server: bool) -> void:
peer.create_server(4242)
print('server listening on localhost 4242')
else:
peer.create_client("networking-explained.mitchmakesthings.online", 4242)
peer.create_client("localhost", 4242)

multiplayer.set_multiplayer_peer(peer)

Expand Down
5 changes: 2 additions & 3 deletions Networking/Explained/Multiplayer/System/main.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://cruxxhpoyibub"]
[gd_scene load_steps=4 format=3 uid="uid://cruxxhpoyibub"]

[ext_resource type="Script" path="res://System/main.gd" id="1_n31dg"]
[ext_resource type="PackedScene" uid="uid://scjoku8kmkqj" path="res://Characters/Aliens/Player.tscn" id="2_tebs4"]
[ext_resource type="PackedScene" uid="uid://dhvi1o1ili7f" path="res://Maps/TestMap.tscn" id="3_uwrpn"]
[ext_resource type="Script" path="res://System/UI.gd" id="4_kv3lk"]

Expand All @@ -14,7 +13,7 @@ script = ExtResource( "1_n31dg" )
position = Vector2(325, 0)

[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
replication = [ExtResource( "2_tebs4" )]
_spawnable_scenes = PackedStringArray("res://Characters/Aliens/Player.tscn")
spawn_path = NodePath("../Players")
auto_spawn = true

Expand Down
2 changes: 1 addition & 1 deletion Networking/Explained/run-client.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"C:\Users\Mitch\Documents\godot\Alpha3\Godot_v4.0-alpha3_win64.exe" --path .\Multiplayer\
"C:\Users\Mitch\Documents\godot\Godot_v4.0-alpha9_win64.exe\Godot_v4.0-alpha9_win64.exe" --path .\Multiplayer\ --client
2 changes: 1 addition & 1 deletion Networking/Explained/run-server.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"C:\Users\Mitch\Documents\godot\Godot_v4.0-alpha4_win64.exe\Godot_v4.0-alpha4_win64.exe" --path .\Multiplayer\ --server
"C:\Users\Mitch\Documents\godot\Godot_v4.0-alpha9_win64.exe\Godot_v4.0-alpha9_win64.exe" --path .\Multiplayer\ --server

0 comments on commit 32549e3

Please sign in to comment.