Skip to content

Commit

Permalink
feat: add networking demos (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Srynetix authored Apr 20, 2024
1 parent 07b777b commit 6d4cdeb
Show file tree
Hide file tree
Showing 19 changed files with 687 additions and 193 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/.import
/.godot
/.godot
/.vscode
/exports
!/exports/.gdignore
2 changes: 1 addition & 1 deletion addons/sxgd
Submodule sxgd updated 93 files
+0 −27 .github/workflows/doc.yml
+1 −1 LICENSE
+0 −1 README.md
+0 −2 doc/.gitignore
+0 −161 doc/class.xsd
+0 −29 doc/classes_xml/SxArray.xml
+0 −95 doc/classes_xml/SxAudioStreamPlayer.xml
+0 −34 doc/classes_xml/SxBuffer.xml
+0 −59 doc/classes_xml/SxCVars.xml
+0 −53 doc/classes_xml/SxClientPeer.xml
+0 −97 doc/classes_xml/SxClientRpc.xml
+0 −36 doc/classes_xml/SxCmdLineParser.xml
+0 −82 doc/classes_xml/SxColor.xml
+0 −71 doc/classes_xml/SxContainer.xml
+0 −23 doc/classes_xml/SxDebugConsole.xml
+0 −63 doc/classes_xml/SxDebugTools.xml
+0 −32 doc/classes_xml/SxDoubleTap.xml
+0 −28 doc/classes_xml/SxFaButton.xml
+0 −33 doc/classes_xml/SxFaFont.xml
+0 −23 doc/classes_xml/SxFaLabel.xml
+0 −19 doc/classes_xml/SxFadingRichTextEffect.xml
+0 −65 doc/classes_xml/SxFadingRichTextLabel.xml
+0 −29 doc/classes_xml/SxFullScreenAcceptDialog.xml
+0 −31 doc/classes_xml/SxFullScreenConfirmationDialog.xml
+0 −39 doc/classes_xml/SxFullScreenDialog.xml
+0 −77 doc/classes_xml/SxFullScreenFileDialog.xml
+0 −19 doc/classes_xml/SxFxBetterBlur.xml
+0 −67 doc/classes_xml/SxFxCamera.xml
+0 −22 doc/classes_xml/SxFxChromaticAberration.xml
+0 −25 doc/classes_xml/SxFxDissolve.xml
+0 −19 doc/classes_xml/SxFxGrayscale.xml
+0 −22 doc/classes_xml/SxFxMotionBlur.xml
+0 −42 doc/classes_xml/SxFxShockwave.xml
+0 −30 doc/classes_xml/SxFxVignette.xml
+0 −238 doc/classes_xml/SxGameData.xml
+0 −36 doc/classes_xml/SxInput.xml
+0 −19 doc/classes_xml/SxItemList.xml
+0 −63 doc/classes_xml/SxJson.xml
+0 −44 doc/classes_xml/SxListenServerPeer.xml
+0 −126 doc/classes_xml/SxLoadCache.xml
+0 −289 doc/classes_xml/SxLog.xml
+0 −79 doc/classes_xml/SxMath.xml
+0 −61 doc/classes_xml/SxMusicPlayer.xml
+0 −166 doc/classes_xml/SxNetwork.xml
+0 −40 doc/classes_xml/SxNode.xml
+0 −50 doc/classes_xml/SxNodeTracer.xml
+0 −97 doc/classes_xml/SxOs.xml
+0 −79 doc/classes_xml/SxRand.xml
+0 −33 doc/classes_xml/SxRpcService.xml
+0 −34 doc/classes_xml/SxSceneRunner.xml
+0 −103 doc/classes_xml/SxSceneTransitioner.xml
+0 −135 doc/classes_xml/SxServerPeer.xml
+0 −44 doc/classes_xml/SxServerRpc.xml
+0 −45 doc/classes_xml/SxShader.xml
+0 −45 doc/classes_xml/SxSyncBarrier.xml
+0 −69 doc/classes_xml/SxSyncInput.xml
+0 −87 doc/classes_xml/SxSyncPeerInput.xml
+0 −40 doc/classes_xml/SxText.xml
+0 −125 doc/classes_xml/SxTileMap.xml
+0 −27 doc/classes_xml/SxUi.xml
+0 −27 doc/classes_xml/SxVirtualButton.xml
+0 −33 doc/classes_xml/SxVirtualControls.xml
+0 −45 doc/classes_xml/SxVirtualJoystick.xml
+0 −214 doc/index.adoc
+0 −588 doc/tools/build_xml_adoc.py
+1 −4 extensions/SxLog.gd
+18 −0 extensions/SxMath.gd
+0 −60 extensions/SxNetwork.gd
+1 −6 modules/SxSceneRunner/SxSceneRunner.gd
+36 −10 nodes/3d/SxDecal/SxDecal.gd
+3 −1 nodes/3d/SxDecal/SxDecal.gdshader
+3 −1 nodes/3d/SxDecal/SxDecalController.gd
+49 −26 nodes/3d/fps/SxFPSController.gd
+3 −0 nodes/3d/fps/SxFPSWeapon.gd
+13 −0 nodes/debug/SxDebugTools/SxDebugTools.gd
+5 −3 nodes/fx/SxGPUParticles3D.gd
+15 −16 nodes/fx/screen-effects/SxFxDissolve/SxFxDissolve.gd
+187 −0 nodes/net/README.md
+38 −0 nodes/net/SxNetClientHandler.gd
+104 −0 nodes/net/SxNetClientPeer.gd
+67 −0 nodes/net/SxNetPeerProtocol.gd
+30 −0 nodes/net/SxNetServerHandler.gd
+90 −0 nodes/net/SxNetServerPeer.gd
+0 −113 nodes/networking/SxClientPeer.gd
+0 −101 nodes/networking/SxClientRpc.gd
+0 −47 nodes/networking/SxListenServerPeer.gd
+0 −27 nodes/networking/SxRpcService.gd
+0 −220 nodes/networking/SxServerPeer.gd
+0 −57 nodes/networking/SxServerRpc.gd
+0 −58 nodes/networking/SxSyncBarrier.gd
+0 −80 nodes/networking/SxSyncInput.gd
+0 −90 nodes/networking/SxSyncPeerInput.gd
+13 −0 nodes/utils/SxSceneTransitioner.gd
5 changes: 5 additions & 0 deletions autoloads/GameAutoload.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends Node

func _ready() -> void:
SxDebugTools.setup_global_instance(get_tree())
SxSceneTransitioner.setup_global_instance(get_tree())
17 changes: 0 additions & 17 deletions autoloads/GameCVars.gd

This file was deleted.

1 change: 0 additions & 1 deletion autoloads/GameDebugTools.gd

This file was deleted.

1 change: 0 additions & 1 deletion autoloads/GameSceneTransitioner.gd

This file was deleted.

1 change: 0 additions & 1 deletion autoloads/MainRpcService.gd

This file was deleted.

11 changes: 4 additions & 7 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,24 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
export_path="exports/sxgd kitchen sink.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""

[preset.0.options]

custom_template/debug=""
custom_template/release=""
debug/export_console_script=1
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
Expand All @@ -46,6 +42,7 @@ application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
Expand All @@ -63,6 +60,7 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"
debug/export_console_script=1

[preset.1]

Expand All @@ -79,7 +77,6 @@ encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""

[preset.1.options]

Expand Down
50 changes: 50 additions & 0 deletions kitchen-sink/TestMultiplayer1Dummy.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
extends MarginContainer

@onready var _host_button := %HostButton as Button
@onready var _join_client1_button := %JoinClient1Button as Button
@onready var _join_client2_button := %JoinClient2Button as Button
@onready var _show_logs := %ShowLogs as Button
@onready var _show_tree := %ShowTree as Button


func _ready() -> void:
_host_button.pressed.connect(func():
var server := SxNetServerPeer.new()
server.port = 12340
server.max_clients = 16
add_child(server)

_host_button.disabled = true
)

_join_client1_button.pressed.connect(func():
var client := SxNetClientPeer.new()
client.name = "Client1"
client.server_address = "localhost"
client.server_port = 12340
add_child(client)

_join_client1_button.disabled = true
)

_join_client2_button.pressed.connect(func():
var client := SxNetClientPeer.new()
client.name = "Client2"
client.server_address = "localhost"
client.server_port = 12340
add_child(client)

_join_client2_button.disabled = true
)

_show_logs.pressed.connect(func():
var instance := SxDebugTools.get_global_instance(get_tree())
instance.show_tools()
instance.show_specific_panel(SxDebugTools.PanelType.LOG)
)

_show_tree.pressed.connect(func():
var instance := SxDebugTools.get_global_instance(get_tree())
instance.show_tools()
instance.show_specific_panel(SxDebugTools.PanelType.SCENE_TREE_DUMP)
)
56 changes: 56 additions & 0 deletions kitchen-sink/TestMultiplayer1Dummy.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[gd_scene load_steps=2 format=3 uid="uid://clph1uerknhev"]

[ext_resource type="Script" path="res://kitchen-sink/TestMultiplayer1Dummy.gd" id="1_o3lgk"]

[node name="TestMultiplayer1Dummy" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_right = 5
theme_override_constants/margin_bottom = 5
script = ExtResource("1_o3lgk")

[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2

[node name="Label" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Dummy Multiplayer Test
Press \"Host\" to start a server
Press \"Join (Client 1)\" to start the first client
Press \"Join (Client 2)\" to start the second client
Press \"Show logs\" to display the SxDebugTools Log panel.
Press \"Show scene tree\" to display the SxDebugTools Scene Tree panel.
"
horizontal_alignment = 1
vertical_alignment = 1

[node name="HostButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Host"

[node name="JoinClient1Button" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Join (Client 1)"

[node name="JoinClient2Button" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Join (Client 2)"

[node name="ShowLogs" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Show logs"

[node name="ShowTree" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Show scene tree"
Loading

0 comments on commit 6d4cdeb

Please sign in to comment.