Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer synchronization of (sub-)resource properties only outputs errors #86075

Open
romlok opened this issue Dec 12, 2023 · 2 comments
Open

Comments

@romlok
Copy link
Contributor

romlok commented Dec 12, 2023

Tested versions

MRP tested with:

First noticed on:

  • v4.2.0 via Steam

System information

Godot v4.2.1.stable - Debian GNU/Linux trixie/sid trixie - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1060 (nvidia) - Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 Threads)

Issue description

Configuring a MultiplayerSynchronizer to sync eg. .:transform.x will cause the server to constantly output errors when a client joins.

If the sync mode is set to "Always", one gets two errors repeated forever:

E 0:00:18:0222   get_state: Property '.:transform.x' not found.
  <C++ Error>    Condition "!valid" is true. Returning: ERR_INVALID_DATA
  <C++ Source>   modules/multiplayer/multiplayer_synchronizer.cpp:167 @ get_state()
E 0:00:18:0222   _send_sync: Unable to retrieve sync state.
  <C++ Error>    Condition "err != OK" is true. Continuing.
  <C++ Source>   modules/multiplayer/scene_replication_interface.cpp:829 @ _send_sync()

Or if the sync mode is set to "On change", then only the first ("Property ... not found") is output forever. (The second error may occur if the value changes, I haven't tested)

AIUI this should be possible since #79479, as mentioned in the 4.2 announcement, and I was keen to use this in my current project, but maybe I'm missing or not misunderstanding something?

Steps to reproduce

  1. Create 2D scene
  2. Add MultiplayerSynchronizer (the root path should default to .. -> the base Node2D)

Screenshot_20231212_143326

  1. Add replication property from the path :transform.x

Screenshot_20231212_143429

  1. Add simple local networking and buttons to host/join
extends Node2D

func _on_host_button_pressed() -> void:
	var peer := ENetMultiplayerPeer.new()
	peer.create_server(13337)
	multiplayer.multiplayer_peer = peer
	$Networking.hide()

func _on_join_btton_pressed() -> void:
	var peer := ENetMultiplayerPeer.new()
	peer.create_client("localhost", 13337)
	multiplayer.multiplayer_peer = peer
	$Networking.hide()
  1. Start two instances
  2. Host in one instance, join in the second
  3. ⚠️ Errors!

Screenshot_20231212_143710

Minimal reproduction project (MRP)

A single scene which should demonstrate: sync-sub-properties_scene.zip

@Faless
Copy link
Collaborator

Faless commented Dec 17, 2023

It appears the correct syntax accepted by get/set_indexed is .:transform:x (i.e. using : as sub-property separator, and not .).

I assume this has always been the case (or someone would have reported a broken get/set_indexed), and I made a mistake in my PR example.

@Faless
Copy link
Collaborator

Faless commented Dec 17, 2023

I think from a usability prospective, it could be nice to have the editor plugin replace . with : for the property part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants