mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-27 10:34:16 +00:00
test debug logging
This commit is contained in:
@@ -187,6 +187,13 @@ async function createClientGame(
|
||||
: undefined;
|
||||
const usesSharedTileState = !!sharedStateBuffer;
|
||||
|
||||
console.log("[ClientGameRunner] SAB flags", {
|
||||
isIsolated,
|
||||
canUseSharedBuffers,
|
||||
hasSharedStateFromMap: !!gameMap.sharedStateBuffer,
|
||||
usesSharedTileState,
|
||||
});
|
||||
|
||||
if (canUseSharedBuffers) {
|
||||
// Capacity is number of tile updates that can be queued.
|
||||
// This is a compromise between memory usage and backlog tolerance.
|
||||
@@ -697,6 +704,13 @@ export class ClientGameRunner {
|
||||
drainTime,
|
||||
};
|
||||
|
||||
console.log("[ClientGameRunner] mergeGameUpdates SAB", {
|
||||
tileCount: tileRefs.length,
|
||||
utilization,
|
||||
overflow,
|
||||
drainTime,
|
||||
});
|
||||
|
||||
for (const ref of tileRefs) {
|
||||
combinedPackedTileUpdates.push(BigInt(ref));
|
||||
}
|
||||
|
||||
@@ -531,6 +531,13 @@ export class PerformanceOverlay extends LitElement implements Layer {
|
||||
this.tileUpdatesPerRender = tileUpdatesCount;
|
||||
this.tileUpdatesPeak = Math.max(this.tileUpdatesPeak, tileUpdatesCount);
|
||||
this.totalTilesUpdated += tileUpdatesCount;
|
||||
|
||||
console.log("[PerformanceOverlay] tile metrics", {
|
||||
tileUpdatesCount,
|
||||
ringBufferUtilization,
|
||||
ringBufferOverflows,
|
||||
ringDrainTime,
|
||||
});
|
||||
}
|
||||
|
||||
if (ringBufferUtilization !== undefined) {
|
||||
|
||||
@@ -186,6 +186,11 @@ export class GameRunner {
|
||||
let packedTileUpdates: BigUint64Array;
|
||||
const tileUpdates = updates[GameUpdateType.Tile];
|
||||
if (this.tileUpdateSink !== undefined) {
|
||||
if (tileUpdates.length > 0) {
|
||||
console.log("[GameRunner] tile updates for tick", this.game.ticks(), {
|
||||
count: tileUpdates.length,
|
||||
});
|
||||
}
|
||||
for (const u of tileUpdates) {
|
||||
const tileRef = Number(u.update >> 16n) as TileRef;
|
||||
this.tileUpdateSink(tileRef);
|
||||
|
||||
@@ -496,6 +496,12 @@ export class GameView implements GameMap {
|
||||
flag: nation.flag,
|
||||
} satisfies PlayerCosmetics);
|
||||
}
|
||||
|
||||
console.log("[GameView] constructed", {
|
||||
usesSharedTileState: this.usesSharedTileState,
|
||||
width: this._map.width(),
|
||||
height: this._map.height(),
|
||||
});
|
||||
}
|
||||
|
||||
isOnEdgeOfMap(ref: TileRef): boolean {
|
||||
|
||||
@@ -69,6 +69,14 @@ export async function loadTerrainMap(
|
||||
)
|
||||
: undefined);
|
||||
|
||||
console.log("[TerrainMapLoader] loadTerrainMap", {
|
||||
map,
|
||||
mapSize,
|
||||
canUseSharedBuffers,
|
||||
hasSharedStateArg: !!sharedStateBuffer,
|
||||
createdStateBuffer: !!stateBuffer,
|
||||
});
|
||||
|
||||
const gameMap =
|
||||
mapSize === GameMapSize.Normal
|
||||
? await genTerrainFromBin(
|
||||
|
||||
@@ -78,6 +78,12 @@ ctx.addEventListener("message", async (e: MessageEvent<MainThreadMessage>) => {
|
||||
sharedTileRing = null;
|
||||
}
|
||||
|
||||
console.log("[Worker.worker] init", {
|
||||
hasSharedStateBuffer: !!message.sharedStateBuffer,
|
||||
hasRingHeader: !!message.sharedTileRingHeader,
|
||||
hasRingData: !!message.sharedTileRingData,
|
||||
});
|
||||
|
||||
gameRunner = createGameRunner(
|
||||
message.gameStartInfo,
|
||||
message.clientID,
|
||||
|
||||
Reference in New Issue
Block a user