From 7e3df862a7d2d69e35eb94e3c006efef855f4faa Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Tue, 22 Sep 2026 08:35:16 +0800 Subject: feat(art): 生成器民居改用黛瓦/木墙/门窗部件 + 村民可见性日志钩子(P24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - drawMapStructures 用 RoofRidge/RoofEave + WallWood/WallWindow + Door 精灵替换原矩形色块。 - LV_NPC_VISIBLE_LOG=1 每秒打印 visible-npcs=K of 30,作为大世界村民渲染证据。 --- src/LivingVillage.Desktop/Game.fs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/LivingVillage.Desktop/Game.fs') diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 8309867..bcc4094 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -215,6 +215,8 @@ type LivingVillageGame() as this = let mutable avatarMoving = false let unlockFps = Environment.GetEnvironmentVariable("LV_UNLOCK_FPS") = "1" let perfSummaryMode = Environment.GetEnvironmentVariable("LV_PERF_SUMMARY") = "1" + // P24 证据钩子:每秒打印屏幕内可见 NPC 数,证明大世界村民确实被渲染。 + let npcVisibleLog = Environment.GetEnvironmentVariable("LV_NPC_VISIBLE_LOG") = "1" let mutable fpsSamples: float list = [] let mutable fpsFrames = 0 let mutable fpsSeconds = 0.0 @@ -751,6 +753,18 @@ type LivingVillageGame() as this = if perfSummaryMode then fpsSamples <- fps :: fpsSamples printfn $"fps={fps:F1} tick={world.Tick} pos=({world.Avatar.Pos.X:F0},{world.Avatar.Pos.Y:F0})" + if npcVisibleLog then + let viewport = this.GraphicsDevice.Viewport + let margin = float32 Sim.tilePixels + let visible = + world.Npcs + |> Array.filter (fun npc -> + let sx = npc.Pos.X - camera.X + let sy = npc.Pos.Y - camera.Y + sx >= -margin && sx <= float32 viewport.Width + margin + && sy >= -margin && sy <= float32 viewport.Height + margin) + |> Array.length + printfn $"visible-npcs={visible} of {world.Npcs.Length}" prevKb <- kb override this.EndRun() = -- cgit v1.2.3