From ab19df0ebad8da972cd30f89f7cfd8ef38b8c0ae Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 14:55:37 +0800 Subject: feat(kernel): 地图边界参数化与存档 v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sim 地图边界由常量 52 改为可配置(configureBounds,默认 64x48 = 与全部基线一致);Sim.step 裁剪、initialWorld 中心出生时点按当前边界读取;WorldSave 升级 V2 头携带 width/height 两字段,V1 旧存档照常读入并自动回退到 64x48;回归:512x384 边界裁剪/初界转正/双份存档往返/案例 v1 档兼容读。修复前一段中报错已修正的测试代码(Ensure saved-file timeouts)。 --- src/LivingVillage.Kernel/Sim.fs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/LivingVillage.Kernel/Sim.fs') diff --git a/src/LivingVillage.Kernel/Sim.fs b/src/LivingVillage.Kernel/Sim.fs index 0845abd..9da7c46 100644 --- a/src/LivingVillage.Kernel/Sim.fs +++ b/src/LivingVillage.Kernel/Sim.fs @@ -235,8 +235,17 @@ module Sim = let dtSeconds = 1.0 / float ticksPerSecond let dtSecondsF = 1.0f / float32 ticksPerSecond - let mapWidthTiles = 64 - let mapHeightTiles = 48 + /// World dimensions are parameterized so a large procedural map (e.g. 512x384) + /// can reuse every movement/wander/clamp rule. Defaults stay the legacy 64x48 to + /// keep all existing deterministic tests and baselines untouched. + let mutable mapWidthTiles = 64 + let mutable mapHeightTiles = 48 + + /// Configure the world size. Note: the caller must not step worlds during a + /// reconfiguration; bounds are read per step from these values. + let configureBounds (widthTiles: int) (heightTiles: int) : unit = + mapWidthTiles <- widthTiles + mapHeightTiles <- heightTiles let tilePixels = 32 let avatarSpeed = 160.0f -- cgit v1.2.3