diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 08:35:16 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 08:35:16 +0800 |
| commit | 7e3df862a7d2d69e35eb94e3c006efef855f4faa (patch) | |
| tree | 88c448c218e388f29e9d1fb78ccb3691707d8755 /src/LivingVillage.Desktop/Game.fs | |
| parent | 09310370365220bc9b9c560d8947cd7abc36d14f (diff) | |
| download | living-village-7e3df862a7d2d69e35eb94e3c006efef855f4faa.tar.gz | |
feat(art): 生成器民居改用黛瓦/木墙/门窗部件 + 村民可见性日志钩子(P24)
- drawMapStructures 用 RoofRidge/RoofEave + WallWood/WallWindow + Door 精灵替换原矩形色块。
- LV_NPC_VISIBLE_LOG=1 每秒打印 visible-npcs=K of 30,作为大世界村民渲染证据。
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 14 |
1 files changed, 14 insertions, 0 deletions
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() = |
