Commit Graph
48 Commits
Author SHA1 Message Date
shenleiandClaude Opus 5.5 35f768b6ae PORT-PLAN: record helper attachments kept across rebinds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 18:18:14 +09:00
shenleiandClaude Opus 5.5 c556795ecf Keep SetWeapon/AttachPart helper attachments across rebinds
Helper attachments made outside the part slots were attached to
PART_MAIN only and dropped whenever the parts were rebound (LOD level
change, shape change, slot update). They are now recorded on the actor,
attached to the drawn instance and re-attached after the slots. A slot
taking the same bone drops the helper (last writer wins, as before);
SetRace/SetModel clear them. LODs missing a helper's bone stay on
PART_MAIN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 18:18:14 +09:00
shenleiandClaude Opus 5.5 552f6c7df4 PORT-PLAN: record blended centre sort and sibling SDK default
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 18:09:32 +09:00
shenleiandClaude Opus 5.5 5de09d07e9 Sort blended draws by bounds centre instead of first vertex
Back-to-front order for blended, non-depth-writing, water and additive
draws now uses the bounds centre of the vertices the draw indexes. The
centre of shared (immutable) geometry is cached per index range and
validated against the owning pointer; per-frame geometry is recomputed.
Depth-writing opaque draws keep the first-vertex tie-break.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 18:09:31 +09:00
shenleiandClaude Opus 5.5 efb7c120c0 Build against sibling ../sdk by default
Point the sdk submodule at https://git.slcydia.fun/4v5u09Z5a4Yuc/metin2-SDK.git
and default AVA2_SDK_ROOT to an SDK checkout beside the repository
(../sdk), falling back to the pinned submodule when it is absent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 18:04:42 +09:00
shenleiandClaude Opus 5.5 7236edf747 PORT-PLAN: record real-time clocks and LOD mesh swap
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:56:56 +09:00
shenleiandClaude Opus 5.5 bfd42bd776 Swap actor body to _lod_ meshes by camera distance
Port CGrannyLODController level selection: _lod_01.._03 are queued
{lod_03, lod_02, lod_01, main}, loaded lazily, and chosen from the
camera-target/camera distance bands (actors) or the building factor.
Parts, skins and the current motion follow the drawn instance.

Shipped LODs that drop an attaching bone in use (lion2_lod_02/03 lose
"saddle", shaman_miyeom_lod_* lose equip_left/right) stay on PART_MAIN,
and bone queries fall back to PART_MAIN for bones a LOD lacks.
Weapon item LODs are not ported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:56:41 +09:00
shenleiandClaude Opus 5.5 6282199179 Drive animation clocks from real frame time
Water, network-actor, flying-effect and weapon-trace clocks used
frames*0.033 or frames/60, and the sky box, effect.Update, fly.Update and
render-target previews advanced a fixed 1/30 or 1/60 s per call, so their
speed followed the frame rate. They now use the measured frame delta
(game_clock = sum of dt in main; GetGameFrameDelta for the Python-driven
paths; elapsed SDL ticks for render targets). --frames runs keep their
fixed 0.033 s step. The SpeedTree wind update is left unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:44:04 +09:00
shenleiandClaude Opus 5.5 71f393bbd1 PORT-PLAN: record FPS optimization pass 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:36:57 +09:00
shenleiandClaude Opus 5.5 b2c7c6ce7d Animate distant LOD actors at the original reduced animation FPS
Port CGrannyLODController::UpdateLODLevel and
CGrannyModelInstance::Update(dwAniFPS): actors whose model has a
_lod_01.gr2 sibling and stand more than 500 units from the camera
target get 30-120 animation FPS by camera distance (LODDISTANCE_ACTOR
5000, LODDISTANCE_BUILDING 25000 for models of 500+ units), and their
pose time only advances every 120/fps frames, so the SDK's cached pose
is reused in between. Restarted or switched motions re-sample at once.
The _lod_ meshes themselves are still not swapped in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:36:41 +09:00
shenleiandClaude Opus 5.5 696f4f62e6 Group depth-writing draws by pipeline state and skip redundant GPU binds
HardwareScene now tracks the bound vertex/index buffer, pipeline and
sampler within the pass and only rebinds on change (each sampler rebind
allocates a new descriptor set on SDL's Vulkan backend). The opaque sort
orders depth-writing opaque and alpha-tested draws by cull mode, texture
and geometry so consecutive batches share state; blended and
non-depth-writing draws keep back-to-front order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:29:10 +09:00
shenleiandClaude Opus 5.5 dcd301a080 Submit cached terrain patch draws by pointer
TerrainHeightmap::AppendCulledDrawRefs references the cached, shared-
geometry patch commands for the visible quadtree patches (writing the
background light into the cache) instead of copying them into a new
vector each frame. BuildCulledDraws keeps its copying behaviour on top
of it for existing callers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:21:41 +09:00
shenleiandClaude Opus 5.5 df87bc64eb Drop the extra full-screen copy at render scale < 1
The SDL_GPU pipeline renders into its own view-sized colour target and
already composites it over the whole render target, so routing it through
gpu_scene_texture cost one extra same-size copy per frame. The scaled
intermediate is now used only by the SDL geometry fallback; the hardware
composite upscales with linear filtering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:19:51 +09:00
shenleiandClaude Opus 5.5 b57f2fba99 Skip map objects beyond the AVA2 object loading distance
AVA2 builds with ENABLE_MAP_OBJECT_OPTIMIZATION: CArea::
__UpdateLoadedObjectInstances unloads objects whose 2D distance from the
main actor is at least max(OBJECT_DIST, 5000). CPythonBackground::Update
now takes the main actor position (as CPythonApplication passes it) and
sets that loading center on MapObjectManager, which skips farther
objects before their frustum test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:14:00 +09:00
shenleiandClaude Opus 5.5 46880be537 Submit cached map-object draws by pointer instead of copying
MapObjectManager::AppendDrawRefs references each visible object's cached
Render3DDraw (writing the per-frame light into the cache) rather than
copying the whole command (two texture strings, shared_ptrs, matrices)
every frame. main.cpp flattens owned draws and refs in submission order
(FlattenDraws) and passes a pointer list to RenderSceneGPU/RenderScene.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 17:09:45 +09:00
shenleiandClaude Opus 5.5 b5a15871f4 docs: record the 2026-10-12 per-frame optimization pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:46:17 +09:00
shenleiandClaude Opus 5.5 121f1a6307 app: redraw the preview minimap radar only when its inputs change
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:45:17 +09:00
shenleiandClaude Opus 5.5 699ac058f5 python: intern member-function names for PyCallClassMemberFunc
Per-frame UI callbacks (OnUpdate/OnRender/...) looked up methods with
PyObject_GetAttrString, building a new PyString each call. Names are
now interned once and cached; Py_AtExit drops the cache so a
Py_Finalize/Py_Initialize cycle never reuses stale objects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:42:47 +09:00
shenleiandClaude Opus 5.5 989f356c2e sdk: bump for cached bone index lookup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:38:18 +09:00
shenleiandClaude Opus 5.5 45644183b0 render: read every draw's transform from the instance buffer
The per-batch transforms are already uploaded to the storage buffer, so
draws use firstInstance = batch index and the 288-byte uniform header is
pushed once per frame; fragment params are pushed only on change.
Texture eviction sorts inactive images once instead of rescanning the
map per evicted image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:36:23 +09:00
shenleiandClaude Opus 5.5 5079c71f2e render: batch texture and mesh uploads into the frame command buffer
Texture() and Resident() stage their bytes on the CPU; Render copies
everything in one transfer buffer and copy pass (plus mip generation)
at the start of its own command buffer instead of acquiring and
submitting a command buffer per resource.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:35:26 +09:00
shenleiandClaude Opus 5.5 aaee4c8f70 render: pack HardwareVertex from 88 to 48 bytes
Colour as UBYTE4_NORM, normals as SHORT4_NORM (unit direction, the
shader renormalises), bones as UBYTE4 and weights as USHORT4_NORM.
Shader inputs keep their float/uint types, so the shaders are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:33:19 +09:00
shenleiandClaude Opus 5.5 545cbb1e5d render: resolve GPU textures once per draw and sort by handle
RenderSceneGPU resolves each draw's texture while classifying it and
sorts opaque draws by the texture handle instead of comparing paths;
invalid draws are dropped before sorting. Bumps sdk (skin cache).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:30:32 +09:00
shenleiandClaude Opus 5.5 f03f63e700 render: draw tri-groups as index sub-ranges of one resident mesh
Render3DDraw/HardwareBatch carry first_index/index_count; resident
meshes are uploaded once per model and groups draw with firstIndex.
Bumps sdk to 9ec7fa1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:27:05 +09:00
shenleiandClaude Opus 5.5 d5333745c5 Generate mip chains for GPU scene textures
Textures were created with one level while the sampler requested linear
mip filtering (and max_lod defaulted to 0). Allocate the full chain,
generate it after upload, and let the sampler use it, so minified
terrain and props stop shimmering and read less bandwidth. Budget
accounting includes the extra third.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:20:29 +09:00
shenleiandClaude Opus 5.5 c85f9d815d Cull off-screen actor shadows; reserve per-frame draw lists
- Network actor ground shadows use the actor's own IsVisible frustum
  test (its bounds cover the shadow) instead of building 17-vertex
  meshes with terrain queries for every actor on the map.
- Shadow ring uses a precomputed sin/cos table and reserved streams.
- Frame and network draw vectors reserve last frame's peak count and
  append network draws in one insert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:19:37 +09:00
shenleiandClaude Opus 5.5 4662e06b35 Cut per-frame text tail and label allocations
- Font: walk UTF-8 codepoints in place instead of building a vector;
  reuse the texture-cache key buffer on the hit path.
- Text tails: show/ShowAll test isShowing (kept equal to list
  membership) instead of a linear find per tail, which made the
  per-frame ShowAllTextTail O(N^2); memoize label widths measured by
  both Arrange and Render.
- Tail painter reuses one CGraphicTextInstance and font name.
- CGraphicTextInstance::Render no longer copies the text unless secret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:16:48 +09:00
shenleiandClaude Opus 5.5 33552b9eeb Bump sdk: cached part bone mapping
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:13:22 +09:00
shenleiandClaude Opus 5.5 837ccc2f31 Share GPU skinning palette per instance; push it once per change
Render3DDraw/HardwareBatch hold the SDK's shared palette instead of
copying 16 floats per bone per draw, and HardwareScene re-pushes the
uniform only when the palette pointer changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:12:14 +09:00
shenleiandClaude Opus 5.5 1eccdc87d7 Sweep Render3D mesh cache on growth only
With more than 1024 live meshes the fixed threshold rescanned the whole
cache on every ToRender3DDraw call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:08:13 +09:00
shenleiandClaude Opus 5.5 66955ef6ad Fix MSL ambiguous conditional across address spaces in hardware scene shader
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 16:08:13 +09:00
shenleiandClaude Opus 5.5 a34b9c5a49 Bump sdk to Granny-aligned curve sampling; loop motions use the loop window
sdk de8fa40: B-spline loop window, cubic curves, degree-0 first-knot>t.
ActorInstance passes the motion's loop flag to SetAnimationLoop so looping
motions sample across the seam instead of clamping to the end knots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:39:25 +09:00
shenandshen ff8667e3b9 refactor: 重构项目目录结构并纳入assets资源文件跟踪 2026-10-11 20:33:47 -07:00
shenandshen 281418f351 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.
2026-10-11 17:55:53 -07:00
shenandshen 08cc8865be Optimize rendering: frame pacing, UI culling, render scale and GPU scratch buffers 2026-10-08 17:06:17 -07:00
shenandshen d7adbb3014 pass39: complete exhaustive class-by-class and method-by-method rendering and display parity 2026-10-08 06:19:30 -07:00
shenandshen 83c7c5ad0b feat: pass38 - FlyingManager indexed fly data, CPythonManagerBank wire integration, renderTarget 1:1 parity, and dynamic module resolver 2026-10-08 05:33:31 -07:00
shenandshen 8d505c3d34 feat: pass37 - CPythonItem singleton, battle status math, and regen safe range parity 2026-10-08 04:05:06 -07:00
shenandshen 263c96aaa4 feat(parity): implement sash system, fishing raycasting, guild area events, packet subheaders, and item links (pass 36) 2026-10-08 03:07:36 -07:00
shenandshen efd3a44fa0 feat(parity): replicate batch items pickup, dragon soul refine packet, target sync, and attackability (pass35) 2026-10-08 02:11:08 -07:00
shenandshen 9a635932d6 feat(parity): replicate skill execution, affect sync, packet send methods, and monster color oracle (pass34) 2026-10-08 01:55:39 -07:00
shenandshen a7f55b29d5 feat(parity): implement Conqueror level text tail and ground item name resolution (pass33) 2026-10-08 00:07:33 -07:00
shenandshen a3674ee672 feat(parity): implement EterBase CTimer, image/slot cooldown geometry rendering (pass32) 2026-10-08 00:01:18 -07:00
shenandshen b70e9aa2d7 feat(parity): implement skill cooldown end, server emotions, target packets and render target parity (pass31) 2026-10-07 23:31:17 -07:00
shenandshen 6b8d40f894 feat(network): align ping/pong and observer packets with Windows reference (pass30) 2026-10-07 22:19:54 -07:00
shenandshen d9a2ff3fca AVA2 Windows parity passes 26-29: background, grp/net/player/app complete port, 0 placeholders, portable assets 2026-10-07 21:18:47 -07:00
shenleiandClaude Opus 5.5 9077aa389a AVA2 client Windows parity passes (gr2 BitKnit2/64-bit, GamePhase handlers, python modules)
- gr2: BitKnit2 decompression, 64-bit LE files, compressed curves
- net: remaining GamePhase handlers, generated GC packet table
- python: event/chat/chr/minimap/guild/quest/messenger/shop-search and
  other native modules ported against the AVA2 Windows client
- render: D3D8 fixed-function lighting in Gr2ModelRenderer, terrain
  without baked shade; cape/NPC equipment attachment
- tests + audits updated; docs/PORT-PLAN.md and WINDOWS-PARITY.md

Batch 4 (render pipeline: background.*, app.RenderGame/UpdateGame,
camera bindings, main.cpp fake-content removal) is still in progress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 10:43:01 +09:00
shen 9f748eb05a AVA2 cross-platform client parity baseline 2026-10-06 00:53:42 -07:00