#Creating Local Multiplayer Lobby with a lot of synchorized data

1 messages · Page 1 of 1 (latest)

naive adder
#

I've been working on a project that is multiplayer. While trying to make the lobby i encountered issues in synchronizing player datas when joining.

the host joins succesfully, the clients too but they the host does not see them, and all clients can him but can't see other clients.

You need to see my code for more context really.

wet holly
naive adder
#

i will send it to you

wet holly
celest gobletBOT
#
Embedding code in discord messages
Inline Code

When you surround some words with single backticks like `this`, it will be formatted as code.

Code Blocks

You can also include code blocks by surrounding the code with three backticks. If you add "swift" then you will also get basic syntax highlighting:
```swift
print("hello world")
```
Discord will then show it as a code block like this:

print("hello world")
Upload

If your code snippet is rather long, you can upload it to a text paste site. One option that supports syntax highlighting for GDScript is https://bpa.st/

naive adder
#

i've made some changes since i posted this post

#

and the issue changed to clients are not spawning

#

players are represented as a Resource and as a Dictionary

#

this approach tries to make the clients get the players datas from the host

#

but doesn't work

#

@wet holly

wet holly
naive adder
#

@wet holly

wet holly
# naive adder

Sorry, been a little busy.

The way you are handling all of this is a little bit confusing to me. When using the MultiplayerSpawner node, you really only want the authoritative instance to add nodes to it (yet it looks like you have the authority calling an RPC on the other clients telling them all to spawn players). That's definitely the first thing you're going to need to work out

#

It also looks like you are trying to manually synchronize data using RPC's, but you have data that I don't believe will serialize on its own (Nodes, for instance) inside of the payload you are passing to the RPC.

You can continue down that path, but you may need to do some additional work (IE: Send the node path inside of the RPC, and then load the actual node on the client). Depending on data, it may be better to use a synchronizer for all of this, and not have it wrapped in arrays/dictionaries.

#

(Synchronizer also cannot handle Nodes)

naive adder
#

So, you're telling me that I don't need to synchronize players datas across clients? and should not spawn nodes using rpcs?

wet holly
# naive adder So, you're telling me that I don't need to synchronize players datas across clie...

The MultiplayerSpawner works by you telling it what nodes it should watch for, and pointing it to the spot in the scene tree it should watch for them. When the authoritative client adds a node to the tree where the spawner is watching, the spawner will automatically handle creating that node on the other clients.

If you want to use the MultiplayerSpawner, you should not be manually spawning nodes anywhere but the authoritative instance.

Synchronizing player data still needs to happen (it isn't handled by the spawner). You can do this by RPC as well, but it can be easier to set up using the MultiplayerSynchronizer (CAN be, not always).

What I was trying to say regarding sync is that I don't believe you can send nodes over the wire with RPC or MultiplayerSynchronizer (maybe I am mistaken, though)

naive adder
#

thanks for this valuable info

#

im working on the issue rn and i think im getting into something