[M8] 世界连通:关卡切换、传送点、城镇传送门、小地图 #23
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
目前每张地图都是孤岛。在
src/scene/act-scene.ts里 grep 以下关键词全部 0 命中:minimap/waypoint/portal/levelChange/transition。生成器侧的情况更明确——
src/game/wilderness.ts的UNIMPLEMENTED_PASSES列出了 13 个未移植的 D2MOO pass,其中直接相关的是:DRLGOUTPLACE_CreateLevelConnectionsDRLGOUTDOORS_SpawnAct12WaypointDRLGOUTDOORS_SpawnAct12Shrines也就是说生成的关卡根本没有连接图。
方案
不逐个移植 D2MOO 的 pass,改为从
Levels.txt的Vis0..7/Warp0..7列构建全局连通图——这是更稳妥的路线,因为它是数据驱动的,可以对全部 5 幕一次性生效。改动清单
src/game/world-graph.ts—— 从Levels.txt的Vis0..7/Warp0..7构建全局关卡连通图src/game/wilderness.ts/src/game/maze.ts—— 在生成阶段落地入口/出口/传送点的实际位置src/scene/transition.ts—— 关卡切换:淡出 → 卸载旧 scene → 加载新 pack → 在对应入口落地 → 淡入。需保持玩家状态跨关卡存活src/ui/minimap.ts—— 自动地图,数据源是CollisionGrid,等距投影复用((cx-cy)*80, (cx+cy)*40)src/game/portal.ts—— 城镇传送门 + 传送点网络 + 楼梯与已有工作的衔接
野外侧已经实现了
getPerimeterOpenings(39 号奶牛关 0 出口、2 号血色荒野 1 进 1 出,见 #15)。本里程碑要把这些几何上的洞口与连通图的边对应起来——现在它们只是墙上的缺口,不通向任何地方。
验收
scripts/verify-world-graph.ts:五幕全关卡连通性(每个关卡至少可达、无孤岛)