Optimize PortMaster low-memory profile
This commit is contained in:
parent
b27883d115
commit
021de5aca4
16 changed files with 327 additions and 31 deletions
|
|
@ -5,6 +5,7 @@ set -euo pipefail
|
|||
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly PROJECT_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
|
||||
readonly TEMPLATE_ROOT="${SCRIPT_DIR}/portmaster"
|
||||
readonly ASSET_PROFILE_SCRIPT="${SCRIPT_DIR}/prepare_portmaster_assets.sh"
|
||||
readonly GODOT_BIN="${GODOT_BIN:-godot}"
|
||||
|
||||
PACKAGE_ONLY=0
|
||||
|
|
@ -86,7 +87,7 @@ if [[ "${NETFISHING_ALLOW_DIRTY_RELEASE:-0}" != "1" ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
for command_name in git file zip unzip sha256sum; do
|
||||
for command_name in git file zip unzip sha256sum rsync; do
|
||||
command -v "${command_name}" >/dev/null 2>&1 || {
|
||||
echo "Required command not found: ${command_name}" >&2
|
||||
exit 1
|
||||
|
|
@ -95,11 +96,39 @@ done
|
|||
|
||||
mkdir -p -- "${ARM64_ROOT}" "${RELEASE_ROOT}"
|
||||
if [[ ${PACKAGE_ONLY} -eq 0 ]]; then
|
||||
readonly EXPORT_PROJECT_ROOT="$(
|
||||
mktemp -d -t netfishing-portmaster-export.XXXXXX
|
||||
)"
|
||||
cleanup_export_project() {
|
||||
rm -rf -- "${EXPORT_PROJECT_ROOT}"
|
||||
}
|
||||
trap cleanup_export_project EXIT INT TERM
|
||||
rm -f -- "${ARM64_EXECUTABLE}" "${ARM64_PCK}"
|
||||
rsync -a \
|
||||
--exclude '/.git/' \
|
||||
--exclude '/.godot/' \
|
||||
--exclude '/art/source/' \
|
||||
--exclude '/art/exported/system_icons/netfishing.ico' \
|
||||
--exclude '/art/exported/system_icons/netfishing_1024.png' \
|
||||
--exclude '/art/exported/system_icons/netfishing_1024.png.import' \
|
||||
--exclude '/audio/ambience/' \
|
||||
--exclude '/audio/music/' \
|
||||
--exclude '/builds/' \
|
||||
--exclude '/docs/design/' \
|
||||
--exclude '/tests/' \
|
||||
"${PROJECT_ROOT}/" "${EXPORT_PROJECT_ROOT}/"
|
||||
"${ASSET_PROFILE_SCRIPT}" "${EXPORT_PROJECT_ROOT}"
|
||||
"${GODOT_BIN}" \
|
||||
--headless \
|
||||
--path "${PROJECT_ROOT}" \
|
||||
--export-release "Linux ARM64"
|
||||
--path "${EXPORT_PROJECT_ROOT}" \
|
||||
--import
|
||||
"${GODOT_BIN}" \
|
||||
--headless \
|
||||
--path "${EXPORT_PROJECT_ROOT}" \
|
||||
--export-release "Linux ARM64" \
|
||||
"${ARM64_EXECUTABLE}"
|
||||
cleanup_export_project
|
||||
trap - EXIT INT TERM
|
||||
fi
|
||||
|
||||
test -s "${ARM64_EXECUTABLE}"
|
||||
|
|
@ -153,6 +182,8 @@ Engine/export template: $("${GODOT_BIN}" --version)
|
|||
Architecture: AArch64
|
||||
Minimum linked GLIBC symbol version: GLIBC_2.28
|
||||
Rendering method: gl_compatibility
|
||||
Texture profile: 128 px maximum; 64 px gameplay catalogs; ETC2 compressed
|
||||
Audio profile: 22.05 kHz mono QOA effects; music and ambience omitted
|
||||
|
||||
The executable and PCK were exported from the release commit listed above.
|
||||
Repository working-tree changes were not included in game content.
|
||||
|
|
@ -187,8 +218,9 @@ selected data root. Device-local configuration remains under
|
|||
\`netfishing/conf/\`.
|
||||
PortMaster launches use the light performance profile by default. Put the word
|
||||
\`normal\` in \`netfishing/conf/performance_profile\` to opt a capable device
|
||||
into the normal rendering profile. See \`netfishing/licenses/\` for bundled
|
||||
credits and license information.
|
||||
into the normal rendering profile. PortMaster packages omit music and ambience
|
||||
in both profiles. See \`netfishing/licenses/\` for bundled credits and license
|
||||
information.
|
||||
|
||||
## Controls
|
||||
|
||||
|
|
|
|||
96
scripts/prepare_portmaster_assets.sh
Executable file
96
scripts/prepare_portmaster_assets.sh
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: scripts/prepare_portmaster_assets.sh <temporary-project-root>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
readonly PROJECT_ROOT="$1"
|
||||
readonly GENERAL_TEXTURE_LIMIT=128
|
||||
readonly GAMEPLAY_TEXTURE_LIMIT=64
|
||||
readonly AUDIO_SAMPLE_RATE=22050
|
||||
|
||||
if [[ ! -f "${PROJECT_ROOT}/project.godot" ]]; then
|
||||
echo "PortMaster asset project is missing project.godot: ${PROJECT_ROOT}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
limit_texture_imports() {
|
||||
local asset_root="$1"
|
||||
local size_limit="$2"
|
||||
local import_file
|
||||
local updated=0
|
||||
|
||||
if [[ ! -d "${asset_root}" ]]; then
|
||||
return
|
||||
fi
|
||||
while IFS= read -r -d '' import_file; do
|
||||
if ! grep -q '^importer="texture"$' "${import_file}"; then
|
||||
continue
|
||||
fi
|
||||
if ! grep -q '^process/size_limit=' "${import_file}"; then
|
||||
continue
|
||||
fi
|
||||
sed -i \
|
||||
-e 's|^compress/mode=.*$|compress/mode=2|' \
|
||||
-e "s|^process/size_limit=.*$|process/size_limit=${size_limit}|" \
|
||||
"${import_file}"
|
||||
updated=$((updated + 1))
|
||||
done < <(find "${asset_root}" -type f -name '*.import' -print0)
|
||||
printf 'PortMaster texture limit %d px: %d imports under %s\n' \
|
||||
"${size_limit}" "${updated}" "${asset_root#${PROJECT_ROOT}/}"
|
||||
}
|
||||
|
||||
|
||||
configure_audio_imports() {
|
||||
local asset_root="$1"
|
||||
local import_file
|
||||
local updated=0
|
||||
|
||||
if [[ ! -d "${asset_root}" ]]; then
|
||||
return
|
||||
fi
|
||||
while IFS= read -r -d '' import_file; do
|
||||
if ! grep -q '^importer="wav"$' "${import_file}"; then
|
||||
continue
|
||||
fi
|
||||
sed -i \
|
||||
-e 's|^force/mono=.*$|force/mono=true|' \
|
||||
-e 's|^force/max_rate=.*$|force/max_rate=true|' \
|
||||
-e "s|^force/max_rate_hz=.*$|force/max_rate_hz=${AUDIO_SAMPLE_RATE}|" \
|
||||
-e 's|^compress/mode=.*$|compress/mode=2|' \
|
||||
"${import_file}"
|
||||
updated=$((updated + 1))
|
||||
done < <(find "${asset_root}" -type f -name '*.wav.import' -print0)
|
||||
printf 'PortMaster audio profile %d Hz mono: %d imports under %s\n' \
|
||||
"${AUDIO_SAMPLE_RATE}" "${updated}" \
|
||||
"${asset_root#${PROJECT_ROOT}/}"
|
||||
}
|
||||
|
||||
# The entire PortMaster project uses a deliberately small, VRAM-compressed
|
||||
# texture ceiling. Fonts are unaffected, preserving readable interface text
|
||||
# while raster artwork is reduced for one-gigabyte shared-memory devices.
|
||||
limit_texture_imports "${PROJECT_ROOT}" "${GENERAL_TEXTURE_LIMIT}"
|
||||
|
||||
# These catalogs contain most of the authored high-resolution textures and
|
||||
# account for the largest runtime residency. At a 640x480 output, 64 pixels
|
||||
# remains sufficient for the deliberately low-fidelity light profile.
|
||||
for gameplay_root in \
|
||||
"art/exported/characters" \
|
||||
"art/exported/environment" \
|
||||
"art/exported/items" \
|
||||
"fish/species" \
|
||||
"gathering" \
|
||||
"items/icons" \
|
||||
"world"; do
|
||||
limit_texture_imports \
|
||||
"${PROJECT_ROOT}/${gameplay_root}" \
|
||||
"${GAMEPLAY_TEXTURE_LIMIT}"
|
||||
done
|
||||
|
||||
# Short speech, call, and gameplay effects remain available, but use a small
|
||||
# mono QOA representation to reduce both package and resident sample memory.
|
||||
configure_audio_imports "${PROJECT_ROOT}/audio/sfx"
|
||||
configure_audio_imports "${PROJECT_ROOT}/sound/dialogue"
|
||||
Loading…
Add table
Add a link
Reference in a new issue