Restore archive first modern client asset installation This commit reworks the modern client asset auto installation flow so the normal path is based on downloading and extracting the GitHub release or source ZIP instead of relying on the manifest flow as the primary installer. The installer now keeps the final runtime files in the same locations already expected by OTClient. Asset files are installed under data things version, sound files are installed under data sounds version, and configured runtime extras are installed into their expected runtime locations such as bin. The manifest based path is still kept as a compatibility fallback, but it is no longer the preferred installation path for modern client assets. This restores the archive first behavior and makes the install result match the standard runtime loader layout more directly. For client versions 1281 and newer, OTClient now checks the existing files under data things version before attempting installation. When auto install is enabled and the required files are missing, the client prompts the user, downloads the configured release or source ZIP, extracts the assets folder into data things version, extracts the sounds folder into data sounds version, and installs configured runtime extras into their target runtime paths. If Services clientAssets enabled is false, OTClient now skips the asset ensure download flow during login. This avoids recursive login attempts caused by the installer prompt and keeps manual or custom asset folders usable. In that mode, OTClient proceeds with the provided local files and lets the normal runtime loader report missing or invalid assets when appropriate. The archive extraction support was also expanded. ZIP extraction now works through the vendored minizip fallback when libarchive is not available. Visual Studio project configuration was updated to enable libarchive so Windows builds can handle ZIP and RAR archive extraction. Android builds remain safe because unsupported libarchive linkage is not required there. Main changes included in this commit • Restores archive first installation for modern client assets • Keeps the manifest path only as a compatibility fallback • Downloads the GitHub release or source ZIP as the normal install path • Extracts assets into data things version • Extracts sounds into data sounds version • Installs runtime extras into their expected runtime locations such as bin • Keeps final installed files in the same OTClient runtime paths already used by the loader • Adds ZIP extraction support through the vendored minizip fallback • Enables libarchive in the Visual Studio project for Windows archive extraction • Allows Windows builds to handle ZIP and RAR extraction through libarchive • Preserves Android build safety by not requiring unsupported libarchive linkage • Skips asset ensure and download prompts when Services clientAssets enabled is false • Avoids recursive login attempts when asset auto install is disabled • Keeps manual and custom asset folders usable • Lets the normal runtime loader report actual missing or invalid files when auto install is disabled • Documents the archive first flow fallback behavior install paths and troubleshooting notes Runtime behavior For modern client versions 1281 and newer, OTClient first checks the existing files under data things version. If the files are already present, login continues without triggering the installer. If files are missing and auto install is enabled, OTClient prompts the user and installs assets from the configured GitHub release or source archive. The archive folders are mapped into the runtime locations expected by the client. The assets folder is installed into data things version. The sounds folder is installed into data sounds version. Runtime extras such as bin files are installed into their configured runtime destinations. If auto install is disabled, the installer is not called during login. The client continues with the manually provided files and the regular loader remains responsible for reporting any actual asset problems. Verification performed • luac p modules client assets client assets lua init lua • luac p modules client entergame entergame lua • git diff check • Local Windows build using vc18 otclient sln OpenGL x64 Build • GitHub Actions fast checks passed on the PR branch • GitHub Actions Lua syntax checks passed on the PR branch Overall this commit restores the expected archive based installation flow for modern client assets while preserving compatibility fallback behavior. It keeps installed files aligned with the existing OTClient runtime layout improves archive extraction support across build targets and avoids unwanted installer prompts when automatic asset installation is disabled.
4.5 KiB
Client Assets Auto-Install
This document describes the automatic client assets installation flow introduced in OTClient.
Goal
For modern Tibia client versions (>= 1281), OTClient must be able to:
- Detect missing assets for the selected version.
- Prompt the user to download required assets.
- Download and install assets automatically.
- Keep final installed files in the same paths already used by OTC runtime.
Final Install Paths (Source of Truth)
Installed assets must end up in:
data/things/<version>/data/sounds/<version>/- runtime extras (when provided by upstream package), such as
bin/*, in client runtime paths.
Do not introduce an alternative permanent assets root for runtime loading.
Main Module
- Lua module:
modules/client_assets/client_assets.lua - Enter-game integration:
modules/client_entergame/entergame.lua - Modern things/sounds loading:
modules/game_things/things.lua
Download / Install Strategy
The flow supports:
- archive installation from the release/tag source ZIP as the default path
- manifest-driven installation as a fallback path when the archive cannot be installed
- manifest hash identifier installation into
data/things/<version>/assets.json.sha256 - packaged files list (including large binaries distributed as
.zip/.rar) - extraction of
.zipand.rar - optional
.lzmadecompression
Integrity and Security Defaults
Defaults are hardened:
strictManifestSha256 = trueallowRawFallbackHashMismatch = falseallowMissingPackedRawFallback = true
allowMissingPackedRawFallback is a narrow compatibility fallback for repository releases that reference official .lzma/archive package files not stored in the assets repository. It is only used after the packed file is missing and the client falls back to the raw file from the same manifest/release source. It does not enable arbitrary hash mismatches for normal raw downloads.
Release cache is scoped per source (releasesUrl / repository key), avoiding stale cross-source reuse.
Runtime/Platform Notes
- Desktop targets use
libarchivefor archive extraction when it is available. - Builds without
libarchivestill extract.ziparchives through the vendored minizip fallback. This keeps the GitHub source ZIP flow functional on clean desktop builds. .rarextraction requireslibarchive. If a packaged.raris optional and the build cannot extract it, installation should fail clearly or skip it according to the package configuration.- The default flow is archive-first because the release source ZIP is the canonical package for this repository. The manifest path remains a compatibility fallback, not the primary installation path.
- Emscripten login fallback was aligned with native
httpLoginsemantics.
UX Behavior
- Missing-assets dialog prompts before download.
- Download window supports cancellation.
- Progress supports indeterminate mode when remote does not provide reliable content length.
- Console logs show major phases and final install paths.
Troubleshooting
1) Assets appear downloaded but game still cannot load
Check:
data/things/<version>/catalog-content.jsondata/things/<version>/assets.json.sha256data/sounds/<version>/catalog-sound.json(when sounds are enabled)
2) Missing .lzma package file
If the console shows a 404 for *.lzma, the client is using the manifest fallback instead of the release source ZIP. First check why archive installation failed. The manifest fallback can install raw files through allowMissingPackedRawFallback, but this path is slower and should not be the normal flow for clean installs.
3) SHA-256 mismatch
By default, mismatches fail installation. Verify upstream files and hashes first before changing integrity flags.
4) Slow progress / “stuck”
If Content-Length is missing, UI may run in indeterminate mode during download and extraction. Use console logs to confirm active phase.
Configuration (init.lua)
Services.clientAssets supports runtime behavior controls (repository, archive preference, sounds, packaged files, hash strictness, etc.). Keep secure defaults unless there is a specific compatibility reason to relax.
Maintenance Checklist
When changing this system, validate:
- Missing assets prompt appears for modern version.
- Install completes into
data/things/<version>anddata/sounds/<version>. - Runtime loads modern assets from those paths.
- Hash verification behavior matches configuration.
- Windows/Linux CI remains green; Android does not attempt to resolve unsupported libarchive linkage.