How can I duplicate a node with all it's subnodes, since I can't instance a scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mateusak
:warning: Old Version Published before Godot 3 was released.

The case is the following; with the release of the new multiplayer, I’ve been trying to implement a basic LAN game. In my mind, the host create the world, and when another player logs in, it copies the world of the master to the client of the slave. That’s where I get lost. Changes happens to the world, so instantiating a scene is a no go. If you know an alternative way of doing this, say it, please.

Sorry, but when/where was the new multiplayer stuff released? I haven’t been able to find a stable build with it at all yet. :-/

ScottBeacon | 2016-11-09 07:00

You have to build it yourself. Or you could download from Cael’s @ Unofficial Godot Engine builds - Hugo Locurcio

Tybobobo | 2016-11-09 18:25

You can download the latest unofficial stable build in here.

mateusak | 2016-11-09 19:09

:bust_in_silhouette: Reply From: Tybobobo

You will have to store the data in the server. Every change a player make, will have to be sent to the server, and then re-sent to all clients. You can use the same principle to send the data to the new player that connects.

That data you send could for example be a json string, containing the important map data that you use to create the scene. You could create an “map” instance, that contains a function to update it, which is sent by the server upon connecting.

I did this with low level language, have yet to try this with the new high level networking.