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:
shen
2026-10-11 17:55:53 -07:00
parent 08cc8865be
commit 281418f351
101 changed files with 6244 additions and 1877 deletions
+54 -21
View File
@@ -3,7 +3,7 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
BUILD_DIR="${ROOT_DIR}/build/dev"
BUILD_DIR="${ROOT_DIR}/build/release"
DIST_DIR="${ROOT_DIR}/dist"
APP_NAME="AVA2"
BUNDLE_DIR="${DIST_DIR}/${APP_NAME}.app"
@@ -19,6 +19,7 @@ echo ""
# 1. Compile client targets if needed
echo "[1/5] Building native targets..."
cmake -S "${ROOT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build "${BUILD_DIR}" --target ava2_client -j8
# 2. Setup bundle structure
@@ -31,40 +32,72 @@ mkdir -p "${BUNDLE_DIR}/Contents/Frameworks"
# 3. Copy binary
echo "[3/5] Installing executable and Info.plist..."
cp "${BUILD_DIR}/ava2_client" "${BUNDLE_DIR}/Contents/MacOS/ava2_client"
ln -sf "ava2_client" "${BUNDLE_DIR}/Contents/MacOS/AVA2"
chmod +x "${BUNDLE_DIR}/Contents/MacOS/ava2_client"
if [ -f "${ROOT_DIR}/support/mac/Info.plist.in" ]; then
cp "${ROOT_DIR}/support/mac/Info.plist.in" "${BUNDLE_DIR}/Contents/Info.plist"
fi
if [ -f "${ROOT_DIR}/support/mac/AppIcon.icns" ]; then
cp "${ROOT_DIR}/support/mac/AppIcon.icns" "${BUNDLE_DIR}/Contents/Resources/AppIcon.icns"
fi
# 4. Package core game assets into Bundle Resources
echo "[4/5] Packaging client assets into bundle..."
EXTRA_PACK_ARGS=""
if [ "${1:-}" = "--full" ] || [ "${1:-}" = "--include-heavy" ]; then
echo " (Including heavy 3D assets & BGM)"
EXTRA_PACK_ARGS="--include-heavy"
fi
python3 "${SCRIPT_DIR}/pack_assets.py" \
--source "${ROOT_DIR}" \
--output "${BUNDLE_DIR}/Contents/Resources" \
--manifest "${BUNDLE_DIR}/Contents/Resources/asset_manifest.json"
--manifest "${BUNDLE_DIR}/Contents/Resources/asset_manifest.json" \
${EXTRA_PACK_ARGS}
# Symlink resources relative to MacOS folder for direct path resolution
cd "${BUNDLE_DIR}/Contents/MacOS"
ln -sf "../Resources/mark" mark
ln -sf "../Resources/locale" locale
ln -sf "../Resources/uiscript" uiscript
ln -sf "../Resources/textureset" textureset
ln -sf "../Resources/sound" sound
ln -sf "../Resources/runtime" runtime
ln -sf "../Resources/upstream" upstream
# Install Python runtime & script root
if [ -f "${BUILD_DIR}/python27.zip" ]; then
echo " Installing python27.zip standard library..."
cp "${BUILD_DIR}/python27.zip" "${BUNDLE_DIR}/Contents/Resources/python27.zip"
fi
echo " Python script root installed through the resource manifest."
if [ -f "${ROOT_DIR}/runtime/login_view.py" ]; then
cp "${ROOT_DIR}/runtime/login_view.py" "${BUNDLE_DIR}/Contents/Resources/login_view.py"
fi
# Resolve every virtual resource directory, including patch-pack directories.
# All links stay inside the bundle; --full copies heavy assets as well.
python3 - "${BUNDLE_DIR}" "${ROOT_DIR}" <<'PYLINK'
from pathlib import Path
import sys
bundle, source = map(Path, sys.argv[1:])
resources = bundle / "Contents/Resources"
macos = bundle / "Contents/MacOS"
for item in resources.iterdir():
link = macos / item.name
if not link.exists() and not link.is_symlink():
link.symlink_to(Path("../Resources") / item.name)
for name in ("ymir work", "bgm"):
if not (resources / name).exists() and (source / name).is_dir():
(resources / name).symlink_to(source / name)
(macos / name).symlink_to(Path("../Resources") / name)
if not (resources / "UIScript").exists():
(resources / "UIScript").symlink_to("uiscript")
if not (resources / "root/UIScript").exists():
(resources / "root/UIScript").symlink_to("uiscript")
(resources / "upstream").mkdir(exist_ok=True)
link = resources / "upstream/python-root"
if not link.exists():
link.symlink_to("../root")
PYLINK
cd "${ROOT_DIR}"
# Bundle and relocate SDL3 dylib for self-contained deployment
if [ -f "/opt/homebrew/opt/sdl3/lib/libSDL3.0.dylib" ]; then
echo "[4.1/5] Bundling SDL3.0.dylib into Frameworks..."
cp "/opt/homebrew/opt/sdl3/lib/libSDL3.0.dylib" "${BUNDLE_DIR}/Contents/Frameworks/"
install_name_tool -change "/opt/homebrew/opt/sdl3/lib/libSDL3.0.dylib" "@executable_path/../Frameworks/libSDL3.0.dylib" "${BUNDLE_DIR}/Contents/MacOS/ava2_client"
install_name_tool -id "@executable_path/../Frameworks/libSDL3.0.dylib" "${BUNDLE_DIR}/Contents/Frameworks/libSDL3.0.dylib"
echo "[4.2/5] Ad-hoc signing bundle binaries for macOS arm64..."
codesign -f -s - "${BUNDLE_DIR}/Contents/Frameworks/libSDL3.0.dylib"
codesign -f -s - "${BUNDLE_DIR}/Contents/MacOS/ava2_client"
fi
# Include SDL3 and all optional font libraries, with their transitive dependencies.
python3 "${SCRIPT_DIR}/bundle_macos_libraries.py" "${BUNDLE_DIR}"
# 5. Create Distribution Archive
echo "[5/5] Creating release distribution tarball..."