summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Game.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-19 02:37:20 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-19 02:37:20 +0800
commit2f46d1789088eb165271bd915844376aa5a84768 (patch)
treefeeb8acc35333660652d9fe1052d6ea536d43bbf /src/LivingVillage.Desktop/Game.fs
parent4627a29302aa780ba8de1e537a869650601debc3 (diff)
downloadliving-village-2f46d1789088eb165271bd915844376aa5a84768.tar.gz
feat: M2b NPC 记忆与行为稳定化 — 环形记忆(≤64: tick/kind/valence) + 行动粘性(最小600tick, urgent<20豁免) + 夜间(22-6)sleep权重x3 + Desktop蓝色NPC与标题行动名 + headless摘要(mem_count/last_valence/行动平均持续/昼夜sleep占比) + 粘性与valence测试
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
-rw-r--r--src/LivingVillage.Desktop/Game.fs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs
index 6e0feb6..e2b520f 100644
--- a/src/LivingVillage.Desktop/Game.fs
+++ b/src/LivingVillage.Desktop/Game.fs
@@ -63,6 +63,14 @@ module Atlas =
tex.SetData(colors)
tex
+module NpcView =
+ let actionName (k: NpcActionKind) : string =
+ match k with
+ | Eat -> "eat"
+ | Sleep -> "sleep"
+ | Wander -> "wander"
+ | Work -> "work"
+
type LivingVillageGame() as this =
inherit Game()
@@ -130,7 +138,11 @@ type LivingVillageGame() as this =
let fps = float fpsFrames / fpsSeconds
fpsFrames <- 0
fpsSeconds <- 0.0
- this.Window.Title <- $"Living Village M1{titleSuffix} | fps {fps:F1} | tick {world.Tick}"
+ let npcAction =
+ match world.Npcs with
+ | npc :: _ -> NpcView.actionName npc.Mind.Action
+ | [] -> "none"
+ this.Window.Title <- $"Living Village M1{titleSuffix} | fps {fps:F1} | tick {world.Tick} | npc {npcAction}"
printfn $"fps={fps:F1} tick={world.Tick} pos=({world.Avatar.Pos.X:F0},{world.Avatar.Pos.Y:F0})"
override this.Draw(gameTime: GameTime) =
@@ -152,4 +164,8 @@ type LivingVillageGame() as this =
let avatarDst =
Rectangle(int world.Avatar.Pos.X - camX, int world.Avatar.Pos.Y - camY, Sim.tilePixels, Sim.tilePixels)
spriteBatch.Draw(pixel, avatarDst, Color.IndianRed)
+ for npc in world.Npcs do
+ let npcDst =
+ Rectangle(int npc.Pos.X - camX, int npc.Pos.Y - camY, Sim.tilePixels, Sim.tilePixels)
+ spriteBatch.Draw(pixel, npcDst, Color.Blue)
spriteBatch.End()