4.3
Hi all, I’m trying to implement dynamic and indpedent level switching for clients in multiplayer but I encounter the signal 11 error on all attempts. Server is not a player in this project. The first level will be called ‘overworld’, the second ‘shop’. From what I understand all level switching should occur on the server for multiplayer levels.
So far I can:
- Host a local network server and dynamically add clients
- Clients can join and interact with the world in their own instance
- Change levels by first removing the client player from the scene tree, removing the overworld from the scene tree and adding the shop to the scene tree before adding the client player to the shop. I use remove child and not queue free for the levels because I would like to return to the same level later
However when trying to change from the shop back to the overworld I remove the client player, request_ready() the overworld and its children before removing the shop and adding the overworld to the scene tree. Whenever I attempt this I get the signal 11 error detailed below. It always happens around the point where I try to add_child(overworld).
================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.3.stable.official (77dcf97d82cbfe4e4615475fa52ca03da645dbd8)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
[21] error(-1): no debug info in PE/COFF executable
[22] error(-1): no debug info in PE/COFF executable
[23] error(-1): no debug info in PE/COFF executable
[24] error(-1): no debug info in PE/COFF executable
[25] error(-1): no debug info in PE/COFF executable
[26] error(-1): no debug info in PE/COFF executable
[27] error(-1): no debug info in PE/COFF executable
[28] error(-1): no debug info in PE/COFF executable
[29] error(-1): no debug info in PE/COFF executable
[30] error(-1): no debug info in PE/COFF executable
[31] error(-1): no debug info in PE/COFF executable
[32] error(-1): no debug info in PE/COFF executable
[33] error(-1): no debug info in PE/COFF executable
[34] error(-1): no debug info in PE/COFF executable
[35] error(-1): no debug info in PE/COFF executable
[36] error(-1): no debug info in PE/COFF executable
[37] error(-1): no debug info in PE/COFF executable
[38] error(-1): no debug info in PE/COFF executable
[39] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
Below is relevant code and viewports
This code initialises the server and players
var network
var max_players = 10
@onready var player_name: LineEdit = $Main_Menu/Name
@onready var ip: LineEdit = $Main_Menu/IP
@onready var port: LineEdit = $Main_Menu/Port
@onready var overworld = preload("res://Scenes/game.tscn").instantiate()
@onready var character3d = preload("res://Scenes/3D Player.tscn").instantiate()
@onready var shop_interior = preload("res://Scenes/shop_interior.tscn").instantiate()
@onready var crab_shop_interior = preload("res://Scenes/crab_shop_interior.tscn").instantiate()
func _on_host_pressed() -> void:
network = ENetMultiplayerPeer.new()
network.create_server(port.text.to_int(), max_players)
multiplayer.multiplayer_peer = network
network.peer_connected.connect(peer_connected)
network.peer_disconnected.connect(func(id): remove_player_character(id))
$Main_Menu.visible = false
add_child(overworld)
func _on_join_pressed() -> void:
network = ENetMultiplayerPeer.new()
network.create_client(ip.text, port.text.to_int())
multiplayer.multiplayer_peer = network
#$Main_Menu.visible = false
func _on_spawn_pressed() -> void:
load_player.rpc(multiplayer.get_unique_id(), sell)
$Main_Menu.visible = false
@rpc("any_peer")
func load_player(id, sell):
if is_multiplayer_authority():
overworld.add_player_character(sell, id)
func add_player_character(sell, id):
overworld.add_player_character(sell, id)
func remove_player_character(id):
overworld.remove_player_character(id)
This button changes levels from overworld to shop
func _on_button_pressed() -> void:
var level = overworld
var c = level.get_children()
var id = c[-1].name
level.remove_player_character(id)
print("player removed")
remove_child(level)
add_shop_interior(id)
func add_shop_interior(id):
print("adding shop")
add_child(shop_interior)
shop_interior.add_player_character(id)
This button changes levels from shop to overworld
func _on_button_2_pressed() -> void:
print("ASFF")
var level = shop_interior
var c = level.get_children()
var id = c[-1].name
level.remove_player_character(id)
print("player removed")
remove_child(level)
spawn_overworld(id)
func spawn_overworld(id):
var level = overworld
print(level)
level.request_ready()
var c = level.get_child_count()
for i in c:
level.get_child(i).request_ready()
add_child(level)
#the code breaks here and the screen freezes before crashing
level.add_player_character(id)
print("adding")
all needed levels are in the auto spawn list
Any help is appreciated.