Sending gd script tscn over network
Asked Answered
M

2

0

Hi, I am messing around with godot's enet based high-level multiplayer library.
The idea is to use a gd script server to run a 'world' scene and synchronize with connected peers via synchronizer node. Though I want to make the game support sort of 'drop in and drop out' mode that enables peers to join or exit game in run time, to achieve such feature, I think I will need to actively synchronize all server world objects via enet upon connection.

My game also utilizes a node based ECS plugin, so I think ECS object unique ID inside node/tscn needs to be sent over network.

What's the most reliable way of sending node or tscn over network?Should I stick to the built-in packed types or I should send them using self made pack/unpack functions like the ones used in official bomberman multiplayer demo?

Thanks.

Mcnally answered 9/1, 2023 at 8:46 Comment(0)
F
0

I would advise against sending GDScript and the complete packed scene, that seems like both a security risk and a network bottleneck. What you can do is send the path to the scene to spawn, which will always be unique. Any additional information that the client needs to set up the scene can be sent in a dictionary or byte-packed format.

Fronton answered 9/1, 2023 at 8:56 Comment(0)
M
0

Fronton Thanks for the detailed reply. I will give it shot.
I am using one of the ECS plugin from official asset repo, I am not sure if ECS logics data such as entity id, component node tscn or system script should be synced via network.
Tried the customized spawn function method from the bomberman demo and it seemed to be problematic in my game.

Mcnally answered 9/1, 2023 at 11:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.