World layers: a server's catalog must be the supported build's, and a player is not put out over one that is not

2.0.8's dedicated server was released with a world-layers.json scanned from
a game Steam had updated: 263 layers, where every player's game has 261. A
server that shares its layers (world_layer_sync) sends one choice for each,
the player's game turned the message down as unreadable, and nobody could
join such a server ("Join code, sender identity, or multiplayer protocol
did not match", and "Disconnected." in the server's log).
- supported_build::world_layer_count (261): how many layers the supported
  build's levels have.
- Server: a world-layers.json of another count is not used; the log says
  why and layer sync stays off, where before every player was turned away.
- --export-world-layers refuses a game folder whose count differs, so a
  release cannot be built from an updated game again.
- Player's game: a layer list of another length is left unread and every
  layer stays as the player has it; the rest of the message is taken and
  they join.
This commit is contained in:
AyeZeeBB committed 2026-10-13 18:45:37 -05:00
1 parent 9f93c3cbb2
commit 6c45e9666d
4 files changed
+38 -6

No files matched your search

+7 -1
View File
@@ -1,3 +1,4 @@
#include "Engine/Game/Build/supported_build.h"
#include "server_engine.h"
#include "global_bans.h"
#include "server_map_update.h"
@@ -198,7 +199,12 @@ bool ServerEngine::load_environment(const std::filesystem::path& folder, const s
if (const auto catalog = folder_ / "world-layers.json"; std::filesystem::exists(catalog)) {
try {
install_world_layer_catalog(world_layer_scan::read(catalog));
auto layers = world_layer_scan::read(catalog);
// (Players would turn down every message that carries the layers, and could not join.)
if (layers.layers.size() != supported_build::world_layer_count)
throw std::runtime_error("it has " + std::to_string(layers.layers.size()) + " layers and players' games have " +
std::to_string(supported_build::world_layer_count) + ": it is of another version of skate. Take the one from this server's release; world layer sync is off");
install_world_layer_catalog(std::move(layers));
log("World layers: " + std::to_string(world_layers().size()) + " from world-layers.json.");
} catch (const std::exception &e) {
log(std::string("world-layers.json error: ") + e.what(), LogLevel::warning);