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

Typed Arrays don't seem to work correctly with MultiplayerSynchronizer #74391

Closed
MrBlockers opened this issue Mar 4, 2023 · 3 comments · Fixed by #78219
Closed

Typed Arrays don't seem to work correctly with MultiplayerSynchronizer #74391

MrBlockers opened this issue Mar 4, 2023 · 3 comments · Fixed by #78219

Comments

@MrBlockers
Copy link
Contributor

MrBlockers commented Mar 4, 2023

Godot version

4.0 stable

System information

Windows 10, NVidia RTX 3080, Vulkan

Issue description

While working on a project where I wanted to sync an Array of Vector2i for setting up a tilemap, I discovered typed arrays don't seem to play nice with MultiplayerSynchronizer, neither Spawn or Sync mode. In particular, I am testing when a scene with a child synchronizer (syncing the exported array) is replicated by a MultiplayerSpawner. The workaround I found there was to use an Array instead of Array[Vector2i].

Another issue in this same reproduction project is that the automatically generated names for instanced scenes can cause path errors and prevent the scene from replicating to clients. I think this is related to #68508, maybe a configuration issue but I am running into this in my other project as well. If its not a config issue & different enough I can create a separate issue to capture it.

Steps to reproduce

  1. Run 2 instances of the project
  2. Click Host on one
  3. Click Connect on the other
  4. Click "Spawn Test Label" on host, which will instantiate a simple label scene

Note that it fails to correctly create the scene on clients when the 'array' property of spawn_label.gd is a typed array, but works fine when typed as a standard Array

Bonus issue:
5. Comment control.gd:43
6. Try steps 1-4 above and see error generated in console related to get_node

Minimal reproduction project

SyncTypedArray.zip

@PaulMag
Copy link

PaulMag commented Jul 6, 2023

I have the same problem. I have an Array that refused to synchronize with MultiplayerSynchronizer, and I know I had it working earlier. Thought I was going insane. After reading your issue I tried changing its type from Array[int] to Array. And then it worked perfectly.

At some point I added static typing to all my variables to make my code less error prone, and that apparently broke the synchronizer. Ironic. :)

@dalexeev
Copy link
Member

dalexeev commented Sep 5, 2023

@MrBlockers
Copy link
Contributor Author

Finally got a chance to check this out, this does appear to be fixed by #78219!

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

Successfully merging a pull request may close this issue.

5 participants