Skip to content

Latest commit

 

History

History
947 lines (801 loc) · 61.3 KB

LINUX_BUILD.md

File metadata and controls

947 lines (801 loc) · 61.3 KB

Build AmiWind on Linux

Last updated with AmiWind v0.0.68-dev7 (22 November 2026).

Contents

Since rc10 the builder can reuse verified NPC models from earlier builds. Full gallery coverage and protected model quality are still required.

The NPC gallery stays in every complete build. Neither the NPC gallery nor the planned static-asset gallery is disabled, reduced or bypassed, and that includes their model and asset generation, catalogue coverage, quality and validation. The only exception is a specific, documented debugging case that the project maintainer has explicitly approved; a builder or contributor cannot approve its own exception. Build time, disk pressure and convenience are not reasons for one. The opt-out flag exists for such an approved debugging case, not as a free choice.

The reason is simple: the complete game needs every NPC and every other game asset, packaged and loadable by the engine. Skipping their creation along with a gallery gains nothing, because the final product needs those assets anyway. An exceptional debug build is labelled incomplete and does not change what the complete game must contain. The engine may load assets on demand, so they do not all have to be in RAM at the same time. The static-asset gallery is planned, not implemented yet.

Disk space comes first. A build needs room for all models and content, the intermediate files, staging copies, temporary images, the final outputs, verification copies and a safety margin. It is worth checking the real output filesystem and any quota before starting. Scratch space in RAM counts against the process or container memory budget; it is not extra disk. If space is short, the fix is more capacity before the long conversion starts, not leaving out NPC models or the gallery.

How much free space a build needs (from v0.0.53). About 58 GiB on the workspace's file system for a first build in a new workspace: the last known good build's measured figure (config/disk-footprint.json, 44.3 GiB for v0.0.52: a 15.5 GiB run folder plus the caches and the storage pool it wrote) plus a 30 % margin. A workspace that already holds a passing build's caches and pool needs only the run's share with the margin, and never less than 35 GiB. Every image build checks this first, right after reading its options and before any setup, copy or stage, and stops with the numbers when a file system is short. Each stage also checks its own last measured need before it starts, so a build stops before a stage instead of filling the disk halfway; free space and resume with --reuse-from. The minimum and the margin are min_free_gib (35) and disk_margin_percent (30) in config/build-defaults.json, or --min-free-gib / --disk-margin-percent (AMIWIND_MIN_FREE_GIB, AMIWIND_DISK_MARGIN_PERCENT). They are machine settings: changing them rebuilds nothing. Every passing build writes its own measured figure to disk-footprint.json in its run folder, and later checks in that workspace take the larger of it and the shipped one. python3 tools/disk_need.py check --workspace DIR prints the need without building.

The guided builder converts a bounded Seyda Neen proof of concept and builds an experimental AGA HDF. It does not convert the complete game or promise stock A1200 performance. The current reference needs 040/FPU, AGA, 2 MiB Chip and 32 MiB Fast RAM (the safe minimum; 16 MiB starts with a warning); see AGA setup and WinUAE.

AmiWind needs your own installed copy of Morrowind, available from GOG or Steam. The Morrowind demo cannot run without data converted from it. An existing installation is fine.

The GOG GOTY edition is the preferred source. The GOG installation used for development includes loose BookArt/*.ttf TrueType fonts, which give the best results when the fonts are rendered at AmiWind's sizes on the PC. Steam GOTY normally lacks those loose TTFs. When they are missing, the builder says so and falls back to Bethesda's Fonts/*.fnt + .tex bitmap fonts. The fallback is supported, but the text may look different, and worse when scaled to sizes other than the original. Preferred edition: https://www.gog.com/en/game/the_elder_scrolls_iii_morrowind_goty_edition.

There is no need to reinstall intact base files. GOG installers are not read directly; AmiWind reads the installed game tree. Tribunal, Bloodmoon and mod load orders are not used. The optional base-game Video/mw_intro.bik and Splash artwork are converted when present.

See installed game layout for the generic GOG directory topology, the master/archive files directly under Data Files/, and the distinction between installed assets and private transfer ZIPs.

Bitmap paper readability (integrated in dev8)

TTF remains the preferred source. When reading pages use the Bethesda bitmap fallback, the approved stronger-coverage candidate is now the default. Dialogue, normal menus and small character/menu text retain their existing coverage.

Use --bitmap-paper-ink original to opt out, or --bitmap-paper-ink filled to select the candidate explicitly. The same setting is available in config/build-defaults.json or an external --build-config FILE.json. CLI settings override the selected JSON, which overrides the shipped defaults. See paper font options. This option changes bitmap reading-page ink; TTF/FNT source selection is automatic and independent of the worker limit.

The exterior world pipeline is --builder chim (the default from v0.0.33, with the CHIM areas Balmora, Seyda Neen and the whole city of Vivec from config/build-defaults.json; name others with one or more --chim-area TOWN) or --builder legacy (every exterior as region maps, as in v0.0.32 and earlier; still selectable and tested). Startup screen: a CHIM build shows "RPG engine powered by CHIM" under the logo, a legacy build the v0.0.32 lines. A CHIM town other than Seyda Neen is made from the game data and the CHIM world (stage chim-town-<town>): no legacy region maps are built for it (CHIM-native areas, the default since v0.0.36); --legacy-area TOWN is RETIRED, for historical regression tests only (refused in developer mode without --override legacy-area; see builder types and retired flags). A CHIM build ships no legacy exterior map of a CHIM area: the image step writes the town's CHIM frame maps, removes its legacy region maps and fails the build if any is still in the image (build.json chim_world.legacy_check). Extra towns that are not CHIM areas (the Vivec Arena preview) are left out of a CHIM image. The open world between the towns was made of the legacy builder's maps until the regional CHIM builds; since v0.0.43 every exterior cell of Vvardenfell is a CHIM frame and no legacy exterior map is left in the image (release notes). A CHIM build with Seyda Neen converts it from your data and checks its frame maps against the converted region maps; from v0.0.35 the recorded v0.0.31 Seyda Neen maps (--seyda-recorded DIR) are optional and NOT RECOMMENDED since v0.0.31 (legacy; the default converts Seyda Neen from your data, and the shipped image holds only the CHIM Seyda Neen frame map). build-state.json chim_plan lists the legacy exterior stages a CHIM plan still runs and which later step reads each one (details: CHIM world format).

Lava pools become Quake liquid by default (--lava quake, config key lava): a warp surface with lava contents, Morrowind's damage and a blood-red view tint, in interior rooms, region maps and CHIM chunks alike. --lava static keeps the earlier rule (rooms leave the pools out, exterior frames place them as solid models). See Lava.

The world map file is written as v2 by default (--world-map v2, config key world_map): the terrain map plus the molten lava pools of the exterior cells, shown on the in-game map (M). --world-map v1 writes the earlier map byte for byte. See World map.

The disk image is laid out compact by default (--disk-layout compact, config key disk_layout): the fewest partitions the payload needs, each sized from its payload plus a fixed free space of 100 MiB (--partition-headroom-mib, config key partition_headroom_mib; the boot partition can keep its own, --boot-partition-headroom-mib / boot_partition_headroom_mib). --disk-layout legacy keeps the earlier layout. See Build output.

World bounds are on by default (--world-bounds on): the sea near the edge of the open world carries the player along it and back in, instead of an invisible wall (an AmiWind extension). --world-bounds off writes nothing and leaves the game as before. See World bounds.

1. Quickest setup and build

From the repository root, run:

./build.sh --autoinstall

Compilation and conversion default to a shared worker budget based on available CPUs, affinity, Linux container quotas and memory. -j 4, --jobs 4 and --j 4 set the budget exactly: every stage, including the final image step, gets those workers, never fewer because of the CPU count. A value above the usable CPU threads runs as requested with one warning. --single-thread or -j 1 runs the serial path. Independent engine, music and dialogue stages can overlap the ordered scene pipeline. Scenery decoding, scene previews and BSP model preparation use separate processes; shared files are assembled in deterministic input order. Census VIS uses the same limit; map lighting runs one thread per map so its output is reproducible. FFmpeg and numerical-library threads are bounded to avoid nested oversubscription. The pinned QBSP and final BSP/HDF assembly remain serial. See parallel build details and verification.

Choose your Morrowind installation. The tool validates its files, discovers existing dependencies, proposes missing packages/downloads with their source links, and asks before installing. It then continues the build in the same invocation. No manual environment activation, SDK path, map-tool path or compiler path is needed for dependencies installed by this setup. APT retains its own confirmation and may require your sudo password.

Tools default to the sibling ../amiwind-tools/: venv/ for Python, sdk/, ericw/bin/ for map tools, and Quake-Tools/qcc-host. Explicit --sdk, --quake-tools and --qcc settings win. At the proposal, choose paths to supply tools already installed elsewhere. --tools-dir relocates managed tools. Existing directories are reused when complete and never overwritten when incomplete. If setup fails, completed installations remain for the next attempt.

For your external test workspace:

./build.sh --autoinstall --workspace ../amiwind-build-test

The easiest way to build and launch the completed HDF is FS-UAE autorun:

./build.sh --autoinstall --autorun-fs-uae \
  --kickstart-file "/path/to/your/kickstart-3.1-a1200.rom"

Replace the example with your owned A1200 Kickstart 3.1 ROM file or a directory containing ROMs. Install FS-UAE so fs-uae is on PATH. Without an explicit path, the launcher checks ~/.roms/kickstart-3.1-a1200.rom, then files directly in ~/.roms/ for the known SHA-256. Directory scans skip subdirectories and symlinks; filenames do not matter. If nothing matches, interactive mode asks for a file or another directory. An explicitly selected ROM with a different hash produces a warning.

These checks happen before setup/conversion. Missing FS-UAE exits with status 1; a missing ROM in noninteractive mode also exits 1 with instructions. The launcher fills both selected ROM and built HDF paths into the generated configuration. The FS-UAE guide includes the exact preset and a command for launching an already-built HDF without rebuilding. No ROM is downloaded.

./build.sh --autoinstall --plan previews dependency setup only, without downloads, installation or conversion. --autoinstall --check may install after confirmation but stops after input/tool checks. Plain ./build.sh also offers setup when run interactively on Linux; noninteractive builds never install unless --autoinstall was explicitly supplied and its confirmation is answered.

Manual or partial setup

On Ubuntu/Debian, preview the guided setup and then confirm it:

./build.sh --install-dependencies --plan
./build.sh --install-dependencies
. ../amiwind-tools/venv/bin/activate

./build.sh --install-sdk independently installs the pinned Linux x86_64 SDK; it also works alongside --install-dependencies. Host setup displays packages, commands and locations before asking [y/N]; APT also asks before installing its resolved packages. Use --tools-dir to relocate the tools. See dependency details and reference versions.

For manual host setup instead:

sudo apt-get update
sudo apt-get install python3 python3-venv python3-pip build-essential ffmpeg unzip xz-utils fonts-dejavu-core libgmp10 libmpfr6 libmpc3
python3 -m venv ../amiwind-tools/venv
. ../amiwind-tools/venv/bin/activate
python -m pip install 'setuptools>=68' 'PyFFI==2.2.3' 'numpy>=1.23' 'Pillow>=9.1' 'fast-simplification==0.2.0' 'scipy>=1.10' 'amitools==0.8.1'

Python 3.10+ is required. The virtual environment defaults outside the checkout; build.sh uses Python from PATH, or AMIWIND_PYTHON when explicitly set. Nothing is installed without confirmation. A managed environment is selected automatically; AMIWIND_PYTHON keeps an explicit interpreter choice until a confirmed setup needs to switch to its newly prepared environment. No game files or ROMs are downloaded.

Windows 11 users: use setup-windows.cmd / setup-windows.ps1 and build.cmd / build.ps1 with the Windows guide. The shared pipeline has completed native Windows conversion, corrected image assembly and WinUAE game entry at the dated checkpoint. Native Windows remains experimental. Docker Desktop on WSL2 has separate build evidence; ordinary Ubuntu-under-WSL2 is still a separately documented trial.

2. External native tools

Install these outside the source checkout and retain their own licence notices:

Tool Reference used by the project What to supply
AmigaPorts GCC SDK v16.2-rc11, compiler 16.2.0b20260825082934, Linux x86-64 Extracted SDK root with bin/ and NDK includes
ericw-tools v0.18.1 Linux Directory containing executable qbsp, vis, light
id Quake-Tools qcc from revision c0d1b91 used in the reference build Compiled host qcc-host executable

For qcc, in an external Quake-Tools checkout's qcc directory:

cc -std=gnu89 -include unistd.h -O2 -fcommon -o ../qcc-host qcc.c pr_comp.c pr_lex.c cmdlib.c

The automatic setup fetches the pinned public source and runs this command for you. On Ubuntu/Debian, sudo apt-get install fteqcc is another option; select it with --qcc /usr/bin/fteqcc. Discovery also recognizes fteqcc on PATH. --autoinstall provisions its managed reference compiler unless you explicitly select another compiler. A new tools directory also gets a fresh Python venv and managed map tools, even when equivalent tools exist elsewhere on PATH. It is reported as an alternative, never as a version match to id's compiler. A temporary compile of AmiWind's own QuakeC checks version 6, system-variable CRC 5927, section bounds and supported opcodes before conversion. This check does not replace a runtime playtest.

The SDK's own vasmm68k_mot (vasm 2.0f, Motorola syntax) assembles the boot check, the FPU support loader and, for the experimental --engine-profile upstream, upstream AmiQuake's 68k assembly (engine profiles); no separate assembler is needed. The engine receipt records its version and SHA-256.

The complete native engine is included in engine/aga/ inside this repository. No upstream engine archive download or patch application is needed. The builder stages these sources into a new separate build directory and records their hashes. The original upstream revision and old patch remain provenance records under docs/aga/; they do not override checked-in source. OpenMW is not a dependency of this current static-scene conversion path.

3. Check, then build

With tools installed, plain ./build.sh prompts for the installation root and discovers managed tools. For an explicit, repeatable invocation:

./build.sh --check \
  --data-files '/games/Morrowind' \
  --workspace ../amiwind-local \
  --sdk /tools/m68k-amigaos-gcc-16.2 \
  --quake-tools /tools/ericw/bin \
  --qcc /tools/Quake-Tools/qcc-host

Remove --check and add --name first-town to perform the build. --plan prints the exact stage commands without running them. --resource-plan prints the memory and threads each stage will need against what the build gets (one line per stage: OK, WILL THROTTLE or WILL NOT FIT, plus an advisory when more memory or threads would help); every build makes the same plan before its first stage and refuses at once when a single unit cannot fit (Resource plan). To keep a build's options in one file and repeat it later, write its recipe with --save-recipe FILE and build from it with --recipe FILE (Build recipes). --check creates no retained build outputs; guided dependency installation is possible only after confirmation. It checks paths, tool versions, source presence, file sizes/SHA-256 and container structure. Referenced asset decoding and native performance require later stages. ffmpeg, xdftool and rdbtool are found on PATH; explicit flags can override them.

If the selected game folder has no core master/archive pair, the tool announces a search through up to four subdirectory levels and 2,000 folders. Directory symlinks are not followed. One candidate is checked automatically; multiple candidates require a choice (or an explicit --data-files in noninteractive mode). Only that installation is inventoried and hashed. Invalid inputs stop before dependency installation. Ctrl+C exits cleanly; if a build stage was running, its log and cancellation receipt remain in the separate output directory.

The full AGA build reports 23 stages, including both towns and their interiors, world terrain, character assets, audio, native compilation and HDF assembly. Independent stages can overlap within the shared worker budget. It stops at the first failed stage and records the command, timing and log path in ../amiwind-local/build/first-town/build-state.json. Stage logs are in logs/. A failed build also writes FAILURE.md (and the same as data in failure.json) in the run folder, the one failure page, and prints it at the end of its output: first what to do now (the block the build also ends with: what now), the failure's kind when it ran out of memory or disk (below), then the failed stage, its exit, its error lines, the traceback (a stage's own Python process prints the traceback of the error it stops on into its log), the last 60 lines of the stage's log, what was not completed (the stages not started or cancelled with it, the units it refused or left out), the settings the build ran with (its options as given, build-recipe.json with every option's value, the builder and its masters, the data folder, the AMIWIND_ settings the failed stage read), the run's commit, the name of the full build report (below) and the command that builds again from the run with --reuse-from. After the page, one line names it (Failure details: .../FAILURE.md) and the block of what to do now comes last, as the build's very last lines. The Toolkit Monitor links it under Progress (Monitor). python3 tools/build_failure.py RUN --print writes the page again for a failed run, an earlier builder's included; --out DIR writes it into another folder and only reads the run (a run on a read-only volume). Output HDFs are under that run's image/ directory. Original files are read in place. The default output parent is ignored out/ in the checkout; the explicit --workspace ../amiwind-local above selects an external parent instead. Neither location is included in source packages. Each build uses build/<name>/.

Each run name is immutable. To retry, fix the reported dependency or conversion problem and build again in the same workspace: a run without --name gets a new name by itself (-try2, ...), and the default reuse below takes every stage the stopped run passed (with --name, choose a new name). Preserve a successful image before experimenting. Disk conversion can be slow and requires space for the installed inputs, SDK, intermediate scenes, staged payload and final image at the same time. Keep build runs outside the source checkout and allow several times the final payload size; see storage profiles.

A build in a workspace that holds earlier builds skips the work they did, by default: after git pull, run the same command in the same build folder and only what changed is made again; every reused file is checked by its SHA-256. Its first minute lists each stage with the earlier build it comes from (version and date) or why it is made again, a terminal is asked once (... Reuse them? [Y/n], Enter or no terminal = yes), and its start and its end summary say how many stages and units came from earlier builds. If something in the game then looks wrong or unstable, build once from scratch in a new build folder, ./build.sh --clean --workspace ../amiwind-clean with the options you build with. --no-reuse runs every stage again for one build. See reuse earlier builds by default. --reuse-from OLD_RUN copies the unchanged stages of one named earlier run, and --prerendered DIR keeps finished CHIM worlds, interiors and region maps in a store folder by version and area and uses them in any later build whose stage fingerprints match. Both verify every copied file; release candidates and finals reuse like development builds unless --release-from-scratch is given (--clean is the from-scratch check). See Speed.

For a smaller host-only terrain test with no native toolchain:

./build.sh --stage terrain --data-files '/games/Morrowind' --name terrain-test

This produces verified terrain packets, not an Amiga executable or HDF.

Early checks

Checks of seconds run before the first stage, so a stop a stage or the image step would meet hours into the build shows in its first minutes: the build preflight (cache owners, game data, town budgets, the grounding classes of the towns' and rooms' residents) and the builder's registered early checks (EARLY_CHECKS in tools/build_preflight.py). Those run in two phases: inputs with the preflight (the game data, the selected masters, the options) and stored after the reuse plan, on the stored outputs the build reuses; --check runs both. Every check of a phase runs, each prints one line (Early check NAME (PHASE): ok or its problems and its time), and the build stops once with every problem listed. A third phase, after:STAGE, runs a check the moment that stage has passed in the build, on its output, and stops the build before the stages after it (the stage stays passed, so a build again takes its output). The image step's actor frames check runs this way on the room batches' own output (tools/image_early_checks.py): before the first stage when the room batches are taken from an earlier build, right after them when the build makes them, so a room actor whose frames the image would refuse stops the build in its first minutes, not at its end. The outdoor creatures' models run the same way on the actor library's own output (tools/actor_early_checks.py): every creature the base game places outdoors and every outdoor levelled list must give a creature with a model, since the game spawns no creature without one. Seyda Neen's CHIM frame is compared with its town the same way (tools/seyda_early_checks.py): its placements, predicted from the inputs the world stage reads (the scenery selection, the tutorial barrel and the containers that open), go through the Seyda Neen town stage's own comparison with the town's statics right after the bsp stage (or before the first stage when that stage is taken from an earlier build), in about five seconds, instead of failing that town stage after the world. The shared-sky check runs right after the image step (tools/frame_sky_check.py, phase after:image): every CHIM frame map the image step wrote must name the shared exterior sky in its worldspawn (_aw_sky_mode exterior and _aw_sky_asset gfx/aw_shared_sky.lmp, as the open-world worldspawn is written), or the build stops before it is called passed; a frame map without them would show black instead of the sky. A new check is a module of its own whose function takes the build's context and returns its problems (it never exits), plus one line in EARLY_CHECKS.

When a build fails

A failed build writes one report, logs/BUILD-REPORT-<run>.txt in the build workspace (beside build/, so out/logs/ by default), and prints where it is. It is the one file to send when you ask for help:

  1. what failed: the stage, its exit and time, its error and the unit or map it names, the units it refused, the stage's command, the traceback and the last 200 lines of the stage's own log (or the builder's own error when it stopped before a stage);
  2. every build option with its value and where it came from (the command line, a recipe, set by the builder, or the default), every AMIWIND_ setting with where it came from (set before the build started, the builder's defaults, or set by the builder from the options), and the settings the failed stage reads;
  3. the versions: VERSION, CHIM_VERSION, the source commit and any local changes, Python, its packages and every tool against the recorded reference, and whether the build ran in a container;
  4. the game data: each master and archive with its size, SHA-256 and the known copy it matches, so two copies of the game are told apart;
  5. the machine: operating system, cores, memory, swap, the memory peaks (the build's own beside the memory it had, and the failed stage's with its largest process) and the free space of the workspace and the temp folder;
  6. the stage plan with each stage's state, time and workers;
  7. the reuse state: the reuse source, the stages reused, the stages not reused and why, the reuse stops.

Under its result line come the block the build printed last (what now) and a short environment summary: the operating system and its release, whether the build ran in a container, Python against the recorded reference version, the cores, the memory, the swap, the memory peaks and the free space. Memory is read on Linux (/proc/meminfo), macOS (sysctl hw.memsize and vm_stat) and Windows (the system's memory status); the swap on Linux (/proc/meminfo SwapTotal and SwapFree, and a container's own swap limit), macOS (sysctl vm.swapusage) and Windows (the page files: the commit limit less the physical memory); the report says Not available only where nothing answers. Every build prints the same summary, without the peaks, before it records its inputs, so a build that is ended without a report still shows in its log what it started with. The container line says what was checked and what each check found. Our builder image carries its own mark, AW_RUNTIME with the image tag in AW_RUNTIME_IMAGE (set by the image, by tools/run_docker.py and by the master builder), so a build there reads yes (our builder image TAG). Otherwise the line names the signals container engines leave (/.dockerenv, /run/.containerenv, the container variable, the first process's control groups, an overlay root folder). With none of them it lists what it checked, because finding no signal does not prove there is no container. The mark has no AMIWIND_ name on purpose: every AMIWIND_ setting a stage can read is part of that stage's key, so such a mark would key a build in the image apart from the same build outside it.

When the failure carries the marks of running out of memory or disk, the report (right under its result line) and FAILURE.md (right under the block of what to do now) name its kind: OUT OF MEMORY (a stage or worker ended by signal 9, exit -9 or 137, a process pool whose worker was ended, MemoryError, errno 12) or OUT OF DISK (errno 28 "No space left on device", errno 122 "Disk quota exceeded"), as proven or likely, not proven, with what was found and what to do. MemoryError and the two disk errors prove their kind; inside a container, so does the memory controller's kill counter (oom_kill in the control group's memory.events) when it rose between the build's start and the failure, and when it did not rise an out-of-memory hint is reported as not proven. An out-of-disk failure shows the free space of the workspace and the temp folder at the start and at the failure. What to do for each kind, and why the same command in the same build folder continues the build: the next section.

The report stays on your computer; nothing is sent anywhere. It holds no environment value other than the AMIWIND_ settings, the build options, the builder image's mark and the container variable; paths in the workspace are written relative to it, paths in the source checkout start with <source> and your home folder is ~. --report writes one for a passed or cancelled build too, and for a --check or --plan that stops on an error (without it those write nothing). FAILURE.md in the run folder is the failure page the Toolkit Monitor shows and names this report; a build that stopped before it made its run folder has only the report, and the line before the block of what to do now names it.

The build stopped or ran out of memory: what now?

Do not start over, and do not delete the build folder. A build that stops (out of memory, out of disk, a stage's error, Ctrl+C, the machine switched off) keeps what it finished: every stage that passed, and inside the stage that stopped the units it stores as it goes (a room, a world frame, a character), in the build folder (the workspace, out/ by default). From v0.0.68 the CHIM world's source catalogues of its areas and the room batches' residents are kept as they finish too, also when the stage runs again in a new run folder; the CHIM world's assembly of its areas in its main process still runs again in full; that is being fixed (BUILD-TESTER-32GB-OOM-67).

  1. Fix the cause when the build names one (below).
  2. Run the same command again, from the same folder. A build in a build folder that holds earlier builds takes every finished stage back by default (from v0.0.67; in a terminal it asks once, ... Reuse them? [Y/n], and Enter or no terminal means yes), and a stage that runs again takes its finished units from the build cache; every file taken back is checked by its SHA-256. If you gave the stopped build a --name, leave it out or choose a new one: a run name is used once.
  3. With v0.0.66 or older, add --reuse-all-available to the same command, or run the --reuse-from line at the end of the stopped run's FAILURE.md.

--clean, --no-reuse and a new --workspace start from nothing: they are for a deliberate from-scratch build only.

From v0.0.68 a failed build ends with a block that says this for its own stop, with the command ready to copy; the same block opens FAILURE.md and the build report. A stop of the CHIM world stage in a container limited to 32 GiB:

========================================================================
THE BUILD STOPPED in the stage chim, after 6 h 30 min: OUT OF MEMORY (likely, not proven).
  The stage reached 25.1 GiB; one process of it (its main process, as a rule) held 24.1 GiB of that
  (measured in this build).
  This build had 32.0 GiB of memory (the container's limit) and no swap; its peak: 31.6 GiB, with
  chim, chim-room-batches running.

Your finished work is kept: do not delete the build folder. Run the same command again,
from the same folder; every stage and unit that finished is taken back (each checked by SHA-256):

  ./build.sh --data-files /games/Morrowind --workspace ../amiwind-local

Before you run it again:
  - Fewer workers (-j) do not help in this stage: one process holds most of its memory.
  - Add swap (about 16 GiB or more), or give the build more memory (the memory limit of its
    container or virtual machine: Docker --memory and --memory-swap, WSL 2 memory= and swap= in
    .wslconfig), or close other programs.
  - ./build.sh --resource-plan with the same options lists what each stage needs against what the
    build gets.
Build report (the one file to send when you ask for help): ../amiwind-local/logs/BUILD-REPORT-<run>.txt
Help: docs/LINUX_BUILD.md, "The build stopped or ran out of memory: what now?"
========================================================================

Out of memory. What helps depends on where the stage's memory was; the block says which, from what this build measured (else an earlier build of the same build folder, else the reference figures in config/build-memory.json):

  • In its workers (most stages: the room batches, the actor library, the image step): about half the workers, -j N; the block prints the command with N filled in. If it stops again, swap or more memory as below.

  • In one process (the CHIM world stage, chim, holds the whole world in its main process): fewer workers do not help. Add swap or give the build more memory.

  • Swap on Linux, for example a 16 GiB swap file (swapon --show and free -h show it; a line in /etc/fstab keeps it after a restart):

    sudo fallocate -l 16G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile
  • In a container or a virtual machine the build has the memory given to it, not the machine's: Docker --memory (with --memory-swap for swap; Docker Desktop: Settings, Resources), WSL 2 memory= and swap= in the .wslconfig file in your Windows user folder, then wsl --shutdown. The build report's Memory line names the container's limit when there is one.

  • Before you start, ./build.sh --resource-plan with your build's options prints, without building anything, each stage's measured need against the memory and threads the build gets (OK, WILL THROTTLE), and one WARN memory plan: line for each thing it changes for the memory: stages run one after another, fewer workers, a stage that needs more than the memory (it runs anyway, with the swap counted). A real build prints the same at its start and lists the lines in build-summary.md; it is never refused for memory.

What a whole build needs, measured in the v0.0.66 from-scratch build of the whole game (config/build-memory.json): its memory in use peaked at 43.7 GiB, the file cache not counted, while the CHIM world stage and the room batches ran side by side. The largest stages:

Stage Peak Largest process Workers Time
actor-library 27.0 GiB 1.5 GiB 10 2 h 22 min
chim (the CHIM world) 25.1 GiB 24.1 GiB 10 6 h 31 min
image 18.7 GiB 9.0 GiB 20 50 min
chim-room-batches 17.4 GiB 1.8 GiB 20 9 h 20 min
chim-interiors 8.9 GiB 3.8 GiB 20 4 min

From v0.0.68 the builder runs two stages one after another when their measured peaks do not fit the memory it has and one of them holds its memory in one process (the CHIM world stage beside the room batches with 32 GiB), and says so in a WARN memory plan: line at its start; a first build plans with these figures. Stages whose memory is in their workers still run side by side, each with fewer workers. The CHIM world stage alone still needs about 25 GiB: below that, add swap.

Out of disk. Free space on the disk of the build folder: python3 tools/build_gc.py plan out lists what can go and deletes nothing (--delete removes exactly what it lists as expired; see free disk space). When the temp folder is the full one, point TMPDIR at a folder with room. A --workspace on another disk starts that folder empty.

The whole build was ended (the terminal shows Killed, the machine restarted, the container was stopped): no failure page is written then, and the same command, from the same folder, still continues the build. The first lines of the build's output show the machine it started with (cores, memory, swap, free space).

What to send when you ask for help: logs/BUILD-REPORT-<run>.txt from the build folder. Without one (the whole build was ended): the end of the build's output and its first lines, the AmiWind version or commit you built, and the memory the build had (the machine's, or the limit of its container or virtual machine).

4. Boot your private image

Use the generated RDB HDF with the documented emulator settings. Provide a suitable licensed Kickstart ROM, available through Cloanto / Amiga Forever. No ROM or Workbench files are copied into the image, except an FPU support library you select yourself with --amiga-libs (FPU support library). A ROM is needed to boot in an emulator, not to compile the source. The experimental AGA runtime requires Kickstart 3.x; the preserved A500 branch has separate Kickstart 1.3 instructions.

Do not publish game-containing HDFs, converted audio, textures, meshes or game records. The selected README screenshots are a specific documentation exception. They remain derived game content. The source release contains source and documentation; the separate asset-free dry-run image contains only compiled code and original notice text. Dev7 runs AmiWindCheck first, keeps a successful report visible for up to five seconds (Space/Enter skips), then shows the original dry-run notice; see content policy.

Rebuilding only the first NPC slice

After generating a matching bsp-scene, the guided AGA build automatically runs tools/prepare_npcs.py into a separate npc-scene. To repeat that stage manually:

python tools/prepare_npcs.py --data-files '/external/Morrowind/Data Files' \
  --scene /external/run/bsp-scene --out /external/run/npc-scene-new

The output includes private models, skins, sound, response text and actor IDs. Do not publish it. Existing outputs are never overwritten. Run tools/prepare_hands.py on this NPC scene, then use the resulting hands scene as input to tools/prepare_interior.py, then pass that interior output to tools/build_aga.py image; old checkpoint-011 scenes must be rebuilt for the new standing hull. Installed PyFFI, NumPy, SciPy, Pillow, fast-simplification and ffmpeg are required; the earlier installation command includes them.

Checkpoint-014 also exports an ordered private voice lookup beside the stages; it is not loaded by the runtime yet. Manual NPC/hands/lookup commands are in AGA_BUILD.md. All original/converted models, voices and lookup JSON remain outside public source.

Repeatable conversion choices

Use a fresh --name for each candidate. --hands 3d (default) and --hands sprites select separate native builds; sprites currently cover Nord unarmed motions only. The private build-state.json identifies the recipe, mode, commands, tool/source checksums and checksums of all installed input files, including loose files. Hashing runs once before conversion and may take time on a large installation. Do not change source files or tool binaries during a run. The receipt aids reproduction; it is not a hermetic environment or a promise of byte-identical HDF timestamps. See CONVERSION_RECIPES.md.

World map and journal assets

The native image stage now prepares the on-demand world map and journal catalogue from --data-files, after the final UI palette is established. This terrain-only path does not run the full scenery-density survey. If original inputs are omitted, a matching converted id1/world directory and receipt must already exist. The image builder rejects stale palette/content hashes. These four world/journal assets participate in the save-content fingerprint.

Night lighting tables

After the final map optimisation the image stage writes three tables into the boot image's id1/world/, the ones the engine reads for night lighting:

File Contents Made by
lamps.awl Every exterior lamp, torch, fire and candle of your own Morrowind.esm, by cell, with its colour class (AWL1) tools/light_sources.py lamp-table
night-windows.txt Per town map, the textures of window and lamp glass that glow at night tools/night_windows.py
fog-locations.txt Per place day and night fog distance (dbg fog location, on by default; the HUD title's place or region, or the map) validated copy of config/fog-locations.txt
large-rooms.txt Large interiors that fade into fog at the draw distance and draw nothing past it validated copy of config/large-rooms.txt (rooms chosen by size with tools/large_rooms.py)

Beside them the image step writes region-draw.txt: the draw distance by region that Options > Video > Fog distance auto uses (300 everywhere but the listed regions), from config/region-draw-distance.json by tools/region_draw.py, each row under the region's index in the image's own region catalogue (region-names.awn, from the same game files; a region your game files lack is left out and named in image/region-draw.json). A row in state trial (Solstheim's regions at 540, until the frame rate on real hardware is measured) applies only with dbg fog region trial on.

The window table traces the final maps' textures back to the scenery they were converted from: --balmora-scenery (Balmora cache scenery/, default --balmora-cache/scenery), --town-scenery (Seyda Neen prepare_scenery.py output, default the directory of --town-flora-source-index), the scene's opening-barrel-source and the --world-flora overlay. The guided build passes all of them (--world-flora unless --no-tree-sprites). A source that was not given is skipped and listed in image/night-lighting/night-lighting.json and in build.json (night_lighting, status partial); a town without its own scenery gets no window line, so its glass stays dark instead of being guessed. Each table is checked against the engine's format before it is written, and all three participate in the save-content fingerprint. The per-map window report is image/night-lighting/night-windows-report.json.

Run the separate world survey for cell-density analysis and the private atlas/terrain mesh. The usual production ground-contact gate still applies; the diagnostic RC4 package does not turn its 23 open findings into a passed production build.

Completion summary

The builder prints start/end dates with timezone offsets, total build time, compiler-warning lines, output filename, GiB/bytes and SHA-256 inside terminal-width rules. Success is printed only after the stages and final output hashing pass. The same information is saved in the external run's build-summary.json. See timing boundaries, warnings and failures.

NPC gallery default

Normal game builds MUST include the NPC gallery. Do not silently skip it for conversion time, disk size, missing inputs or an earlier build's omission. All original NPCs/creatures and their required assets must be available to the engine for a complete game; the gallery provides required inspection/regression access. Missing gallery content fails the default build. See the explicit build contract.

Normal AGA builds include the original NPC/creature inspection gallery for dbg npcgallery, debugging and regression checks. Missing required gallery files fail the build. Use --no-npc-gallery only for exceptional, explicitly requested debugging that requires isolating the gallery; this choice is recorded. Gallery conversion does not require recompiling retained terrain. See gallery build details.

A build made with --no-npc-gallery tells the player so: the image carries the marker id1/npc-gallery-disabled.txt (also named in build.json under npc_gallery), and every way into the gallery from the F10 console (dbg npcgallery, dbg gallery, dbg modelgallery, dbg combattest, dbg torchtest npc ...) prints instead:

This build was made without the NPC gallery (quick playtest build).
To include it, build without --no-npc-gallery.

dbg help (and dbg help <word>) lists those commands with "(not in this build)". Normal builds have no marker and behave as before.

Warning: gallery omission is for debugging builds only. All NPCs and their required assets remain necessary for a complete game. --no-npc-gallery skips inspection-only conversion/packaging; it must never remove world NPC placements, models, dialogue or other gameplay dependencies, or be advertised as a complete content profile. Normal builds include the NPC gallery for debugging and regression inspection. This requirement does not claim that every original world NPC has already been converted or placed by the current demake.

World flora default

Normal AGA builds make the world flora: the original trees, grass and reeds as sprites with collision (world-flora-assets and world-flora stages, then the image's --world-flora overlay for the world and both towns). Every release since v0.0.28 ships them. --no-tree-sprites leaves them out for debugging only: the builder prints a warning, build-state.json and build-summary.json record world_flora as disabled by --no-tree-sprites, and the image does not match a release. Maps that place flora (such as Seyda Neen maps reused from a release) then stop the image step with "World flora was not built". --tree-sprites, the old opt-in, is still accepted and has no effect. The measured Balmora layout repair (--balmora-cache) runs in every AGA build, with or without flora. Asset-free --dry-run and --stage terrain builds make no flora. tests/test_build_defaults.py fails if a feature the release ships leaves the default build.

Harvestable mushrooms default

Normal AGA builds make the harvestable mushrooms (shipped since v0.0.29): the harvest stage (tools/harvest_build.py prepare) converts every exterior small-mushroom model once into a shared model, against the palette the image ends with, and records every original placement. The image step (--harvest) then works on the maps it ships: it removes mushrooms a converter baked into a map (Balmora) where a harvestable one goes, writes one catalogue per map that covers plants (world maps from world/regions.awr, the Seyda Neen and Balmora sub-cells from their region tables, the intro docks), runs the geometry gate on the final maps and admits a map only when the repository heap check passes with its catalogue. The mushrooms inside the shipped interiors get a catalogue of their room too, on the same pick state as the outdoors (since v0.0.47; --harvest-interiors off keeps them baked). Details: EXTERNAL_HARVEST_MODELS.md. --no-harvest leaves them out for debugging only (a warning; build-state.json records harvest as disabled by --no-harvest; mushrooms stay baked and cannot be picked), and the image does not match a release.

Shipped towns default

Normal AGA builds import every town after Seyda Neen and Balmora that a release ships: the rows of config/towns.json with shipped_since and no withdrawn reason, one town-<id> stage each, right after Balmora's interiors. The Vivec Arena preview (shipped since v0.0.32) is withdrawn from v0.0.33 by maintainer decision (CHIM-ARENA-MEMORY-33), so a default build no longer imports it; --extra-town vivec_arena still builds it. --extra-town <id> adds a town that is not shipped (or is withdrawn); naming a shipped town there has no effect. --no-extra-town <id> (a shipped town) and --only-core-towns (Seyda Neen and Balmora only) leave towns out for debugging only: the builder prints a warning, build-state.json records the selection in extra_town_selection, and the image does not match a release. Contradictory town options stop the build before any work. Details: TOWN_IMPORT.md.

Which Seyda Neen is in my build?

  • CHIM builds (the default): the Seyda Neen you play is the CHIM version, maps/seyda-chim.chim (a CHIM map, not a Quake .bsp: file types) with its far layer seyda-chim.far, converted by the CHIM builder from your own Morrowind data files (Morrowind.esm and the BSA archives). It is the only Seyda Neen in the image; the shipped v0.0.34 image holds none of the 66 recorded v0.0.31 maps.
  • The check reference: to check that conversion, the build also converts Seyda Neen the legacy way (region maps) from the same data and compares the two. Those region maps are only a check reference and never go into the image.
  • Until v0.0.34 that reference was the recorded v0.0.31 maps (--seyda-recorded DIR). From v0.0.35 the reference is the fresh conversion from your data, so no recorded files are needed. --seyda-recorded stays optional and is NOT RECOMMENDED since v0.0.31.
  • Legacy builds (--builder legacy): Seyda Neen ships as the legacy region maps. The builder converts them from your data with the terrain visual cull, which does not finish from scratch today (BUILD-SEYDA-CULL-STABLE-32), so a legacy build with Seyda Neen from scratch stops there; with --seyda-recorded DIR it installs the recorded v0.0.31 maps instead and ships them byte for byte.

Game heap size

The game heap (Quake's Hunk: maps, models and the CHIM zone) is 11 MiB by default, which is the size measured to start the game on 16 MiB of Fast RAM; 32 MiB is the safe minimum for the whole game. --heap-mb N (or "heap_mb": N in a --build-config file; the command line wins) builds with exactly N MiB, like --jobs N: it is never refused. Above the size measured to start on 16 MiB of Fast RAM (11 MiB), the build prints one warning and records it in engine-build.json (heap_mb, heap_mb_selected_by, heap_warning), the boot check prints a Game heap: ... [!] WARN row, and the engine says so at start. The boot check asks for the heap plus 3 MiB of free Fast RAM, and the heap plus 16 bytes in one block. The map heap gates measure against the build's own size. The start argument -heapmb N overrides the built size for one start, with the same warning. What the heap holds, the measured figures per map and what 12 MiB costs: chim/build_guide/MEMORY.md.

NPC model levels of detail

A resident is baked once per appearance, not once per actor: actors with the same appearance share one model, found in the cache by the digest of that appearance. With --npc-lod on, every appearance is baked at several levels of detail from the same recipe and the same animation frames, and the engine draws each actor with the level its distance calls for (NPC model levels of detail):

The defaults are config/build-defaults.json (npc_lod, npc_lod_levels, npc_face_lod, npc_lod_disk_mib): the levels stay off until they have been compared in game, and turning them on by default is a change of that file. A --build-config file overrides it, the command line both.

Option Values Default
--npc-lod on, or off for one model per appearance (the earlier method) off
--npc-lod-levels 2 (near + the map's own model), 3 (+ mid distance), 4 (+ crowds far away) 3
--npc-face-lod which residents may use the near level: all, measured, named, or list with --npc-face-lod-list FILE all
--npc-lod-disk-mib disk for the level files (not the map models): coarse levels first, then near levels by head detail lost, until this many MiB 96

The map's own model (level 1) is the earlier single model, byte for byte; the other levels go to progs/l0/, progs/l2/ and progs/l3/, listed in progs/npc-lod.txt. python3 tools/npc_lod.py check ID1 checks a staged id1: every level present, with the map model's frame list. On development builds the resident bakes are kept in the asset pool (WORKSPACE/cache/asset-pool-v1), so a rebuild reuses every level whose inputs did not change.

Disk layout limits

Every image the builder writes (full, MiniWind, release candidates and finals) passes one disk-layout gate in the image step, for every drive: each partition starts below 2 GiB of its drive (Kickstart 3.1 does not mount a partition that starts later) and is below 2 GiB, each file is below 1 GiB (well under the 2 GiB file limit of the Amiga file system), and each drive image is below 4 GiB. A violation stops the build with the drive, partition or file, its offset or size, and the limit; the measured layout is recorded as disk_layout in the image's build.json. build.sh, build.cmd and build.ps1 all run it, since they run the same image step.

The gate runs twice. First on the plan, before anything is written: each world partition before its files are copied into it, then every drive (partition sizes, their offsets and the drive size, exactly as the drives will be written) before the boot partition or any drive image exists, so a layout over a limit costs no image writes. Then again on every drive as written and read back. The asset-free --dry-run boot-notice image passes the same gate after its partition table is read back, and its dry-run-build.json records disk_layout too.

To check the gate itself, run the self-test (no game data, a few seconds):

python3 tools/build.py --layout-selftest

It sends dummy payloads through the image step's own packing code and expects a refusal, with the matching message, for a 2.5 GB file, a 2048 MiB partition, a partition starting past 2 GiB and a drive over 4 GiB. The last two force a drive grouping the packer never makes, and the self-test also checks that the packer's own grouping keeps those partitions legal. A layout just under every limit (a file of 1 GiB minus one byte, 1920 MiB partitions, a partition starting at 1920 MiB + 32 KiB, a 3840 MiB + 32 KiB drive) must pass, and a tiny payload is written end to end (partitions, drive, readback, gate). The dummies are sparse files: several GiB in size, almost nothing on disk, never read, because a refused plan stops before any image is written. They live in one scratch folder that is removed on success, failure and Ctrl-C, and the run ends with Disk layout self-test: cleaned N dummy files. The end-to-end case needs xdftool and rdbtool and writes about 256 MiB for a few seconds; python3 tools/layout_selftest.py --no-write skips it, and --scratch DIR picks the scratch parent. The test suite runs the same self-test (tests/test_layout_selftest.py).

MiniWind playtester build

--miniwind selects the build type AmiWind "MiniWind" Playtester Build: a quick PARTIAL-AREA test of Balmora only (the Balmora exterior on CHIM, the Balmora interiors, engine, menus, UI, audio, fonts and music) that boots straight into Balmora. Private -devN versions only, never a release; --miniwind-description TEXT adds a "Scene:" line to the startup screen. Overview: MiniWind: the test ground; build type reference: MINIWIND_PLAYTESTER.md.

Timing: a MiniWind build is meant to take minutes when it reuses a full build (--reuse-from). The stages its quick test exclusions change (intro, media, census and what depends on them) run again; their per-file caches are read from the reused run's workspace when the build has its own workspace, so a sound or movie converted once is copied, not converted again. Measured cases and the remaining causes of slow MiniWind builds: BUILDER_PROFILE.md and MINIWIND-NOT-MINUTES-33 in the bug register.

Quick test builds

A development build (VERSION such as 0.0.33-dev1) can leave whole content groups out to reach a playable test image sooner: --exclude GROUP[,GROUP...] or one option per group.

Group Option Skips In the game
video --exclude-video the media stage's videos and the intro movie New Game goes straight to the ship
music --exclude-music the music stage and the soundtrack silence, one console line
voice --exclude-voice the recorded dialogue library (Sound/Vo) greetings and the intro lines stay
npc-gallery --exclude-npc-gallery (or --no-npc-gallery) the NPC gallery stage the gallery commands say it is not in the build
interiors --exclude-interiors the Seyda Neen and Balmora room compiles house doors say "Area unavailable"
harvest --exclude-harvest (or --no-harvest) the harvest stage mushrooms stay, but cannot be picked
unreferenced --exclude-unreferenced [GROUPS] area builds only: what the area does not reference only the area's NPCs, voices and sounds

Every build's stair walk walks only the steps of flights (the rows that can stop the build; since v0.0.46, before only in release candidates and finals); --stair-walk all walks every step and ramp too (nightly or beta reports). The places of the stair watch list (config/stair-watch.json) are walked again on every build, and --stair-walk-places ID,... walks only the named places (development builds; see docs/BUILD_PROFILE.md). A build from your own copy of the game takes the known-good stair records shipped with the source (config/stair-records/, --stair-walk-cache records, the default without --developer-mode): a CHIM frame whose collision has the SHA-256 recorded there is not walked; a frame whose collision differs (another converter, other game data) is named in the log and walked only on request (--stair-walk-cache cached). In development builds (--developer-mode) a map or CHIM frame whose collision is unchanged is not walked again: its stored result is reused (--stair-walk-cache cached; a few are walked again on every build to check the cache, --stair-walk-sample N). Only a result checked by a build of the master builder that passed every gate is reused; the log names the run it comes from. --stair-walk-cache full walks everything again, for regression and beta-test runs only. A CHIM region frame walks only the cell it owns plus the map-switch margin; its border copies of other cells are walked where they are owned (--stair-walk-area owned, the default; frame walks the whole frame as before v0.0.42). With --allow-release-reuse, release builds also reuse the image step's per-map pass results, and each pass receipt counts its hits; the from-scratch reference build is then compared file by file with the release payload. Details: BUILD_PROFILE.md.

Each exclusion applies before the work: an excluded movie, voice or sound is never read or converted (a Balmora MiniWind imports 4,875 of the 7,164 sounds: the referenced voices and the effects).

Dressing, flora and every other object with collision always stay. The image is named ...-quick-test.hdf, the receipts record the groups, and the game says "This build was made without ... (quick test build)." where it would notice. Release candidates and finals refuse every exclusion. Measured savings, the reference closure and its receipt: the CHIM build guide, page Quick test builds.