Fix map synchronization between host and clients
Problem: Clients received WorldSeed packet before ServerSettings, causing world generation with wrong mapSize/mapBias/mapRivers parameters. Same seed but different parameters = different maps. Solution: Include all map parameters directly in WorldSeed packet: - WorldSize (map size) - WorldType (map bias - continents/islands/etc) - WorldRivers (river/lake density) Now packet order doesn't matter - WorldSeed has everything needed for identical world generation across all clients. Changes: - WorldSeed.cs: Add map parameters, set before Generate() - ClientConnected.cs: Send full world params to joining clients - ServerLobbyScript.cs: Send full params on new world generation - Added [WORLD SYNC] debug logging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -247,10 +247,16 @@ namespace KCM
|
||||
foreach (var player in Main.kCPlayers.Values)
|
||||
player.inst.SetupJobPriorities();
|
||||
|
||||
// Send world seed with all map parameters to ensure clients generate identical world
|
||||
new WorldSeed()
|
||||
{
|
||||
Seed = World.inst.seed
|
||||
Seed = World.inst.seed,
|
||||
WorldSize = World.inst.mapSize,
|
||||
WorldType = World.inst.mapBias,
|
||||
WorldRivers = World.inst.mapRiverLakes
|
||||
}.SendToAll(KCClient.client.Id);
|
||||
|
||||
Main.helper.Log($"[WORLD SYNC] Generated new world - Seed: {World.inst.seed}, Size: {World.inst.mapSize}, Type: {World.inst.mapBias}, Rivers: {World.inst.mapRiverLakes}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user