Feat/10 adding multiplayer fundamentals #14

Merged
Dotts merged 16 commits from feat/10-adding-multiplayer-fundamentals into main 2026-06-06 19:31:25 -07:00
6 changed files with 90 additions and 17 deletions
Showing only changes of commit acfb8bca16 - Show all commits
+3
View File
@@ -51,3 +51,6 @@ user_settings/
*LF* *LF*
tags tags
*.log *.log
Papaya-Shooter.pck
Papaya-Shooter.exe
Papaya-Shooter.console.exe
-17
View File
@@ -1,17 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://player_base"]
[ext_resource type="Script" path="res://movement/player_movement_controller.gd" id="1"]
[node name="PlayerBase" type="CharacterBody3D"]
[node name="PlayerMovementController" type="Node" parent="."]
script = ExtResource("1")
[node name="MovementStateMachine" type="Node" parent="PlayerMovementController"]
[node name="Camera3D" type="Camera3D" parent="PlayerMovementController"]
[node name="CapsuleShape3D" type="CollisionShape3D" parent="."]
shape = CapsuleShape3D.new()
shape.radius = 0.4
shape.height = 1.8
+71
View File
@@ -0,0 +1,71 @@
[preset.0]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="./Papaya-Shooter.exe"
patches=PackedStringArray()
patch_delta_encoding=false
patch_delta_compression_level_zstd=19
patch_delta_min_reduction=0.1
patch_delta_include_filters="*"
patch_delta_exclude_filters=""
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=2
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
shader_baker/enabled=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon="uid://cxxfrs5ov5vay"
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
application/export_d3d12=0
application/d3d12_agility_sdk_multiarch=true
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
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}'"
+12
View File
@@ -140,6 +140,18 @@ func register_player(username: String) -> void:
rpc_id(sender_id, "rpc_load_level", current_scene_path) rpc_id(sender_id, "rpc_load_level", current_scene_path)
rpc_id(sender_id, "sync_match_state", match_active, match_time_remaining, current_gamemode) rpc_id(sender_id, "sync_match_state", match_active, match_time_remaining, current_gamemode)
@rpc("any_peer", "call_local", "reliable")
func update_username(new_name: String) -> void:
if multiplayer.is_server() or not multiplayer.has_multiplayer_peer() or multiplayer.multiplayer_peer is OfflineMultiplayerPeer:
var sender_id = multiplayer.get_remote_sender_id()
if sender_id == 0:
sender_id = 1
if player_stats.has(sender_id):
player_stats[sender_id]["username"] = new_name
stats_updated.emit()
if multiplayer.has_multiplayer_peer() and not multiplayer.multiplayer_peer is OfflineMultiplayerPeer:
rpc("sync_player_stats", player_stats)
@rpc("authority", "call_local", "reliable") @rpc("authority", "call_local", "reliable")
func sync_player_stats(stats: Dictionary) -> void: func sync_player_stats(stats: Dictionary) -> void:
player_stats = stats player_stats = stats
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

+4
View File
@@ -271,6 +271,10 @@ func _build_ui() -> void:
user_save.pressed.connect(func(): user_save.pressed.connect(func():
SettingsManager.username = user_input.text SettingsManager.username = user_input.text
SettingsManager._save_settings() SettingsManager._save_settings()
if NetworkManager.multiplayer.has_multiplayer_peer() and not NetworkManager.multiplayer.multiplayer_peer is OfflineMultiplayerPeer:
NetworkManager.update_username.rpc_id(1, user_input.text)
else:
NetworkManager.update_username(user_input.text)
) )
user_hbox.add_child(user_save) user_hbox.add_child(user_save)