Tsing Tile issue
This commit is contained in:
@@ -466,6 +466,20 @@ public class DungeonGeneratorV2
|
||||
var mixedCount = _tileSocketsStrict.Count - openCount - closedCount;
|
||||
Console.WriteLine($"[DungeonGenV2] Socket distribution: AllOpen={openCount}, AllClosed={closedCount}, Mixed={mixedCount}");
|
||||
|
||||
// DEBUG: Log a few specific tiles to verify socket loading
|
||||
foreach (var t in _tileDefinitions.Values.Where(td => td.Type == TileType.Floor).Take(10))
|
||||
{
|
||||
if (_tileSocketsStrict.TryGetValue(t.Id, out var sockets))
|
||||
{
|
||||
Console.WriteLine($"[Socket DEBUG] Tile {t.Id} frame={t.FrameIndex} '{t.Name}': " +
|
||||
$"N={t.SocketN}({(int)t.SocketN})→{sockets.GetSocketId("N")}, " +
|
||||
$"E={t.SocketE}({(int)t.SocketE})→{sockets.GetSocketId("E")}, " +
|
||||
$"S={t.SocketS}({(int)t.SocketS})→{sockets.GetSocketId("S")}, " +
|
||||
$"W={t.SocketW}({(int)t.SocketW})→{sockets.GetSocketId("W")}");
|
||||
}
|
||||
}
|
||||
Console.WriteLine($"[DungeonGenV2] Socket distribution: AllOpen={openCount}, AllClosed={closedCount}, Mixed={mixedCount}");
|
||||
|
||||
// Determine if we should use strict sockets
|
||||
// Use strict if we have tiles with non-default socket configurations
|
||||
_useStrictSockets = openCount > 0 || mixedCount > 0;
|
||||
@@ -639,38 +653,54 @@ public class DungeonGeneratorV2
|
||||
Console.WriteLine($"[Socket] ({x},{y}) Required sockets: {string.Join(", ", required.Select(kv => $"{kv.Key}={kv.Value}"))}");
|
||||
}
|
||||
|
||||
var primary = _tileDefinitions.Values
|
||||
// Get ALL floor tiles in family first, then filter
|
||||
var allPrimary = _tileDefinitions.Values
|
||||
.Where(t => t.Type == TileType.Floor)
|
||||
.Where(t => HasTag(t, primaryTag))
|
||||
.ToList();
|
||||
|
||||
var allVariance = _tileDefinitions.Values
|
||||
.Where(t => t.Type == TileType.Floor)
|
||||
.Where(t => HasTag(t, varianceTag))
|
||||
.ToList();
|
||||
|
||||
// Debug: Show why tiles are being filtered out
|
||||
if (required.Count > 0 && allVariance.Count > 0)
|
||||
{
|
||||
Console.WriteLine($"[Socket] ({x},{y}) Checking {allVariance.Count} variance tiles against requirements:");
|
||||
foreach (var t in allVariance.Take(5))
|
||||
{
|
||||
var sockets = _tileSocketsStrict.GetValueOrDefault(t.Id);
|
||||
bool passes = SatisfiesSocketRequirementsStrict(t.Id, required);
|
||||
|
||||
var failReasons = new List<string>();
|
||||
foreach (var (edge, reqSocket) in required)
|
||||
{
|
||||
var tileSocket = sockets.GetSocketId(edge);
|
||||
if (!tileSocket.Equals(reqSocket, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
failReasons.Add($"{edge}: need {reqSocket}, have {tileSocket}");
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"[Socket] Tile {t.Id} frame={t.FrameIndex}: {(passes ? "PASS" : "FAIL")} {string.Join(", ", failReasons)}");
|
||||
}
|
||||
}
|
||||
|
||||
var primary = allPrimary
|
||||
.Where(t => SatisfiesSocketRequirementsStrict(t.Id, required))
|
||||
.ToList();
|
||||
|
||||
var variance = _tileDefinitions.Values
|
||||
.Where(t => t.Type == TileType.Floor)
|
||||
.Where(t => HasTag(t, varianceTag))
|
||||
var variance = allVariance
|
||||
.Where(t => SatisfiesSocketRequirementsStrict(t.Id, required))
|
||||
.ToList();
|
||||
|
||||
// Debug: Log pool sizes
|
||||
if (required.Count > 0)
|
||||
{
|
||||
Console.WriteLine($"[Socket] ({x},{y}) Primary pool: {primary.Count}, Variance pool: {variance.Count}");
|
||||
if (variance.Count > 0 && variance.Count <= 5)
|
||||
{
|
||||
foreach (var v in variance)
|
||||
{
|
||||
var sockets = _tileSocketsStrict.GetValueOrDefault(v.Id);
|
||||
Console.WriteLine($"[Socket] Variance tile {v.Id} frame={v.FrameIndex}: N={sockets.GetSocketId("N")}, E={sockets.GetSocketId("E")}, S={sockets.GetSocketId("S")}, W={sockets.GetSocketId("W")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine($"[Socket] ({x},{y}) Primary pool: {primary.Count}/{allPrimary.Count}, Variance pool: {variance.Count}/{allVariance.Count}");
|
||||
|
||||
if (primary.Count == 0 && variance.Count == 0)
|
||||
{
|
||||
if (required.Count > 0)
|
||||
{
|
||||
Console.WriteLine($"[Socket] No compatible tile at ({x},{y}) - Required: {string.Join(", ", required.Select(kv => $"{kv.Key}={kv.Value}"))}");
|
||||
}
|
||||
Console.WriteLine($"[Socket] ({x},{y}) NO COMPATIBLE TILES FOUND!");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -681,11 +711,8 @@ public class DungeonGeneratorV2
|
||||
var chosen = pool[_rng.Next(pool.Count)];
|
||||
|
||||
// Debug: Log what we picked
|
||||
if (required.Count > 0)
|
||||
{
|
||||
var chosenSockets = _tileSocketsStrict.GetValueOrDefault(chosen.Id);
|
||||
Console.WriteLine($"[Socket] ({x},{y}) PICKED tile {chosen.Id} frame={chosen.FrameIndex}: N={chosenSockets.GetSocketId("N")}, E={chosenSockets.GetSocketId("E")}, S={chosenSockets.GetSocketId("S")}, W={chosenSockets.GetSocketId("W")}");
|
||||
}
|
||||
var chosenSockets = _tileSocketsStrict.GetValueOrDefault(chosen.Id);
|
||||
Console.WriteLine($"[Socket] ({x},{y}) PICKED tile {chosen.Id} frame={chosen.FrameIndex}: N={chosenSockets.GetSocketId("N")}, E={chosenSockets.GetSocketId("E")}, S={chosenSockets.GetSocketId("S")}, W={chosenSockets.GetSocketId("W")}");
|
||||
|
||||
return chosen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user