Skip to content

load() and MultiplayerSpawner Cause Unexpected Replication Behavior #112292

@TimothyAlba

Description

@TimothyAlba

Tested versions

  • Reproducible in: 4.3-stable, 4.5.1-stable

System information

Godot v4.5.1.stable - Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 Ti (NVIDIA; 32.0.15.8157) - AMD Ryzen 9 7900X3D 12-Core Processor (24 threads) - 31.11 GiB memory

Issue description

Expected

If function load() is able to load a given scene with the incorrect case then MultiplayerSpawner configured with the correct case will spawn the scene to clients when the node is added to the MultiplayerSpawner's spawn path.

Actual

Something in the metadata load() adds to the PackedScene carries the incorrect case of the loaded scene's name, and thus when the instantiated node is added to the MultiplayerSpawner's spawn path the MultiplayerSpawner does not recognize the node's scene as a scene to replicate to clients.

First noticed it in 4.3-stable which would output a light warning in the debug console like so

0:00:06:0928   game.gd:4 @ _ready(): Case mismatch opening requested file 'res://scenes/core/player/player.tscn', stored as 'res://scenes/core/player/Player.tscn' in the filesystem. This file will not open when exported to other case-sensitive platforms.
  <C++ Source>   drivers/windows/file_access_windows.cpp:181 @ open_internal()
  <Stack Trace>  game.gd:4 @ _ready()

The above warning does not show in 4.5.1-stable

Proposal

Either:

  • Throw a runtime error when there's a case mismatch in the load() function
  • Fix the case mismatch when creating the PackedScene so it contains the correct case

Steps to reproduce

Recreate Failure

  1. In res://scripts/lobby.gd ensure line 9 is commented out and line 7 is uncommented
  2. Start the game with at least two debug windows
  3. On one window click Host
  4. On the other windows click Join
  5. Check the Remote tab in the Scene window, clicking through the different sessions and notice how only one of the sessions has nodes in the root/Game/Lobby/Players path

Working Version

  1. In res://scripts/lobby.gd ensure line 7 is commented out and line 9 is uncommented
  2. Start the game with at least two debug windows
  3. On one window click Host
  4. On the other windows click Join
  5. Check the Remote tab in the Scene window, clicking through the different sessions and notice how all sessions now have nodes in the root/Game/Lobby/Players path

Minimal reproduction project (MRP)

Godot-load-bug.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions