From 4993bc37cb00356b83cb4f8a2e4a92fc2fe77922 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Sat, 19 Sep 2026 03:20:56 +0800 Subject: feat: M3a 30 NPC 社区 — initialWorldN 网格布局 + Wander 寻伴闲聊 v1(ChatInit 事件队列 + 双方 Chatted 记忆 valence+0.3 + Social+40) + headless 聊天统计; 修复 clamp 泛型比较装箱(30npc 1天 63.5s→15.7s, 输出逐字节一致) + M3a 对拍/闲聊对称测试 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LivingVillage.Desktop/Game.fs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/LivingVillage.Desktop/Game.fs') diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index e2b520f..2e28760 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -70,6 +70,8 @@ module NpcView = | Sleep -> "sleep" | Wander -> "wander" | Work -> "work" + | Chat -> "chat" + | Work -> "work" type LivingVillageGame() as this = inherit Game() @@ -82,7 +84,7 @@ type LivingVillageGame() as this = let mutable atlas = Unchecked.defaultof let mutable pixel = Unchecked.defaultof let mutable map = MapGen.generate Sim.mapWidthTiles Sim.mapHeightTiles - let mutable world = Sim.initialWorld 42UL + let mutable world = Sim.initialWorldN 42UL Sim.npcCount let mutable camera = Vector2.Zero let mutable fpsFrames = 0 let mutable fpsSeconds = 0.0 @@ -139,10 +141,10 @@ type LivingVillageGame() as this = fpsFrames <- 0 fpsSeconds <- 0.0 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}" + if world.Npcs.Length > 0 then + NpcView.actionName world.Npcs.[0].Mind.Action + else "none" + this.Window.Title <- $"Living Village M3a{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) = @@ -163,9 +165,12 @@ type LivingVillageGame() as this = spriteBatch.Draw(atlas, dst, src, Color.White) 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) + spriteBatch.Draw(pixel, avatarDst, Color.Red) + let npcShades = + [| Color.Navy; Color.MediumBlue; Color.Blue; Color.RoyalBlue; Color.DodgerBlue |] 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) + let (NpcId idx) = npc.Id + spriteBatch.Draw(pixel, npcDst, npcShades.[idx % npcShades.Length]) spriteBatch.End() -- cgit v1.2.3