summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Kernel/Sim.fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LivingVillage.Kernel/Sim.fs')
-rw-r--r--src/LivingVillage.Kernel/Sim.fs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/LivingVillage.Kernel/Sim.fs b/src/LivingVillage.Kernel/Sim.fs
index ebc435e..33f2b57 100644
--- a/src/LivingVillage.Kernel/Sim.fs
+++ b/src/LivingVillage.Kernel/Sim.fs
@@ -120,7 +120,7 @@ module Sim =
let chatValence = 0.3f
// 关系网派生(纯函数;仅在 dump/视图打开时调用,不进 step 热路径)
- let relationHalfLifeTicks = 86400L // HALF_LIFE = 1 天(86400 tick)
+ let relationHalfLifeTicks = ticksPerDay // HALF_LIFE = 1 模拟日(修复单位错误:原 86400L 实为 24 模拟分钟;1 模拟日 = ticksPerDay = 5,184,000 tick)
let relationThreshold = 0.5f // |rel| > 0.5 视为有关系
let clamp (v: float32) (lo: float32) (hi: float32) : float32 = if v < lo then lo elif v > hi then hi else v
@@ -434,11 +434,11 @@ module Sim =
Npcs = newNpcs
Events = [] }
- // ---- 关系网派生:rel(i,j) = sum(Chatted valence * exp(-(now-tick)/HALF_LIFE)) ----
+ // ---- 关系网派生:rel(i,j) = sum(Chatted valence * exp(-ln2*(now-tick)/HALF_LIFE))(真半衰:age=HALF_LIFE 处权重恰 0.5)----
let relationDecayWeight (nowTick: int64) (eventTick: int64) : float32 =
let age = float (nowTick - eventTick)
- float32 (exp (-age / float relationHalfLifeTicks))
+ float32 (exp (-(log 2.0) * age / float relationHalfLifeTicks))
// 30x30 对称矩阵(对角线 0):双向累加双方 Chatted 记忆的衰减 valence
let relationMatrix (world: World) : float32[,] =