Fix cross-platform rendering and optimize frame performance
Correct selection orientation, game-entry lifecycle, mounted NPCs, labels and skill panels. Add the native GPU scene path, resident geometry, bounded texture and Python caches, and collision broad phase. Pin the independently maintained Metin2 SDK through a submodule and document reproducible setup. Include rendering regressions and macOS packaging improvements. Validation: client Debug build and 12 targeted client tests passed; SDK build and all 14 SDK tests passed.
This commit is contained in:
@@ -772,3 +772,124 @@ Validation:
|
||||
- macOS arm64 `ava2_client`: builds cleanly and runs 60fps game phase.
|
||||
|
||||
|
||||
|
||||
### 2026-10-09: native login input and stale macOS bundle verification
|
||||
- Reproduced non-responsive account/password text and Tab in the existing `dist/AVA2.app`; its executable predated the current development build and input-event wiring.
|
||||
- Retained the working SDL text-input / IME / focus implementation already present in the workspace and rebuilt/repackaged the macOS app and distribution archive.
|
||||
- Replaced direct login text assignment in `ava2.window_tree` with mouse focus for both fields, IME text insertion, Tab focus switching, and password backspace assertions.
|
||||
- Validation: `ava2.window_tree` passed; native rebuilt app visibly accepted account text, Tab switched to password, password masking and backspace worked. No live authentication was attempted and no server changes were made.
|
||||
- Outstanding: live server authentication and non-ASCII IME composition are outside this verification.
|
||||
|
||||
### 2026-10-10: character selection rendering against the AVA2 Windows reference
|
||||
- Preserved existing workspace fixes for transparent UI boards and character composition. Rebuilt screenshots confirm that the roster and description panels no longer appear as solid white rectangles.
|
||||
- Corrected `app.SetCamera` native Y to engine Z conversion and used the Windows camera's right-handed screen orientation. The previous view exposed back-facing geometry through the model: faces, hair and clothing now render from the correct side. `SetCenterPosition` also converts native height/depth consistently.
|
||||
- Applied the `prototype.RunApp` hair/armor/weapon initialization before creating the first phase window. Armor item vnums now resolve through item-proto to MSM shapes instead of falling back to novice clothes.
|
||||
- `chr.Update` preserves explicit intro heights outside the game phase. `chr.Deform` no longer advances animation/movement a second time, preventing residual map heights from moving intro models outside the screen.
|
||||
- Added optional FreeType UI fonts with shared text measurement/rendering metrics, 2x glyph rasterization for Retina, proportional cursor/alignment positions, and preserved zero-alpha text. SDKs without FreeType retain a smaller, consistently measured fallback. Platform fonts are located at runtime; no proprietary font assets were copied.
|
||||
- Removed per-draw diagnostic output, restricted the phase hint banner to explicit preview mode, and repaired the existing 3D test's vertex/index counting (which had been replaced by a hair debug dump).
|
||||
- Added `ava2.select_render`: four original races, item-to-shape conversion, camera direction/winding, head/feet containment, unchanged height during intro updates, no animation tick during deformation, panel pixels, proportional text width, and transparent text pixels. Optional screenshot output covers all four slots with Jinno scenery; packaged-app verification uses the Shinsoo preview roster.
|
||||
- Validation: macOS build and Android arm64 `main` build passed; selection/window-tree/3D/event/Python-view checks passed. The full suite passed 42/44; `ava2.python` still fails on the existing `chr.GetPixelPosition` native-Y/engine-Z round-trip mismatch, and `ava2.chr` on `SetDirection`/`GetRotation`, outside these changes. The baseline checker reports pre-existing edits to interfacemodule/intrologin/serverinfo/ui; AVA2 reference files were not modified.
|
||||
- Rebuilt `dist/AVA2.app` and its distribution archive. The macOS packager now bundles and relocates SDL3, FreeType and dependent dylibs recursively; signature verification and launching the packaged executable with a selection screenshot passed. Screenshots are under `build/verification/selection/` and are generated artifacts.
|
||||
- Outstanding: live-account selection is not verified; preview roster/equipment and empire differ from the supplied Windows screenshot. Android currently uses the fallback font because this NDK configuration has no FreeType library; on-device rendering remains unverified. Exact Windows spot/point lighting and specular parity remain open.
|
||||
|
||||
### 2026-10-10: investigation of repeated selection title, flag and borders
|
||||
- Reproduced the user's 22:58:52 screenshot by loading the original login UI, releasing its phase/account callback references and windows, then creating selection with a mock roster. No live authentication was performed.
|
||||
- Confirmed that image-instance `Destroy()` omits `Initialize()` in both the base and expanded classes, unlike Windows. The pool reuses objects without reconstruction, leaking login rendering rectangles into selection: Warrior title right fraction 32.3125, Jinno flag 10, and corner images with inherited horizontal/vertical extensions. SDL then tiles these images across the screen.
|
||||
- A temporary restoration of both reset calls removed the inherited rectangles and repeated strips in the same reproduction; the four-race selection checks passed. Temporary source changes were restored after investigation; the distribution bundle remains unchanged.
|
||||
- Report: `docs/SELECT-RENDER-INVESTIGATION.md`; generated before/after screenshots, logs, reproduction source and proposed patch are under `build/verification/pool-investigation/`.
|
||||
- Outstanding: apply and validate the lifecycle fix, add object-pool and login-to-selection regression coverage with image-bound checks, and test returning to login and selecting again. Previous direct-selection tests did not exercise this path and their existing assertions do not detect repeated textures.
|
||||
|
||||
### 2026-10-10: investigation of blank game entry in the packaged app
|
||||
- Reproduced original GameWindow construction failure in the current distribution: `InventoryWindowEx.py` cannot load `rework_inv/new_equipment_bg.tga`. The image exists in the AVA2 pack manifest and project root, but the fixed packaging directory list omits it from both Resources and the asset manifest.
|
||||
- Ran the same packaged executable against the complete test resource root: original game UI, terrain and characters were drawn. This was an offline preview, not a live-account entry verification. Several tree/effect textures still failed to resolve.
|
||||
- Also confirmed the package omits `map/`; the map loader relies on relative map directories and development paths. Existing Python-view game tests use a simplified phase callback and do not construct original GameWindow.
|
||||
- Report: `docs/GAME-RENDER-INVESTIGATION.md`; generated logs and comparison screenshot are under `build/verification/game-investigation/`. No production code or distribution bundle was changed for this investigation.
|
||||
- Outstanding: complete packaging from virtual pack paths, unify resource-root resolution for maps/images/scripts, validate original loading-to-game with the packaged app, apply the image-pool reset, and then assess remaining scene/camera/texture parity against Windows.
|
||||
|
||||
|
||||
### 2026-10-10: game entry rendering fixes and live package verification
|
||||
- Applied base/expanded image-instance pool resets; a render comparison poisons and reuses a pooled title instance, verifying that rectangles, scale, rotation, color, flip and mode reset.
|
||||
- Assets are assembled from AVA2 virtual pack paths plus loose image/audio/model resources beside the Windows client. Required missing pack entries fail packaging. The adapted Python root is included in the manifest with case-sensitive module names preserved; no development directory symlinks remain in the full macOS bundle.
|
||||
- Fixed resource-root lookup for maps, properties, terrain textures, model textures and SpeedTree files. Terrain blocks use their local block position and raw-height border offset. Native areadata coordinates/rotation axes convert to the game renderer's axes.
|
||||
- Preserved the stream's main VID after `chr.Destroy()`, bound the game camera to the real network actor, and grounded newly received actors before camera collision checks. Default game camera is RH, distance 1550, pitch 27, and views the actor from behind.
|
||||
- SDL scene drawing now orders geometry back to front; opaque DDS materials preserve RGB in the alpha/specular mask and avoid forced transparency. Terrain samples/blends native tile masks. The original minimap displays native minimap.dds tiles under the existing marks. Desktop hides the Android touch HUD. Preview movement/combat/render helpers no longer overwrite live actor state.
|
||||
- Full macOS app tested with the user-provided live account through login → selection → loading → game without preview data. The server main actor stayed at local `(43303, 17771, 70856)`, and camera distance remained 1550. Original GameWindow also constructed successfully using only packaged resources. Runtime config/chat files now use an external user-data directory (default SDL preferences directory); strict codesign verification remained valid after the live login and exit. Credentials were not saved to generated user files.
|
||||
- Verification: 9/9 relevant CTests pass (Python view, window tree, selection, game scene, original game entry, packaging, 3D rendering, minimap and background); native-area conversion/loose-assets follow-up tests pass. Android `main` target builds. Evidence: `build/verification/game-fixed/packaged-game.png`, logs and `verification.txt`. Updated deliverables: `dist/AVA2.app` and `dist/AVA2-macOS-arm64.tar.gz`.
|
||||
- Outstanding: exact Windows specular/lighting and complex intersecting-scene depth parity, neighboring terrain-block streaming, and a few effect/vegetation texture references remain. Android was compile-tested, not device-tested. Prior unrelated Python/chr parity failures remain outside this change.
|
||||
|
||||
### 2026-10-11 Game input, skill page and overhead labels
|
||||
|
||||
- Implemented AVA2-specific skill registration before loading-stage skill packets; received skill grades/levels now appear in the original skill page. Derived status recalculation follows the AVA2 point update switch.
|
||||
- Restored original name/title color initialization, FreeType overhead fonts with Retina scaling, character-height registration and actual owner positions; name stays centered while level/title extend left. Corrected GM particle half sizes/quad/live count, attached positions, gravity units and scripted direction magnitude.
|
||||
- Connected original Python keyboard/mouse controls to the live actor and movement/stop packets; added held camera keys, focus-loss releases and UI-first wheel handling. Replaced fixed game update delta and reacquired map pointers after loading callbacks.
|
||||
- Validation: 3/3 targeted CTests; packaged real-account login, nonempty skills/icons/grades, movement then zero movement on release, final overhead screenshot. Evidence: `build/verification/input-label-fixed/final.png` and logs. Updated `dist/AVA2.app` and release archive. No credentials saved.
|
||||
- Limits: complex-scene frame rate, full combat interaction and exact Windows visual parity remain unverified.
|
||||
|
||||
### 2026-10-11 Re-login lifecycle and movement facing regression
|
||||
|
||||
- Dispose both phase-window owners before registering a successor, preventing old LoadingWindow destructors from clearing the new loading callback. Apply the same ordering to player game-window callbacks and treat Python integer 0 as a cleared owner.
|
||||
- Remove actor render/bone yaw +180 offset; verify facing from the real warrior GR2 toe/foot axis against movement. Transfer initial game-server handshake milliseconds from LoginSession to native game time, once per connection, and retain bootstrap time on an unmatched native HANDSHAKE_OK.
|
||||
- Five targeted CTests pass, including destructor reentrancy, a real main-character packet callback, full GameWindow reconstruction, bootstrap clock and model facing. Game-entry test now requires its completion marker.
|
||||
- Packaged same-process live re-login passed; second scene/skill page rendered, movement followed by 100 game updates retained the connection. Evidence: `build/verification/relogin-facing-fixed/`. Updated app and release archive. Server and original AVA2 remain unchanged; no credentials saved. Limited-duration verification does not establish long-running stability.
|
||||
|
||||
### 2026-10-11 selection / NPC / performance follow-up
|
||||
|
||||
- Restored the original script API `chr.SetRotation` 180-degree conversion, fixing selection while retaining the corrected network locomotion axis. Corrected script position coordinate round trips.
|
||||
- Mounted manifest-backed bundle asset packs alongside the Python script root. This restores `locale/common/npc_wear.txt`, and live race 61000–61007 NPCs now use their configured eight PC models/outfits. NPC map-specific lookup reads the actual current map.
|
||||
- Connected Python camera settings and host camera feedback. Added regression coverage for pack mount priority, traversal rejection, NPC map precedence, camera synchronization, and GR2 presentation facing.
|
||||
- Cached static building geometry and switched macOS packaging from Debug to an explicit RelWithDebInfo build. Same NPC scene measured about 240 ms/frame in Debug versus 25 ms/frame in the optimized build, approximately 4 to 40 FPS on this host.
|
||||
- Remaining visual/performance gaps: sustained 60 FPS, mounted NPC rendering, foliage and sky parity, and hardware depth-buffer rendering. Short live samples do not establish full Windows pixel parity or long-session stability.
|
||||
|
||||
- Final validation: 8 relevant regression tests pass, live selection/NPC camera probes pass, and relogin probe remains connected after the second game entry. The broad Python suite retains unrelated missing-icon fixture / derived-status expectation failures, documented in GAME-RENDER-INVESTIGATION.md. Signed app and archive contain the optimized executable.
|
||||
|
||||
### 2026-10-11 Hardware depth, frame pacing and mounted NPCs
|
||||
|
||||
- Added a native SDL_GPU scene pass with persistent vertex/index buffers, depth testing/writes, alpha testing, D3D-style culling and perspective-correct texture interpolation. Metal is verified on this host; the Vulkan SPIR-V shaders compile but Vulkan runtime is not verified. CPU model transforms, lighting and fog remain CPU work.
|
||||
- Upload decoded textures on the scene GPU queue before sampling. Borrowing SDL_Renderer textures produced a blank first frame because their queued uploads were not submitted until Present. Composite the scene with premultiplied alpha so the original selection background survives.
|
||||
- Cache tinted text masks (512 entries / 16 MiB) instead of creating/destroying textures for every label. Cull static objects by conservative world bounds before copying mesh commands. Keep collision geometry intact. Disable GPU validation in normal release builds; AVA2_GPU_DEBUG enables it for diagnostics.
|
||||
- Move the 60 Hz deadline wait immediately before presentation and use SDL_DelayPrecise. The frame CSV distinguishes active CPU work, geometry assembly, raster encoding and presentation intervals; loading and screenshots are excluded from steady-state statistics.
|
||||
- Port the reference sky's vertical cube gradients, environment cloud scale/height/alpha and lens-flare enable conditions. This removes the invented cloud/flare appearance in C1.
|
||||
- Render mount actors and attach riders through the animated saddle bone. Convert native Z-up bone matrices before world attachment. Register the reference horse wait/walk/run/dead motions for all eight PC races, and resolve the active motion mode at playback time: riders no longer stand on mounts, and an armor rebuild preserves the riding pose. A real GR2 leg-pose regression checks riding, armor rebuild and dismount restoration.
|
||||
- Validation: 10 targeted Debug CTests pass, including native Metal depth/alpha/culling/perspective/first-texture/background pixels, font renderer lifetime, conservative frustum rejection, sky configuration and mounted animation. Live selection, NPC/mount scene, movement/orbit and same-process re-login were exercised with the authorized account. No credentials are stored in source or documentation.
|
||||
- Remaining Windows parity gaps: SpeedTree still generates approximate foliage rather than decoding the original SPT geometry; outdoor rendering still lacks full adjacent-tile streaming; original specular/sphere-map shading is not complete. Performance evidence covers the measured local Metal scene, not every map or long-running session. Existing unrelated broad-Python-suite fixture/formula failures remain unchanged.
|
||||
|
||||
- Final signed-bundle measurement: 2,400 game updates (~40 s), 2,359 steady-state samples after the first 40 updates; average 60.000 FPS, presentation interval P95 16.723 ms / P99 16.765 ms, active CPU work P95 10.424 ms / P99 11.313 ms. Two intervals exceeded 20 ms (maximum 23.478 ms); this is not a claim of zero dropped frames. Full camera orbit, short W movement and connection checks at updates 1,190 and 2,390 passed. Evidence: `build/verification/gpu-depth/final-stress.csv`, `final-stress-summary.json`, `final-stress.png`, `riding-tests.log`. Signed app: `dist/AVA2.app`; release archive updated from that bundle.
|
||||
- Final packaged re-login probe also passed after the riding fix: second GameWindow and skill page rendered, movement completed, and the connection remained live for the following 100 updates (`build/verification/gpu-depth/final-relogin.log`).
|
||||
|
||||
### 2026-10-11 Follow-up performance audit (investigation only)
|
||||
|
||||
- Captured an 8-second main-thread sample and a separate 1,200-frame unprofiled control on the signed Metal build. Control averages 60.000 FPS / 7.117 ms active CPU; P99 presentation interval 17.698 ms with one interval above 20 ms. Sampling run had an unconfirmed 521 ms pause near sampler startup; do not use it as a proven client-code spike.
|
||||
- Excluding cap-wait samples, rendering preparation and actor draw generation account for approximately 81% of main-thread samples. Prioritize actor culling/pose reuse, removal of redundant hardware-path work, immutable geometry references and resident GPU buffers. Animation switching currently reads/parses GR2 synchronously; caching needs movement/combat measurements. Terrain caching, instancing, resource budgets and UI/collision follow later.
|
||||
- Detailed evidence and implementation priorities: docs/PERFORMANCE-AUDIT-2026-10-11.md. No client runtime behavior, asset bundle or server changed during this audit.
|
||||
|
||||
### 2026-10-11 Performance optimizations: parsed assets, poses and geometry
|
||||
|
||||
- Added shared immutable parsed GR2 model/animation caching in ../sdk/gr2 (64 retained entries / 128 MiB source bytes, path/mtime/size invalidation), per-instance pose reuse and pre-bound track indices. Mutable playback/attachments remain independent. CPU pose equivalence and cache invalidation tests pass.
|
||||
- Cull non-main network actors/mounts before mesh generation using conservative bounds; keep all network/locomotion updates active. Static building commands reference immutable mesh streams; terrain patch/LOD geometry is cached and invalidated on map data/origin changes. Both software and native GPU raster paths consume geometry references.
|
||||
- Skip fallback-only screen coordinate calculations in the hardware path. Fixed a discovered exit-time minimap image reference lifetime by destroying UI/Python resources before SDL renderer/resources.
|
||||
- Same-scene stationary control: active CPU average 7.117 -> 5.423 ms (-23.8%), scene assembly 2.920 -> 1.838 ms (-37.1%); 60.000 FPS, interval P99 16.792 ms, no >20 ms interval in 1,159 steady-state frames. Eleven targeted Debug CTests pass, including original-vs-cached pose matrices, resource update invalidation, terrain reuse and hardware shared-geometry pixels/material overrides.
|
||||
- Further static resident GPU buffers, GPU transforms/skinning, instancing, memory budgets and lower-priority UI/collision changes remain follow-up work. Details and measured evidence: docs/PERFORMANCE-AUDIT-2026-10-11.md / build/verification/performance-audit/.
|
||||
|
||||
- Final signed-bundle validation: 2,400-frame camera-orbit/short movement probe passed both connection checks; 2,359 steady-state samples averaged 60.000 FPS, interval P99 16.811 ms, active mean 5.669 ms, with two >20 ms intervals (max 22.489 ms). Same-process re-login rendered the second game/skill window, completed movement, remained connected for 100 further updates and exited cleanly. Evidence: `optimized-orbit-summary.json`, `optimized-orbit.log`, `optimized-relogin.log` under build/verification/performance-audit. Signed `dist/AVA2.app` and its archive updated.
|
||||
|
||||
### 2026-10-11 Resident meshes, GPU skinning and opaque instancing
|
||||
|
||||
- Move vertex transforms, fixed-function lighting/fog and skeletal weighted transforms into Metal/Vulkan shaders. SDK raw mesh templates preserve part inverse-bind remapping, rigid/zero-weight handling and attachments; CPU bone pose still drives saddle/effects. Palettes above 128 bones and software/F6 paths retain CPU skinning. GPU geometry conversion cache validates source ownership, not just an address.
|
||||
- Resident vertex/index buffers cover immutable building, terrain and character streams, with an inactive-entry 256 MiB soft GPU retention budget. Dynamic water, tree wind and effects remain streamed. Deduplicate building mesh streams and instance compatible adjacent opaque commands through per-instance transforms/material data; transparent and skinned-palette commands remain independent.
|
||||
- Same-location signed before/after comparison: active CPU 5.976 -> 3.491 ms (-41.6%), render preparation/submit 2.918 -> 0.807 ms (-72.3%). Both cap at ~60 FPS; interval P99 16.832 -> 17.038 ms, so do not claim improved pacing from reduced CPU work. 40-second orbit averages 60.000 FPS, P99 17.020 ms with one >20 ms sample; same-process relogin/skill window/movement/connection and clean exit pass.
|
||||
- Eleven targeted Debug tests pass, including real mesh/normal skin equivalence, GPU weighted-rotation pixel comparison, resident upload reuse, instance material/matrix isolation, nonzero firstInstance and transparent exclusion. Metal verified; Vulkan shaders compile but runtime unverified. Signed app/archive updated. No original AVA2/server or credentials modified.
|
||||
- Evidence and remaining lower-priority work: docs/PERFORMANCE-AUDIT-2026-10-11.md and build/verification/gpu-resident/.
|
||||
|
||||
### 2026-10-11 Texture budgets, compiled dispatch and collision broad phase
|
||||
|
||||
- Bound decoded 3D images (64 MiB / 256 retained entries) and native/SDL textures (256 MiB soft budgets), protect in-flight/current working sets, and reuse uploaded native textures without requiring decoded RGBA residency. GPU bytes are logical image payload, not measured driver VRAM; UI images and whole-process memory remain outside this budget. Skip eviction bookkeeping below GPU budget.
|
||||
- Cache Python 2 compiled statements with bounded source retention and release before interpreter finalization. Eval still resolves current globals/callbacks; no UI throttling, frozen phase-window references or credentials written. Add frame-profile-only resource/compilation counters.
|
||||
- Add collision spatial grid candidates while preserving original OBB/radius checks, insertion-order first-hit normals, oversized-query/object fallback and index invalidation on changes.
|
||||
- Eleven targeted Debug regressions pass; add LRU/error/callback-rebind tests, texture eviction/reload/current-frame/software-transition pixel tests, and 500 exact collision hit/normal comparisons. Latest GPU hot-path tweak passes hardware_scene separately. Final signed re-login/skill-window/movement/connection/clean exit probes pass.
|
||||
- Same-scene active CPU averages 3.758 ms before, 3.722 ms final: too small to claim a reliable speedup. Final ~60 FPS, P99 interval 17.225 ms with one >20 ms sample. Forty-second orbit ~60 FPS / P99 17.239 ms with no >20 ms sample; decode/upload/compile counts stabilize and decoded retention stays below 64 MiB. GM live collision workload was not representative; non-GM/dense/multimap and actual GPU timing remain follow-up validation.
|
||||
- Signed app/archive updated; detailed limits/evidence in docs/PERFORMANCE-AUDIT-2026-10-11.md and build/verification/resource-ui-collision/.
|
||||
|
||||
### Reproducible SDK dependency (2026-10-11)
|
||||
|
||||
- Publish the shared SDK independently and pin its revision through the `sdk` Git submodule. Client builds default to this checkout; `AVA2_SDK_ROOT` supports an explicit development override. Source snapshots, tests and SDK provenance remain in the SDK repository, rather than duplicated client source.
|
||||
- Build products, unpacked game assets, local resource links, runtime state and account credentials are excluded from both commits. Embedded SPIR-V C++ shader code accompanies its GLSL source and regeneration tool as required renderer source.
|
||||
|
||||
Reference in New Issue
Block a user