Fix tree rendering and authored collision, add FPS display and packaging safeguards

This commit is contained in:
shen
2026-10-14 19:16:39 -07:00
parent b3808d8d0c
commit 3166b61321
35 changed files with 31336 additions and 49 deletions
+34
View File
@@ -1931,3 +1931,37 @@ UpdateGame 更新阶段建立缓存,渲染阶段尾迹读取该快照。相机
参考 d2r-mobile 的交互思路,移除闲置固定摇杆,真实落点与绘制中心分离,补齐技能独立多指归属、拖动方向提示、按住遵守冷却重试、最近敌人选择、完整快捷按钮热区及物品拖拽抬高。增加 NPC/入口和掉落物热区、接近交互、失焦取消与实例/物品 generation 防复用。保留原版双击/长按物品面板及报文,新增真实 HUD、库存和目标/技能/NPC 字节测试。详见 [移动交互调整](MOBILE-INTERACTION-2026-10-13.md)。真机多指、精确模型点击体、完整寻路和技能范围预览仍待验证/实现。
本批最终验证:完整构建成功,62/62 CTest(63.67 秒),移动专项 4/4,严格 ASan/UBSan 4/4(19.86 秒),无执行路径诊断。Python C 代码未全部同等插桩。方法/协议审计及 git diff --check 通过。SDK/参考/服务器未修改,尚未提交或推送。
### 2026-10-14 树木:包围裁剪、透明测试、静态网格与资源碰撞
改为实际 min/max 包围及整树冠距离裁剪;默认树干/frond 使用共享静态流和实例 world 矩阵,材质路径模板缓存,叶片仍按相机/摇摆更新。接通原版森林/实例/环境风强生命周期并移除 ×0.05;修复树干 alpha=84 GREATER、软件 alpha reference 0/调制时序/浮点边界。接通 authored 球/圆柱到角色 BODY 与飞行物查询,保留忽略 box 和平移规则,防高速完整跨越;生命周期删除和真实 SPT 加载失败不产生假树。485 个当前真实 SPT 两次全 LOD 快照一致且无截断。详见 [树木修复记录](TREE-RENDERING-2026-10-14.md)。原 DLL 数值、GPU 叶片/风 shader、真机性能和完整球体响应仍待对齐。
验证:62/62 完整 CTest(48.61 秒)、专项 6/6、严格 ASan/UBSan 5/5(4.07 秒)通过,包含实际 GPU 回读;方法/协议与 diff 检查通过。资源审计额外确认 280 个文件在 token 22000 处停止扩展解析,不能将无截断视为元数据完整;客户端已记录诊断,未知扩展继续保留为明确待办。SDK/参考/服务器未修改,尚未提交/推送。
### 2026-10-14 — Game FPS display and movement altitude check
Added an always-visible, non-interactive FPS badge at the safe top centre of the game screen. It counts completed SDL presentations over half-second windows (including pacing/render cost), resets on phase transitions and foreground resume, and remains hidden outside the game. It does not use the existing app.GetRenderFPS stub, which currently returns the requested rate.
Corrected MapObjectManager movement collision to test actor BODY sphere altitude against the 3D mesh OBB instead of an infinitely tall 2D footprint. Added real-model regression checks for solid obstruction, passage above/below geometry and ActorInstance walking above an object. Added rate-limited device logs for attempted movement that produces no displacement, including map, position, next position and terrain block flag.
Verified: desktop and Android builds; 4/4 focused CTests (player_motion, touch_game, flying_target, speedtree_forest); capped desktop 10 FPS measured 10.0 and displayed 10; desktop 30 FPS cap under scene load measured 16.4 and displayed 17; physical PJZ110 Android preview displayed 10 at a 10 FPS cap. Updated APK installed with existing data retained, then restored normal login launch. Evidence: build/verification/fps-movement-2026-10-14/.
Remaining: the user's specific blocked region still needs a live retest after login; this change alone does not prove its cause. Static objects still use mesh OBB proxies rather than original authored .mdatr primitives, which can incorrectly cover openings. The original Python FPS getters and app.SetFPS host integration remain separate parity gaps.
### 2026-10-14 — Reported town gate falsely sealed by mesh OBB
Live device logs pinpointed the continuing movement obstruction to metin2_map_a1 near (66041.5, 71337.5), with terrainBlock=0. The corresponding a1-middledam-01.gr2 instance at (66907.429688, 19664.039063, 72199.484375), yaw 30 degrees, has six authored planes in its companion .mdatr. The former whole-mesh OBB incorrectly seals its doorway.
MapObjectManager now reads validated little-endian AttributeData plane sets, transforms quaternion axes and centres with the same (x,z,-y) basis and object transform as the rendered model, and uses source plane crossing/radius/rectangle tests for movement and flying collision. Movement permits escape from a plane overlap. Broad-phase candidates include authored plane extents. Valid empty attributes suppress dummy collision; missing, truncated or mixed/non-plane files retain the existing OBB fallback.
Verified with the reported real gate and coordinates: the old 2D footprint intersects the doorway; the authored-plane movement test clears it; ActorInstance moves 2000 units through the entire opening; all six wall planes still block approaching spheres and allow escape. Empty/truncated attribute and above/below-OBB regressions pass. Desktop/Android builds and 4/4 focused CTests passed. APK: build/verification/fps-movement-2026-10-14/ava2-gate-fix.apk.
Deployment pending: USB disconnected before this gate-fix APK could install. The phone currently has the earlier FPS/3D-altitude fix. Reconnect and install gate-fix APK, then verify the reported passage on the live device. Remaining parity gaps: authored non-plane .mdatr primitives and height meshes, mesh-proxy camera/2D collision queries, original Python FPS getter values.
### 2026-10-14 — Mac test package and gate-fix device installation
After USB reconnection, installed the gate-fix Android APK successfully with adb install --user 0 -r (application data retained). Live passage/movement retest remains separate; the user reports additional running issues and requested a Mac package first.
Built the current workspace as macOS arm64 RelWithDebInfo and packaged full game resources into dist/AVA2.app, with dist/AVA2-macOS-arm64.tar.gz for transfer. Bundled/relocated all non-system dylibs and applied ad-hoc signatures for local testing. Verified strict deep codesign, all 88,052 asset-manifest hashes, internal bundle links, and inclusion of the reported gate .mdatr. Isolated-data packaged executable checks exited successfully in normal login (45 frames) and game preview (35 frames); opened the normal application for manual login and gameplay testing. Evidence: build/verification/macos-package-2026-10-14/.
Packager now excludes saved-account lib/wa_ac.py and optional no.py auto-login overrides from both manifest and adapted-script layers, preventing host user state from entering the test package; packaging regression passed. This is a local Apple Silicon test build, not a notarized release. Live running/animation correctness is still under investigation.
+37
View File
@@ -0,0 +1,37 @@
# 树木渲染与碰撞修复 — 2026-10-14
本批在 `b3808d8d` 之后修改客户端,参考本地 AVA2 `SpeedTreeForestDirectX8.cpp`、`SpeedTreeWrapper.cpp`、`SpeedTreeForest.cpp`、`GameLib/MapUtil.cpp / MapOutdoor.cpp` 和 `EterLib/CollisionData.cpp`。SDK、Windows 参考和服务器未修改。
## 修改位置
- `src/eter_render/SpeedTreeRT.h/.cpp`:使用 SDK 实际 min/max(包含 authored 叶卡旋转余量)计算实例包围球中心、半径,支持当前场景 yaw/scale。默认无风模式允许共享静态树干/frond 顶点、法线、索引、UV 与 diffuse;通过实例 world 矩阵定位,叶片仍按相机及摇摆更新。模板只解析一次材质路径,减少每实例每帧的文件检查。树干与叶片/frond 均使用原版 GREATER / alpha=84,不再把树干当作没有透明测试的完全不透明网格。
- `src/eter_render/SpeedTreeForest.h/.cpp`:视锥使用实际包围中心,距离裁剪只剔除整棵树冠都在距离之外的实例;CPU 风力选项用以原点为中心的保守球涵盖加权旋转。森林与实例分别维护风状态,取消未经原版定义的 ×0.05 换算。森林初始强度 0,实例 LoadTree 初始强度 1;不同环境强度更新现有实例,并保持叶片相位连续;相同强度 setter 不重复更新之后新建的实例,保留原版生命周期规则。
- 同文件:新增 SPT 球体及有限圆柱的连续碰撞。使用 source XYZ→当前 engine XZY 和实例平移,按 Wrapper 的规则不额外旋转/缩放碰撞图元;CO_BOX 忽略。球相切使用严格 `<`,圆柱使用 `<=`,保留圆柱高度筛选。移动允许退出重叠,并补充两端在外的完整跨越检测,防止帧间跨过树干;飞行物使用无退出豁免的检测。无 authored 碰撞数据时不虚构树干障碍。
- 同文件:真实资源加载失败不再伪装成程序化树;直接给定 `.spt` 名称时实际加载文件并使用 authored size,而不是按文件名生成无关树。仅没有真实资源声明的预览调用继续支持程序化树;拒绝非有限实例位置/yaw。
- `SpeedTreeRT.cpp` 在模板加载时明确报告未完整解析的 token,保留 SDK 已恢复的元数据和 `metadata_complete=false` 状态,不通过跳过未知字节伪装为完整解析。
- `src/eter_render/MapObjectManager.h/.cpp`:关联森林并用 weak lifetime 防止析构后访问;将树碰撞接到三维移动与飞行物查询。AreaData 的树加载失败不计为成功实例。
- `src/eter_render/ActorInstance.cpp`:实际移动使用 BODY 球扫掠检测树木,缺少 BODY 的模型保留当前半径 30 的备用探针;点地移动最后一步也检测树木。原有建筑/地形及滑动路径继续使用。
- `src/eter_render/EnvironmentData.h`、`src/scripting/python_background.cpp`:接通原版环境默认强度 0.2、森林初始化和环境切换;地图没有环境文件也能取得默认环境强度。
- `src/eter_render/Gr2ModelRenderer.cpp`:软件 alpha test 改为纹理/顶点/材质 alpha 调制之后的 GREATER;reference 0 不再替换为 70;使用差值式插值,避免恒定 alpha=84 因浮点权重和误差变成略大于 84,和现有 GPU 管线统一。
- `tests/speedtree_forest_test.cpp`:网格包围、yaw/scale 世界变换、部分树冠可见、130 实例共享一份树干流、CPU 模式切换、风强及相位连续、新实例与同值 setter、真实名称加载/失败、球/圆柱/忽略 box、高度/相切/高速跨越/退出重叠、角色阻挡、删除/析构后的查询。
- `tests/background_test.cpp`:默认环境风强接通及原有帧步长回归。
- `tests/flying_target_test.cpp`:软件透明阈值等于/大于 84、reference 0、透明片元不写深度、材质 alpha 调制之后再判断。
- `tests/hardware_scene_test.cpp`:实际 GPU 像素回读核对纹理 alpha 84/85/0/1 的颜色与深度遮挡边界。
## 资源与验证
日志位于 `build/verification/tree-rendering-2026-10-14/`。使用 `generation_baseline` 对当前真实资源目录的 485 个 SPT 跑两次快照,包含所有 LOD 的顶点、索引、几何/pivot hash、包围范围、节点数和限制状态;两次几何与包围结果无变化,均无截断。这证明当前恢复实现的可重复性与本资源集的完整生成,不能证明与 Windows DLL 随机序列或树形等价。
额外元数据审计:205 个完全解析,280 个报告未知扩展 token 22000(已有 REVERSE-ENGINEERING 中的待办)。这些文件的已知主数据可生成几何,但 22000 及后续扩展没有恢复;生成无截断不能掩盖这一缺口。详见 `metadata-summary.log` 与 `incomplete-metadata.jsonl`。
共享树干流测试直接核对世界变换后顶点与原展开路径一致,以及 130 个实例复用相同几何指针;不把此结果当作手机 FPS 或耗电测量。
最终验证:完整构建通过;专项 6/6(6.82 秒);完整 CTest 62/62(48.61 秒);严格 ASan/UBSan 5/5(4.07 秒),含实际执行的 GPU alpha 像素回读,无跳过或执行路径诊断。Python C 代码未全部同等插桩。46 模块方法无缺失/占位,395 映射协议常量无不匹配/未匹配,git diff --check 通过。
## 剩余边界
完整树形/随机调用分布、叶片摆幅/绝对首帧时间、原 DLL 输出尚未动态对齐。本批维持原版全几何 LOD 行为,没有启用会改变画面的自动降级。当前共享静态几何能交给原有 SDL_GPU resident/实例管线;专用叶片 GPU placement/风力 shader 尚未接入,叶片仍由 CPU 更新。密集森林真机 FPS、CPU/GPU 时间和耗电仍待测量。
碰撞数据来自资源元数据,requested tree size 对原 DLL 返回图元的内部缩放仍缺少动态证据;本批按 Wrapper 可见的平移规则实现。自定义 yaw/scale 的画面与 source 不旋转/缩放图元规则可能不同,不能宣称这些扩展变换的碰撞完全贴合。完整动态球推开/滑动响应、矿石交互、空间 culling 候选顺序及不在本资源集内的资产仍待对照;缺少 BODY 时的探针是当前移植的备用方案。
以上改动未提交或推送;设备与原版实机画面对照尚未完成。
+2
View File
@@ -1,5 +1,7 @@
# AVA2 Windows 逐模块对照与修复 — 2026-10-13
> 2026-10-14 树木后续:[树木渲染与碰撞](TREE-RENDERING-2026-10-14.md)。实际包围/整树冠距离、共享静态几何、树干/软件透明边界、环境风强和球/圆柱碰撞已接通;旧记录中的 ×0.05 和未接树碰撞状态为历史状态。原 DLL 随机/摆幅、GPU 叶片和真机性能仍待验证。
> 最新状态进展:[第二十批视锥缓存与尾迹深度](WINDOWS-TAIL-STATE-2026-10-13.md)。更新阶段缓存、正交/偏轴粗球元数据及 LESS/继承深度写入已接通,并加入 GPU 像素回读;Windows 浮点逐位与全局相机切换仍待动态对照。以下旧记录保留各批当时状态。
> 最新裁剪进展:[第十九批尾迹逐段视锥裁剪](WINDOWS-TAIL-FRUSTUM-2026-10-13.md)。六平面、线段球和标准透视粗球已接通,并保留原版 FOV 单位混用;全局缓存时序、非标准投影粗球及 GPU 深度继承仍待对照。
+1 -1
View File
@@ -133,7 +133,7 @@
},
{
"file": "src/scripting/python_background.cpp",
"line": 1019,
"line": 1024,
"api": "RenderDungeon",
"handler": "background_RenderDungeon",
"status": "constant-return candidate; compare original behavior before treating as a defect"