Joining after the server has "started" the game in [High Level Multiplayer]?

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

Is there a way to allow clients to join after the “world” have been instanced? For example, using the multiplayer bomber example, how would you make it so new players could join an ongoing game?


:bust_in_silhouette: Reply From: Tybobobo

I managed to solve my problem.

Working source code here:

I figured a lot of other people would benefit from as many working examples as possible.
In this demo you can setup a lobby (and wait) or just host and start the game. Players can join you after the game have started.

I use the term “game” loosely, as there is no actual gameplay other than walking and looking around :slight_smile:

Mind if I ask you a question? First of all this is awesome you’ve provided a code to allow players to join in game, I was trying to figure out how that works but you solved that problem. However, I’ve ran into another issue:

Utilizing the code you’ve provided but altered I was trying to implement an avatar system for the multiplayer server. An avatar system is where there is a “Controller” Player Node that remote control the “Avatar” Node which in theory can allow respawning on a server without having to use queue_free() on the main player Node without causing multiplayer network errors. The problem is that the source code does allow the “Controller” Node to be loaded in, but not the “Avatar” node.

For example, when I tried to enter a server in progress, I get this error:
0:00:12:0259 - Node not found: /root/Main/Players/Avatars/avatar_1

Description: Node not found: /root/Main/Players/Avatars/avatar_1
Time: 0:00:12:0259
C Error: Condition ' !node ' is true. returned: 0
C Source: scene\main\node.cpp:1524
C Function: Node::get_node

and this:

Description: Failed to get cached path from RPC: /root/Main/Players/Avatars/avatar_1
Time: 0:00:12:0268
C Error: Condition ' node == 0 ' is true.
C Source: scene\main\scene_tree.cpp:1966
C Function: SceneTree::_network_process_packet

So back to what I’d like to ask: would you have any idea on how objects can be loaded onto the server next after the “Controller” Nodes/ Player Nodes are brought in? I just wanted to understand and fully utilize the extent of the Godot 3.0 Multiplayer functions. If not, well then it was worth a shot.


Corruptinator | 2018-03-14 03:09