diff options
| author | Hermes Leader <v@v> | 2026-09-22 08:41:14 +0800 |
|---|---|---|
| committer | Hermes Leader <v@v> | 2026-09-22 08:41:14 +0800 |
| commit | aa3d749ed2a63f9409290c564649f9718756fd6e (patch) | |
| tree | 864a7f3d8d750158513e71739091e72204d23da3 /src/LivingVillage.Desktop/Game.fs | |
| parent | 1fb9f9de8f7a6e9124f9a650e44b2f27ed2cac7a (diff) | |
| parent | 6afc9041e9aeb9f51a3b9ea73b5a6d493862ee1c (diff) | |
| download | living-village-aa3d749ed2a63f9409290c564649f9718756fd6e.tar.gz | |
merge: P24 512x384 民居密度/村民可辨(writer hash 保留)
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() = |
