Remove old and unused project settings, update various demos for 4.2 (#1024)

- Move all demo projects that don't require Forward+/Mobile-only features
  to the Compatibility rendering method. This improves performance significantly
  on low-end devices and ensures visuals are identical to a web export
  of the demo.
- Set deadzone on all inputs to 0.2 for better gamepad usability.
- Remove reliance on `default_env.tres` to use built-in Environment
  resources in the main scene instead (which follows the preview environment
  workflow).
- Remove notices pointing to GDNative or VisualScript, since both were
  removed in 4.0.
- Various bug fixes and usability tweaks to 10+ demos.
This commit is contained in:
Hugo Locurcio
2024-03-26 18:01:58 +01:00
committed by GitHub
parent 82913393a8
commit 31d1c0c112
266 changed files with 1619 additions and 1829 deletions

View File

@@ -2,6 +2,6 @@
These demos showcase networking and/or multiplayer features.
Languages: All have GDScript, WebRTC uses some GDNative
Languages: All have GDScript, WebRTC uses some GDExtension
Renderer: All are GLES 2
Renderer: All are Compatibility

View File

@@ -1,12 +1,12 @@
# Multiplayer Bomber
A multiplayer implementation of the classical bomberman game.
One of the players should press "host", while the other
should type in his address and press "play".
A multiplayer implementation of the classic bomberman game.
One of the players should press **Host**, while other player(s)
should type in the host's IP address and press **Join**.
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/139

View File

@@ -33,12 +33,13 @@ size_flags_vertical = 2
[node name="Label" type="Label" parent="Players"]
layout_mode = 0
offset_left = 26.0
offset_top = 18.0
offset_right = 142.0
offset_bottom = 32.0
offset_top = 7.0
offset_right = 229.0
offset_bottom = 30.0
size_flags_horizontal = 2
size_flags_vertical = 0
text = "Awaiting Players..."
horizontal_alignment = 1
[node name="Start" type="Button" parent="Players"]
layout_mode = 0
@@ -72,10 +73,10 @@ is forwarded on your router."
[node name="FindPublicIP" type="LinkButton" parent="Players"]
layout_mode = 0
offset_left = 168.0
offset_top = 393.5
offset_right = 341.0
offset_bottom = 407.5
offset_left = 200.0
offset_top = 409.5
offset_right = 408.0
offset_bottom = 432.5
text = "Find your public IP address"
[node name="Connect" type="Panel" parent="."]
@@ -107,9 +108,9 @@ text = "Name:"
[node name="Name" type="LineEdit" parent="Connect"]
layout_mode = 0
offset_left = 17.0
offset_top = 30.0
offset_top = 38.0
offset_right = 173.0
offset_bottom = 54.0
offset_bottom = 69.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "The Warrior"
@@ -117,9 +118,9 @@ text = "The Warrior"
[node name="IPLabel" type="Label" parent="Connect"]
layout_mode = 0
offset_left = 15.0
offset_top = 66.0
offset_top = 74.0
offset_right = 57.0
offset_bottom = 80.0
offset_bottom = 97.0
size_flags_horizontal = 2
size_flags_vertical = 0
theme_override_font_sizes/font_size = 16
@@ -128,9 +129,9 @@ text = "IP:"
[node name="IPAddress" type="LineEdit" parent="Connect"]
layout_mode = 0
offset_left = 17.0
offset_top = 85.0
offset_top = 102.0
offset_right = 173.0
offset_bottom = 109.0
offset_bottom = 133.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "127.0.0.1"
@@ -138,9 +139,9 @@ text = "127.0.0.1"
[node name="Host" type="Button" parent="Connect"]
layout_mode = 0
offset_left = 181.0
offset_top = 31.0
offset_top = 38.0
offset_right = 246.0
offset_bottom = 51.0
offset_bottom = 69.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "Host"
@@ -148,9 +149,9 @@ text = "Host"
[node name="Join" type="Button" parent="Connect"]
layout_mode = 0
offset_left = 181.0
offset_top = 87.0
offset_top = 102.0
offset_right = 246.0
offset_bottom = 107.0
offset_bottom = 133.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "Join"
@@ -158,9 +159,9 @@ text = "Join"
[node name="ErrorLabel" type="Label" parent="Connect"]
layout_mode = 0
offset_left = 15.0
offset_top = 125.0
offset_top = 138.0
offset_right = 257.0
offset_bottom = 139.0
offset_bottom = 161.0
size_flags_horizontal = 2
size_flags_vertical = 0
theme_override_colors/font_color = Color(0.820312, 0.291595, 0.291595, 1)

View File

@@ -11,9 +11,9 @@ config_version=5
[application]
config/name="Multiplayer Bomber"
config/description="A multiplayer implementation of the classical bomberman game.
One of the players should press 'host', while the other
should type in his address and press 'play'."
config/description="A multiplayer implementation of the classic bomberman game.
One of the players should press \"Host\", while the other
should type in his address and press \"Play\"."
config/tags=PackedStringArray("2d", "demo", "network", "official")
run/main_scene="res://lobby.tscn"
config/features=PackedStringArray("4.2")
@@ -31,46 +31,51 @@ window/stretch/aspect="expand"
[input]
move_down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":16777234,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":16777231,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":113,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":68,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":16777233,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
]
}
move_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":16777232,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":119,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
set_bomb={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
[replication]
config={

View File

@@ -1,11 +1,12 @@
# Pong Multiplayer
A multiplayer demo of Pong. One player presses "host".
The other presses "join". This only works locally.
A multiplayer implementation of the classic pong game.
One of the players should press **Host**, while the other
should type in the host's IP address and press **Join**.
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Note: The non-multiplayer version is available [here](https://github.com/godotengine/godot-demo-projects/tree/master/2d/pong).

View File

@@ -19,21 +19,38 @@ size_flags_horizontal = 2
size_flags_vertical = 2
[node name="Title" type="Label" parent="."]
layout_mode = 0
offset_left = 210.0
offset_top = 40.0
offset_right = 430.0
offset_bottom = 80.0
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -110.0
offset_top = -156.0
offset_right = 110.0
offset_bottom = -116.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 2
size_flags_vertical = 0
theme_override_font_sizes/font_size = 32
text = "Multiplayer Pong"
horizontal_alignment = 1
vertical_alignment = 1
[node name="LobbyPanel" type="Panel" parent="."]
layout_mode = 0
offset_left = 210.0
offset_top = 160.0
offset_right = 430.0
offset_bottom = 270.0
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -110.0
offset_top = -73.0
offset_right = 110.0
offset_bottom = 73.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 2
size_flags_vertical = 2
script = ExtResource("1")
@@ -41,19 +58,19 @@ script = ExtResource("1")
[node name="AddressLabel" type="Label" parent="LobbyPanel"]
layout_mode = 0
offset_left = 10.0
offset_top = 10.0
offset_right = 62.0
offset_bottom = 24.0
offset_top = 6.0
offset_right = 77.0
offset_bottom = 29.0
size_flags_horizontal = 2
size_flags_vertical = 0
text = "Address"
text = "Address:"
[node name="Address" type="LineEdit" parent="LobbyPanel"]
layout_mode = 0
offset_left = 10.0
offset_top = 30.0
offset_top = 37.0
offset_right = 210.0
offset_bottom = 54.0
offset_bottom = 68.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "127.0.0.1"
@@ -61,9 +78,9 @@ text = "127.0.0.1"
[node name="HostButton" type="Button" parent="LobbyPanel"]
layout_mode = 0
offset_left = 10.0
offset_top = 60.0
offset_top = 76.0
offset_right = 90.0
offset_bottom = 80.0
offset_bottom = 107.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "Host"
@@ -71,9 +88,9 @@ text = "Host"
[node name="JoinButton" type="Button" parent="LobbyPanel"]
layout_mode = 0
offset_left = 130.0
offset_top = 60.0
offset_top = 76.0
offset_right = 210.0
offset_bottom = 80.0
offset_bottom = 107.0
size_flags_horizontal = 2
size_flags_vertical = 2
text = "Join"
@@ -81,39 +98,56 @@ text = "Join"
[node name="StatusOk" type="Label" parent="LobbyPanel"]
layout_mode = 0
offset_left = 10.0
offset_top = 90.0
offset_top = 114.0
offset_right = 210.0
offset_bottom = 104.0
offset_bottom = 137.0
size_flags_horizontal = 2
size_flags_vertical = 0
horizontal_alignment = 1
[node name="StatusFail" type="Label" parent="LobbyPanel"]
modulate = Color(1, 0.427451, 0.345098, 1)
layout_mode = 0
offset_left = 10.0
offset_top = 90.0
offset_top = 114.0
offset_right = 210.0
offset_bottom = 104.0
offset_bottom = 137.0
size_flags_horizontal = 2
size_flags_vertical = 0
horizontal_alignment = 1
[node name="PortForward" type="Label" parent="LobbyPanel"]
visible = false
layout_mode = 0
offset_left = -128.0
offset_top = 136.0
offset_right = 124.0
offset_bottom = 184.0
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -278.0
offset_top = 91.0
offset_right = 25.0
offset_bottom = 166.0
grow_horizontal = 2
grow_vertical = 2
text = "If you want non-LAN clients to connect,
make sure the port 8910 in UDP
is forwarded checked your router."
is forwarded on your router."
[node name="FindPublicIP" type="LinkButton" parent="LobbyPanel"]
visible = false
layout_mode = 0
offset_left = 155.0
offset_top = 152.0
offset_right = 328.0
offset_bottom = 166.0
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 61.0
offset_top = 118.0
offset_right = 269.0
offset_bottom = 141.0
grow_horizontal = 2
grow_vertical = 2
text = "Find your public IP address"
[connection signal="pressed" from="LobbyPanel/HostButton" to="LobbyPanel" method="_on_host_pressed"]

View File

@@ -11,9 +11,9 @@ config_version=5
[application]
config/name="Pong Multiplayer"
config/description="A multiplayer demo of the classical pong game.
One of the players should press 'host', while the
other should select the address and press 'join'."
config/description="A multiplayer demo of the classic pong game.
One of the players should press \"Host\", while the
other should select the address and press \"Join\"."
config/tags=PackedStringArray("2d", "demo", "network", "official")
run/main_scene="res://lobby.tscn"
config/features=PackedStringArray("4.2")
@@ -29,7 +29,7 @@ window/stretch/aspect="expand"
[input]
move_down={
"deadzone": 0.5,
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":16777234,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
@@ -38,7 +38,7 @@ move_down={
]
}
move_up={
"deadzone": 0.5,
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":16777232,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
@@ -46,3 +46,8 @@ move_up={
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -4,6 +4,6 @@ This is a minimal sample of using WebRTC connections to connect two peers to eac
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/536

View File

@@ -17,12 +17,9 @@ grow_horizontal = 2
grow_vertical = 2
[node name="LinkButton" type="LinkButton" parent="CenterContainer"]
modulate = Color(1, 0.921569, 0.152941, 1)
layout_mode = 2
offset_left = 245.0
offset_top = 312.0
offset_right = 906.0
offset_bottom = 335.0
text = "Make sure to download the GDNative WebRTC Plugin and place it in the project folder"
text = "Make sure to download the GDExtension WebRTC Plugin and place it in the project folder"
script = ExtResource("3")
[connection signal="pressed" from="CenterContainer/LinkButton" to="CenterContainer/LinkButton" method="_on_LinkButton_pressed"]

View File

@@ -24,3 +24,8 @@ Signaling="*res://Signaling.gd"
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -8,11 +8,11 @@ This demo is devided in 4 parts:
- Itself divided into raw protocol and `WebRTCMultiplayer` handling.
- The `demo` contains a small app that uses it.
**NOTE**: You must extract the [latest version](https://github.com/godotengine/webrtc-native/releases) of the WebRTC GDNative plugin in the project folder to run from desktop.
**NOTE**: You must extract the [latest version](https://github.com/godotengine/webrtc-native/releases) of the WebRTC GDExtension plugin in the project folder to run from desktop.
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/537

View File

@@ -13,78 +13,57 @@ anchor_bottom = 0.983333
script = ExtResource("1")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchors_preset = 15
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Signaling" type="HBoxContainer" parent="VBoxContainer"]
offset_right = 1120.0
offset_bottom = 31.0
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/Signaling"]
offset_top = 2.0
offset_right = 127.0
offset_bottom = 28.0
layout_mode = 2
text = "Signaling server:"
[node name="Port" type="SpinBox" parent="VBoxContainer/Signaling"]
offset_left = 131.0
offset_right = 214.0
offset_bottom = 31.0
layout_mode = 2
min_value = 1025.0
max_value = 65535.0
value = 9080.0
[node name="ListenButton" type="Button" parent="VBoxContainer/Signaling"]
offset_left = 218.0
offset_right = 273.0
offset_bottom = 31.0
layout_mode = 2
toggle_mode = true
text = "Listen"
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Signaling"]
offset_left = 277.0
offset_right = 1120.0
offset_bottom = 31.0
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="LinkButton" type="LinkButton" parent="VBoxContainer/Signaling/CenterContainer"]
offset_left = 91.0
offset_top = 4.0
offset_right = 752.0
offset_bottom = 27.0
text = "Make sure to download the GDNative WebRTC Plugin and place it in the project folder"
modulate = Color(1, 0.956863, 0.207843, 1)
layout_mode = 2
text = "Make sure to download the GDExtension WebRTC Plugin and place it in the project folder"
[node name="Clients" type="GridContainer" parent="VBoxContainer"]
offset_top = 35.0
offset_right = 1120.0
offset_bottom = 626.0
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
[node name="ClientUI" parent="VBoxContainer/Clients" instance=ExtResource("2")]
offset_right = 558.0
offset_bottom = 294.0
layout_mode = 2
[node name="ClientUI2" parent="VBoxContainer/Clients" instance=ExtResource("2")]
offset_left = 562.0
offset_right = 1120.0
offset_bottom = 294.0
layout_mode = 2
[node name="ClientUI3" parent="VBoxContainer/Clients" instance=ExtResource("2")]
offset_top = 298.0
offset_right = 558.0
offset_bottom = 591.0
layout_mode = 2
[node name="ClientUI4" parent="VBoxContainer/Clients" instance=ExtResource("2")]
offset_left = 562.0
offset_top = 298.0
offset_right = 1120.0
offset_bottom = 591.0
layout_mode = 2
[node name="Server" type="Node" parent="."]
script = ExtResource("3")

View File

@@ -29,6 +29,7 @@ gdscript/warnings/unused_argument=false
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[network]
[rendering]
modules/webrtc_gdnative_script="res://demo/webrtc/webrtc.gdns"
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -4,7 +4,7 @@ This is a demo of a simple chat implemented using WebSockets, showing both how t
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/538

View File

@@ -16,3 +16,13 @@ config/tags=PackedStringArray("demo", "network", "official")
run/main_scene="res://combo.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.webp"
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -1,9 +1,9 @@
# WebSocket Minimal
This is a minimal sample of connecting two peers to each other using websockets.
This is a minimal sample of connecting two peers to each other using WebSockets.
Language: GDScript
Renderer: Forward+
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/539

View File

@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="WebSocket Minimal Demo"
config/description="This is a minimal sample of connecting two peers to each other using websockets."
config/description="This is a minimal sample of connecting two peers to each other using WebSockets."
config/tags=PackedStringArray("demo", "network", "official")
run/main_scene="res://Main.tscn"
config/features=PackedStringArray("4.2")
@@ -20,9 +20,10 @@ config/features=PackedStringArray("4.2")
window/size/viewport_width=600
window/size/viewport_height=300
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -4,7 +4,7 @@ This is a sample showing how the use WebSockets along with the Multiplayer API i
Language: GDScript
Renderer: GLES 2
Renderer: Compatibility
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/540

View File

@@ -17,8 +17,12 @@ run/main_scene="res://scene/combo.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.webp"
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

View File

@@ -23,44 +23,12 @@ columns = 2
[node name="Main" parent="GridContainer" instance=ExtResource("2_reiiv")]
layout_mode = 2
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_right = 574.0
offset_bottom = 322.0
grow_horizontal = 1
grow_vertical = 1
[node name="Main2" parent="GridContainer" instance=ExtResource("2_reiiv")]
layout_mode = 2
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 578.0
offset_right = 1152.0
offset_bottom = 322.0
grow_horizontal = 1
grow_vertical = 1
[node name="Main3" parent="GridContainer" instance=ExtResource("2_reiiv")]
layout_mode = 2
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 326.0
offset_right = 574.0
offset_bottom = 648.0
grow_horizontal = 1
grow_vertical = 1
[node name="Main4" parent="GridContainer" instance=ExtResource("2_reiiv")]
layout_mode = 2
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_left = 578.0
offset_top = 326.0
offset_right = 1152.0
offset_bottom = 648.0
grow_horizontal = 1
grow_vertical = 1

View File

@@ -16,18 +16,18 @@ func _log(what):
@rpc("any_peer")
func set_player_name(name):
func set_player_name(p_name):
if not is_multiplayer_authority():
return
var sender = multiplayer.get_remote_sender_id()
update_player_name.rpc(sender, name)
update_player_name.rpc(sender, p_name)
@rpc("call_local")
func update_player_name(player, name):
func update_player_name(player, p_name):
var pos = _players.find(player)
if pos != -1:
_list.set_item_text(pos, name)
_list.set_item_text(pos, p_name)
@rpc("any_peer")

View File

@@ -30,7 +30,7 @@ func _ready():
if OS.has_environment("USERNAME"):
_name_edit.text = OS.get_environment("USERNAME")
else:
var desktop_path = OS.get_system_dir(0).replace("\\", "/").split("/")
var desktop_path = OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP).replace("\\", "/").split("/")
_name_edit.text = desktop_path[desktop_path.size() - 2]