# Deviations and unported pieces Generated by `tools/triage/deviations.py` from comments in the Rust sources; edit the comments, not this file. Each entry is a known place where the port differs from the original or stops short of it. Deviation: 86, Not ported: 7, Not traced: 1. ## `apps/game/src/app.rs` - [Deviation] [apps/game/src/app.rs:121](../apps/game/src/app.rs#L121): The display modes of the window's monitor, largest first (`Adapter::FindDisplayMode` lists). Deviation: the browser offers the page's size at 100, 75 and 50 % (the scene is drawn at that size and scaled to the page, `Renderer::set_scene_scale`) and frame-rate limits of 30 to 120 per second (issue #15). - [Deviation] [apps/game/src/app.rs:217](../apps/game/src/app.rs#L217): Deviation: in the browser, Fullscreen asks the browser to show the page full screen (winit waits for the next click or key if the browser needs one) instead of changing the display mode. ## `apps/game/src/app/handler.rs` - [Deviation] [apps/game/src/app/handler.rs:57](../apps/game/src/app/handler.rs#L57): Deviation: in the browser the "desktop" resolution, which an unset or unknown resolution falls back to (`GetDefaultResolution`), is the page's full size: the 100 % entry of the Resolution list, as the scene is drawn without a setting. ## `apps/game/src/audio/ambience.rs` - [Deviation] [apps/game/src/audio/ambience.rs:1](../apps/game/src/audio/ambience.rs#L1): Map ambience placed by `FUN_1400a57c0` (see docs/STARTING-AUDIO-EMITTERS.md, docs/AUDIO.md): - one `Audio/Effects/Environment.rsc:ambient` per `int_150`-cell square region. Its AmbientEnvironmentComponent (`FUN_140043c70`) weighs the region's cells against the description's terrain classes (cell-type mask, optional entity template, weight), picks the heaviest, and feeds its warm and cold effects to the two emitter slots at `t` and `1 - t`, where `t` is the temperature's place in the description's fade range; - one `Audio/Effects/WindEffect.rsc:ambient` at height `float_170`. Also the Rain effect's emitter (`FUN_140099790`) and the emitters of placed entities whose template has an `ambientemitter` component (fire, crowd, tornado). Emitters of the same SoundEffect share one 3D effect (`FindEffect3D`, `AddEmitter`), which plays at the loudest emitter in reach. Deviations: the original registers these as entities in the entity manager (bucket 2 for the environment); the port keeps them as an audio-only layer and re-weighs a region when the map changes instead of on its scheduled visit. River emitters: one `Audio/Effects/RiverEffect.rsc:ambient` every `float_130` units along the river paths (MapComponent `+0x1e0`, see `World::river_paths`). ## `apps/game/src/frame.rs` - [Deviation] [apps/game/src/frame.rs:1](../apps/game/src/frame.rs#L1): The game as the kernel of GameFrame's frame (`unbanished --frame-io`), the launcher that `apps/frame` opens (docs/develop/FRAME.md). The frame shows the player's choices; the kernel turns them into a [`Launch`]: which machine, which copy of Banished, sound on or off. [`link`] speaks GameFrame's JSON lines on standard input and output and runs one game per program; the frame starts the program again for the next game. Deviation: the frame is an addition the original does not have. It reaches the game only through the launch, before the window opens, and through `game.stop` while it runs. ## `apps/game/src/game.rs` - [Deviation] [apps/game/src/game.rs:37](../apps/game/src/game.rs#L37): The display's scale factor (1.0 for captures). Deviation: the UI is drawn at `os_scale × UIScale / 100` so a high-density display does not shrink it; the original knows only `UIScale` (`UserInterface +0xdc`). - [Deviation] [apps/game/src/game.rs:46](../apps/game/src/game.rs#L46): A capture's cinematic camera this frame: eye, target and vertical field of view ([`view::cinematic`]). Deviation: not in the original; drawing only, set by captures. ## `apps/game/src/gameplay.rs` - [Deviation] [apps/game/src/gameplay.rs:68](../apps/game/src/gameplay.rs#L68): `FUN_140104390`: the pointer scrolls within this many pixels of the left/top edge, and within `EDGE + 1` of the right/bottom edge. Deviation: UI units rather than the original's window pixels, which differ when the UI is scaled. ## `apps/game/src/gameplay/audio.rs` - [Deviation] [apps/game/src/gameplay/audio.rs:15](../apps/game/src/gameplay/audio.rs#L15): Whether the music player and `Scene::Update` draw from the game's Random, as in the original (`FUN_14009b850` passes `Game +0xd8`): each sound that starts draws twice (`Audio::Scene::Update`, Runtime `0x1800e1f10`), so UI clicks, placement sounds and the ambience move the town's Random, at times that depend on the frame rate. Deviation: a multiplayer game, a recording, a replay and `--sim-digest` draw them from the audio's own Random, because clicks and frame times differ between computers and between runs, and the town must stay the same on each. ## `apps/game/src/gameplay/continue_game.rs` - [Deviation] [apps/game/src/gameplay/continue_game.rs:1](../apps/game/src/gameplay/continue_game.rs#L1): A save continued through the whole game loop without a window (`--sim-continue --game`). `--sim-continue` alone runs the town's simulation. The original also draws from the town's Random outside it, even with no sound device: the music player picks its next song and the audio scene picks each sound's variant and pitch (*measured* in CrossOver with XAudio2 off, docs/ITERATION-ORDER.md). This runs the game loop, which makes those draws too, so its draws can be compared one by one with the original's. Deviation: not in the original; a check run from the command line. ## `apps/game/src/gameplay/digest.rs` - [Deviation] [apps/game/src/gameplay/digest.rs:1](../apps/game/src/gameplay/digest.rs#L1): Digests of the simulation, to compare the same game on different platforms (native and the browser). A save is loaded without a window and run at the highest game speed, and every few updates the whole game state it would save is encoded and hashed. Two platforms that agree write the same digests; the first that differs gives the update to look at. See docs/CROSS-PLATFORM.md. Deviation: not in the original; a check run from the command line (`--sim-digest`) or the browser build (`?digest=`). ## `apps/game/src/gameplay/frame.rs` - [Deviation] [apps/game/src/gameplay/frame.rs:55](../apps/game/src/gameplay/frame.rs#L55): `UserInterface::PausesGame`: FUN_14009b850 skips the simulation and the controller. Deviation: in a multiplayer game the pause menu does not hold the shared game. - [Deviation] [apps/game/src/gameplay/frame.rs:255](../apps/game/src/gameplay/frame.rs#L255): AutoSlow (settings `+0x17`): a fire, a blight, a tornado or a shortage (`FUN_14009a2d0`, `FUN_14009aa50`, `FUN_14009ac20` and the disasters themselves) sets the game speed (`Game +0x120 → +0x34`) back to 1. Deviation: in a multiplayer game AutoSlow is always on, so the speed does not depend on each player's own setting. ## `apps/game/src/gameplay/game_loop.rs` - [Deviation] [apps/game/src/gameplay/game_loop.rs:23](../apps/game/src/gameplay/game_loop.rs#L23): Deviation: in a multiplayer game every player counts the achievements from none won, so every player's game (and its digest) is the same whatever each has won before; one won is still kept in the player's own settings. ## `apps/game/src/gameplay/lockstep.rs` - [Deviation] [apps/game/src/gameplay/lockstep.rs:1](../apps/game/src/gameplay/lockstep.rs#L1): The game loop's side of lockstep (`unbanished_session::lockstep`): joining it, giving it the player's commands, carrying out each slot's commands, and reloading for a resync. Deviation: not in the original, which has no multiplayer. ## `apps/game/src/gameplay/network.rs` - [Deviation] [apps/game/src/gameplay/network.rs:1](../apps/game/src/gameplay/network.rs#L1): The players' games over a network: a [`Link`] to the other players, and a [`NetPeer`] that drives one player's lockstep game over it (turns, the host's digest checks and resyncs, the start from the host's save). The link is the relay ([`RelayLink`], `unbanished-net`), or a simulated network in one process for tests ([`simulate`]). See docs/MULTIPLAYER-PLAN.md, steps 3 to 5. Deviation: not in the original, which has no multiplayer. The browser joins through the same code once a page asks for it; until then parts are unused. - [Deviation] [apps/game/src/gameplay/network.rs:191](../apps/game/src/gameplay/network.rs#L191): Deviation: the players line, at the foot of the screen in a multiplayer game. It is the original's version footer (`Dialog/BuildId.rsc`) without its logo. ## `apps/game/src/gameplay/recording.rs` - [Deviation] [apps/game/src/gameplay/recording.rs:1](../apps/game/src/gameplay/recording.rs#L1): Recording a game's player commands, and replaying them. A recording starts when a save is loaded (`--record FILE`). Each line of the file is one JSON entry: the start, then every [`PlayerCommand`] with the update it was given in, the updates the pause menu held the game, and, every few updates (`--record-every N`), a digest of the game state ([`super::digest`]). `unbanished --replay SAVE FILE` loads the same save without a window, carries the commands out at the same updates, and compares its digests with the recorded ones. Equal digests show that the commands carry everything a player changes: the same save and the same commands give the same game. See docs/MULTIPLAYER-PLAN.md, step 2. Deviation: not in the original; recordings are a tool of the port (replays, bug reports, a step towards multiplayer). Recording and replaying run from the command line; the browser build only carries the types. ## `apps/game/src/gameplay/saving.rs` - [Deviation] [apps/game/src/gameplay/saving.rs:137](../apps/game/src/gameplay/saving.rs#L137): Deviation: a game with rule hooks lists them among its mods (`Hooks/NAME.wasm`). ## `apps/game/src/gfx/models/culling.rs` - [Deviation] [apps/game/src/gfx/models/culling.rs:147](../apps/game/src/gfx/models/culling.rs#L147): Deviation: the original takes the union of the instance's current and previous world boxes (`+0x4c` and `+0x64`, the previous one copied in `Geometry::Clean`); the port has only the current one. They are the same for every mesh with more than one level (rocks and ores do not move). ## `apps/game/src/gfx/render/size.rs` - [Deviation] [apps/game/src/gfx/render/size.rs:20](../apps/game/src/gfx/render/size.rs#L20): Draw the 3D scene at `scale` (0.25 to 1) of the window's size and scale it up to the window; the interface stays at the window's size. Deviation: a browser setting (the Options resolution list there), so slower devices can draw fewer pixels; natively the scale is always 1. ## `apps/game/src/gfx/screenshot.rs` - [Deviation] [apps/game/src/gfx/screenshot.rs:1](../apps/game/src/gfx/screenshot.rs#L1): Screenshots (`FUN_14009b270`): key-map actions `0x21` ScreenshotNoUI and `0x22` Screenshot (`FUN_14009b850` sets the game's `+0xc0` / `+0xc1`). The draw (`FUN_14009b4e0`) copies the frame after the scene for the first, after the UI for the second, and writes it to the first free `Screenshots\Screenshot%i.bmp` (`%i` from 0) in the save directory (`FileSystem::GetSaveDirectory`) with `ImageBuffer::SaveImageToFile`; both flags clear. Inferred: the file is a 24-bit bottom-up BMP (the engine's writer is not traced). Deviation: the browser offers the file as a download instead of writing it. ## `apps/game/src/gfx/selection_overlay.rs` - [Deviation] [apps/game/src/gfx/selection_overlay.rs:84](../apps/game/src/gfx/selection_overlay.rs#L84): Deviation: the quads sit this far above the terrain surface instead of relying on the original material's depth state (not traced), so they do not fight the terrain's depth. ## `apps/game/src/gfx/shadow.rs` - [Deviation] [apps/game/src/gfx/shadow.rs:1](../apps/game/src/gfx/shadow.rs#L1): The sun's shadow map (`Graphics::SunLight`), ported from Runtime-steam-x64.dll. See docs/SHADOWS.md. Each frame the sun fits an orthographic camera around the part of the ground the main camera sees (`SunLight::GetSunCamera` 0x1801098a0), renders the casters' depth into a square depth buffer (`SunLight::DrawShadowMap` 0x180109450), and the lit pixel shaders compare against it through `lc[10..13]`, the shadow projection set by `SunLight::Draw` 0x180109040. The Options dialog's shadow resolution sets the map size and its shadow quality the number of taps (`render::VideoSettings`). Deviation: casters are not culled by the main camera's frustum as the original's sun draw group is (`BeginDrawGroup` with the main camera as cull camera), so objects just off screen still cast into view. The planar reflection samples the main view's shadow map rather than one fitted to its own camera. ## `apps/game/src/main.rs` - [Deviation] [apps/game/src/main.rs:94](../apps/game/src/main.rs#L94): Deviation: the original also draws between steps (`MainLoop::Frame`'s `+0x38 / +0x48` handed to `Renderer::Draw`, models and poses blending their `InterpolatedState`); the port draws the last step, which differs only on displays faster than 60 Hz. ## `apps/game/src/native/continue_save.rs` - [Deviation] [apps/game/src/native/continue_save.rs:1](../apps/game/src/native/continue_save.rs#L1): `--sim-continue SAVE ITERATIONS OUT.sav [WINDATA] [--speed N] [--clock SECONDS] [--draws FILE] [--game]`: runs a save for an exact number of simulation iterations without a window, and writes the result as a save. With two saves of one town made by the original game a known number of iterations apart, the continued save can be compared field by field with the later one (`savegame_fields_diff`), which measures how far the port's simulation is from the original's. Each frame runs `--speed` iterations (1 by default, as at speed 1), with the game's fixed step (`FRAME_STEP`). The speed matters: the steps after a frame's iterations draw from the game's Random once a frame (the seeding's `smooth`), so it must be the speed the original ran at. `ITERATIONS` must be a multiple of it. `--clock` is the wall clock (seconds since 1970) when the original loaded the save. The original seeds a loaded game's temperature noise from it (`seed_noise_from_clock`), and the weather follows that noise until the next reseed. Without it the port keeps its fixed seed. `--draws` writes every draw from the game's Random during the iterations, one per line (`unbanished_game::random::trace`), for `tools/triage/rngdiff.py` to compare with the original's. `--replay-draws FILE` (with `--draws`) makes plain draws before each recorded draw, one number per line (`tools/triage/rng_split.py`): the original's sound draws, so the simulation gets the same numbers as the original's without running its sounds. `--loiter-picks FILE` gives the map rectangle (`x y w h` per line) of each object the original's Loiter picked, in order (`tools/triage/loiter_picks.py`), so the comparison goes past the picks whose set order differs (`unbanished_game::behaviour::loiter_order`). `--game` runs the whole game loop instead of the simulation alone (`gameplay::continue_game`), so the music and the sounds draw from the town's Random as the original's do. Its speed must be one of the game's levels. ## `apps/game/src/platform/host_here.rs` - [Deviation] [apps/game/src/platform/host_here.rs:1](../apps/game/src/platform/host_here.rs#L1): Hosting a multiplayer game on this computer (not in the original): when a host opens a room on a server at this computer's own address and none is running, the game starts one on a thread, open to its network. Desktop only: a browser cannot listen. Deviation: not in the original, which has no multiplayer. ## `apps/game/src/platform/mode.rs` - [Deviation] [apps/game/src/platform/mode.rs:1](../apps/game/src/platform/mode.rs#L1): A vanilla run: a run with only the core, the original game and its own mods (BanishedKit `.pkm` files). Every extension built into the program stays off: no Multiplayer button, no Browse tabs for mod sites, no probe, no recording and no cinematic camera. It is chosen when the program starts: `--vanilla` on the command line, `?vanilla` in the browser's address. Deviation: not in the original, which has no extensions to turn off. ## `apps/game/src/platform/nexus.rs` - [Deviation] [apps/game/src/platform/nexus.rs:1](../apps/game/src/platform/nexus.rs#L1): Nexus Mods for the Mods dialog's Browse tab: the API key, and the searches and installs run in the background (a thread natively, `fetch` in the browser), whose replies the dialog collects each frame with [`Nexus::poll`]. Deviation: the original's Browse tab is the Steam Workshop browser (`FUN_14006f790`, `FUN_14006dee0`); here it browses Nexus Mods. The tab shows by default and searches without an account; installing needs the player's own API key (`NexusApiKey` in the settings, or `UNBANISHED_NEXUS_API_KEY` natively). ## `apps/game/src/platform/paths.rs` - [Deviation] [apps/game/src/platform/paths.rs:1](../apps/game/src/platform/paths.rs#L1): Where the game's files live, as the original keeps them, so the port can stand in for the executable (native builds). - **Game data**: `FileSystem::Startup` (Runtime `0x1800acba0`) reads the `.pkg` files from the root directory (`FileSystem::GetRootDirectory` `0x1800ae5a0`: the executable's folder) joined with the platform and build names (`Configuration::GetPlatformName` "Win", `GetBuildName` "Data"): `WinData` beside the executable. - **Saves**: `FileSystem::GetSaveDirectory` (`0x1800adf20`) is the Documents folder (`SHGetFolderPathW` `CSIDL_PERSONAL`) joined with `Banished\`; saves are `%sSave\%s.sav` in it. Deviation: Documents is `%USERPROFILE%\Documents` on Windows (a redirected Documents folder is not followed) and `~/Documents` elsewhere. `UNBANISHED_USER_DIR` names the `Banished` folder directly (tests, captures). - [Deviation] [apps/game/src/platform/paths.rs:41](../apps/game/src/platform/paths.rs#L41): Deviation: the original reads only `WinData` beside itself; the port also finds Steam's. ## `apps/game/src/platform/rule_hooks.rs` - [Deviation] [apps/game/src/platform/rule_hooks.rs:1](../apps/game/src/platform/rule_hooks.rs#L1): The player's rule hooks (not in the original): WebAssembly plugins from the `Hooks` folder of the player's data (`Documents/Banished/Hooks`), loaded into every game in the order of their names (`unbanished-hooks`). A vanilla run loads none, and the browser has no such folder. Deviation: not in the original, which has no rule hooks. ## `apps/game/src/platform/steam.rs` - [Deviation] [apps/game/src/platform/steam.rs:1](../apps/game/src/platform/steam.rs#L1): Finds the player's own copy of Banished: the Steam installs on this computer (native Steam, and on macOS and Linux the Windows Steam in CrossOver bottles and Wine prefixes), or a folder the player names. Nothing is copied: the game reads `WinData` where it is. Each Steam folder lists its libraries in `steamapps/libraryfolders.vdf` ([`vdf`]); Banished is `steamapps/common/Banished/WinData` in one of them. `UNBANISHED_DIR` names a Banished folder directly, as `tools/extract-assets.sh` reads it. Deviation: not in the original, which reads `WinData` beside its own executable only (`FileSystem::GetRootDirectory`, see `paths`). ## `apps/game/src/platform/web.rs` - [Deviation] [apps/game/src/platform/web.rs:43](../apps/game/src/platform/web.rs#L43): Leave the game after Exit (#18). An installed app closes its window, as the original closes the program. A page cannot close a tab the player opened, so otherwise the game goes back to its start page: on the Play page, the page around the game shows its Start button again; on its own, the page reloads. Deviation: in the browser, Exit closes an installed app's window or returns to the start page, since stopping the program would leave the page frozen on its last frame. ## `apps/game/src/saves/save_store.rs` - [Deviation] [apps/game/src/saves/save_store.rs:1](../apps/game/src/saves/save_store.rs#L1): Where saves are kept (`IO::Persistence`'s files, Runtime). Native builds use the original's folder (`crate::platform::paths::save_dir`, `NAME.sav`). In the browser the saves live in IndexedDB (database `banished-wasm`): store `files` holds each whole `.sav` by name, store `meta` its write time and metadata block, so listing reads no game state. The metadata is mirrored in memory when the page starts (`init`), so the list is at hand as the original's is after its listing operation; writes and deletes update the mirror at once and the database in the background; a load is a request polled each frame. Store `mods` holds the mods (`.pkm`) the player added, by file name without the extension (`stored_mods`, `store_mod`). Deviation: the browser keeps saves and mods in its own storage, not in folders. ## `apps/game/src/settings.rs` - [Deviation] [apps/game/src/settings.rs:335](../apps/game/src/settings.rs#L335): Deviation: the original keeps these values in the registry; the port writes the same names to a settings file natively and to localStorage in the browser. ## `apps/game/src/tools/selection.rs` - [Deviation] [apps/game/src/tools/selection.rs:137](../apps/game/src/tools/selection.rs#L137): Deviation: the spatial grid's linked candidate order is creation order here. Only exactly coincident equal-distance hits can differ; the inclusive replacement is exact. ## `apps/game/src/ui/mod_browse.rs` - [Deviation] [apps/game/src/ui/mod_browse.rs:1](../apps/game/src/ui/mod_browse.rs#L1): The Mods dialog's Browse tab, backed by Nexus Mods instead of the Steam Workshop. The elements are the original's. The Steam build fills `groupBrowse` with `Dialog/Mod.rsc:browser` (`FUN_14006f790`): `textSearch`, `buttonSearch`, `comboSort`, `comboPage`, `buttonPrevPage` and `buttonNextPage`, `tableResult`, `textResultNone`, `textResultError` and `imageWorking`. Each result is a `Dialog/Mod.rsc:searchResultGroup` in the table (`FUN_14006dee0`): `textModTitle` (its parameter is the title), the preview (`groupModPreview`), `buttonSubscribe` and `buttonUnsubscribe`. Below the tabs, `groupProgress` shows a download (`textUpdate`, `progressUpdate` with `textProgress`) and then `ribbonUpdateAvailable` with `buttonUpdateReload`. Deviation: there is a Browse tab for each mod site (`platform::nexus::sites`), Nexus Mods and (native builds) banishedinfo.com, shown by default. The sort list keeps the original's three entries: Most Popular (most downloaded), Most Recent (most recently updated) and Subscribed (the mods installed from the site). Installing from Nexus Mods needs an API key; without one Subscribe opens the mod's page. Subscribe installs the mod's main file with a Premium account; otherwise it opens the mod's files page, whose "Mod Manager Download" gives an `nxm://` link, and a link pasted into the search box installs that file. The tabs' labels read "Browse Nexus Mods" and "Browse banishedinfo.com". Previews show the sites' thumbnails (PNG, JPEG or WebP, native builds only). Not ported: Unsubscribe, which stays hidden. ## `apps/game/src/ui/mod_browse/results.rs` - [Deviation] [apps/game/src/ui/mod_browse/results.rs:79](../apps/game/src/ui/mod_browse/results.rs#L79): The loading image stands in for a preview until one arrives. ## `apps/game/src/ui/mod_ui.rs` - [Not ported] [apps/game/src/ui/mod_ui.rs:1](../apps/game/src/ui/mod_ui.rs#L1): The Mods dialog (`Dialog/Mod.rsc`, vtable at `FUN_140073630`'s object, 0xd8 bytes), opened by the main menu's and the pause menu's Mod button (`MainMenuDialog` id 7, `FUN_1400b8370`). - **Open** (`FUN_1400727f0`): Cancel is element 100 (action 8, Escape), Ok 101. For each mod a `modLine` joins `tableMods`; its checkbox is `1000 + i`, Up `2000 + i`, Down `3000 + i`, Top `4000 + i` and the details button `5000 + i`. The first line's Up and Top and the last line's Down are disabled. Each line's icon is the mod's 48×48 image (a sheet of its own over `Material/UI/UIMaterial.rsc`). The Browse tab gets the Workshop browser (`Dialog/Mod.rsc:browser`). The build without Steam (the BanishedKit's `Application-x64-profile.exe`, as the GOG release) then hides the Browse tab's button and the Workshop progress (`buttonBrowse`, `groupProgress`, `SetFlagsOnOff(1, 0)` at `0x14005395a`): mods are the packages in the pack directory only. The port is that build. - **Lines** (`FUN_140072560`, after every change): the name, author and description as the texts' parameter, the version as `"%i (%s)"` of the mod's version and the game version it was made with (`Configuration::GetVersionString(+0x18, true)`), the checkbox from whether it is enabled, and the conflict image shown when the mod and another enabled mod share a file. - **Clicks** (`FUN_1400723e0`, event 0x12): a checkbox enables or disables its mod (`FUN_140072090`), Up and Down swap it with its neighbour, Top swaps it up to the first place (`FUN_140071dc0`); details opens `Dialog/ModDetails.rsc` (`FUN_140071bf0`). Cancel reads the list again (`RefreshList`) and closes. Ok (`FUN_140072110`) closes when nothing changed (`Modification` `+0`, set by Enable, Swap and DisableAll); otherwise it asks `Dialog/Reload.rsc:menu` (or `:game` over a game, `DAT_1401cbdd8`). Yes or Ok saves the list and reloads: from the menu `FUN_1400b9c60`, over a game the game is saved to memory (`Save::SavedState`) and loaded again with the new mods (`FUN_1400b9ec0`). Any other answer reads the list again. - **Details** (`Dialog/ModDetails.rsc`, `FUN_140070950`): Ok is element 0 and closes; Create (1) and Update (2) upload to the Workshop and show only for a mod the player made (`FUN_140071600`). The mod's icon, name, path, author, version and description; then the mods it conflicts with, `^li^c1` (enabled) or `^li^c0`, its name, ` ^n[`, its path and `]^n` (the conflict title and list hide when there are none); then its files in order, `^li^c0`, or `^li^c1` when an enabled conflicting mod also has it, `^li^c2` when one of those is before it in the list, each ending `^n`. Both lists open `^jl^f0^c0^lb` and close `^le`. Not ported: the Steam build's Workshop browser (`FUN_14006dee0`, `FUN_14006f100`) and uploads, so Create and Update stay hidden. ## `apps/game/src/ui/multiplayer.rs` - [Deviation] [apps/game/src/ui/multiplayer.rs:1](../apps/game/src/ui/multiplayer.rs#L1): The Multiplayer window: host a room on a relay or join one, wait for the players, and start the game from the host's save. Not in the original, which has no multiplayer (see docs/MULTIPLAYER-PLAN.md, step 6). Deviation: the window is new. It is built from the original's Map dialog (`Dialog/MapParams.rsc`) with its rows given new labels, so it looks like the game's own windows. The room code goes in the town name's edit and the relay's address in the seed's. OK is Host while the code is empty and Join with a code; the host's becomes Start once a player has joined, and Start asks for the save to play (the Load dialog). - [Deviation] [apps/game/src/ui/multiplayer.rs:411](../apps/game/src/ui/multiplayer.rs#L411): Deviation: a Multiplayer button under Load (the original has no multiplayer). It is a copy of the Load button with its own name and label. ## `apps/game/src/ui/multiplayer_off.rs` - [Deviation] [apps/game/src/ui/multiplayer_off.rs:1](../apps/game/src/ui/multiplayer_off.rs#L1): A build without the `multiplayer` feature: the main menu has no Multiplayer button, and the Multiplayer window never opens. The menu's code stays as it is; this stands in for the window's type, which has no value. ## `apps/game/src/ui/options.rs` - [Deviation] [apps/game/src/ui/options.rs:1](../apps/game/src/ui/options.rs#L1): The Options dialog (`Dialog/Options.rsc`, controller vtable `0x1401632e0`), opened from the main menu and the pause menu (`MainMenuDialog` element id 4 → `FUN_1400b8ee0`). - Bind (`FUN_1400797a0`): buttons Ok 10, Cancel 11 (action 8, Escape), Apply 12; the four volume sliders (ids 0–3, 0–100) from the audio configuration; the video combos (ids 4–9) from a working copy of the video configuration (`+0x190..+0x1ac`); the shadow and reflection combos select their configured index; the input checks; the key list (`FUN_140078a50`); the game tab (autosave combo from `StringTable:autoSave`, UI scale 75–150, icon opacity 0–100, icon scale 25–200) and the last tab shown. - Events (`FUN_1400783f0`): a click on 10/11/12 applies and closes, reverts and closes, or applies; a click on a key button (ids `13 + 2·row + slot`) rebinds it (`FUN_140077e70`); a combo selection (0x14) updates the working video configuration and refills the dependent combos; a slider change (0x17) sets that volume at once. - Apply (`FUN_140077db0`): video (`FUN_1400772e0`), input (`FUN_140077830`), audio, game (`FUN_1400778f0`), then `Persistence::WriteSettings`. - Cancel (`FUN_140077d10`): re-read the input, key map, audio and game settings. Deviation: the Renderer combo lists wgpu backends (Vulkan, Metal, DirectX 12, OpenGL, WebGPU) where the original lists its DirectX 9 and 11 interfaces. The autosave interval drives `crate::saves::autosave` and auto slow-down the disaster slow-down. See docs/OPTIONS.md. ## `apps/game/src/ui/save_dialog.rs` - [Deviation] [apps/game/src/ui/save_dialog.rs:1](../apps/game/src/ui/save_dialog.rs#L1): The Save and Load dialog: `Dialog/SaveLoad.rsc` (vtable `0x140165d10`). Native builds. - **Opening** (constructor `FUN_1400bd740`, bind `FUN_1400bd1d0`): `+0xb8` is the mode (1 Load, 0 Save), `+0xc0` the selection (0). Its buttons get ids Save 1, Load 2, Cancel 0 (action 8, so Escape closes), Delete 3. It asks `SaveLoad` for the list (operation 1, argument −2 saving or −3 loading, at least 0.75 s; [`crate::ui::save_list::list`]). - **Each frame** (`FUN_1400bce80`): while an operation runs the spinner turns 180° a second. When none runs it finishes what was started: a new list fills the table (`+0xbb`), a save (`+0xb9`) closes the dialog, a load (`+0xba`) closes it and starts the game, a delete (`+0xbc`) lists again. - **Refresh** (`FUN_1400bbd50`): `labelLoad`/`buttonLoad` show when loading, `labelSave`/`buttonSave` when saving. With nothing running `mainPage` shows the list (page 1): Load is usable on a readable save (status 2), the selected save has its highlight (`selectSave`) instead of its border. While one runs it shows page 0 with the spinner and "Please wait" (listing), "Loading" or "Saving", and the buttons are not usable. - **The table** (`FUN_1400bc1b0`): `max(count, 6) + 2` rounded down to threes cells of the `icon` template, three a row, plus a row. A save shows its preview (`imageSaveIcon`, which takes the mouse with id `4 + index`), its name and its date, or "Corrupt" and a dimmed preview (`0xff808080`) with `imageCorrupt` when it does not read. Unused cells show only a faint border (`0x80ffffff`) and icon (`0x20ffffff`). - **Events** (`FUN_1400bbcb0`): event 2 on an icon selects it (UI sound 4 when it changes, `FUN_1400bbc60`); Cancel closes; Save (`FUN_1400bb4a0`) asks `confirmSave` over an existing file and saves (operation 4, at least 1.5 s) under the town's name, into a new `Save%i` for the new-save slot; Load (`FUN_1400bb6b0`) asks `confirmLoad` while a game runs, then for each mod the save names that `SaveLoad::CheckMod` finds missing (1), out of date (2), of another version (3) or changed (4) `modsMissing`, `modsOutOfDate`, `modsVersion` or `modsChanged` with its name, file and `"%i (%s)"` version, and loads (operation 2, at least 1.5 s); Delete (`FUN_1400bb320`) asks `confirmDelete` and deletes (operation 5). - The saves are read and written through [`crate::saves::save_store`]: a load waits for the file's bytes as well as its shortest time (in the browser the read is asynchronous). - The confirmations are message boxes (vtable `0x1401625c0`, `FUN_14006daa0`: Cancel 0, Ok 1, Yes 2, No 3); `ShowDialog` returns the button and only Yes goes on. Deviations: the original runs `ShowDialog` as a nested loop; the port keeps the step waiting for the answer. The new-save slot shows the save sprite (`SaveLoad +0x60`, set from the global data's `+0xb8`: `Dialog\SpriteSheet.rsc` "SaveLoadEmpty", `FUN_1400a0e00`), which is the icon template's own sprite, so the slot keeps it. ## `apps/game/src/ui/save_dialog/files.rs` - [Deviation] [apps/game/src/ui/save_dialog/files.rs:68](../apps/game/src/ui/save_dialog/files.rs#L68): Deviation: a rule hook's entry is not a mod (`unbanished_sim::hooks`). ## `apps/game/src/ui/save_list.rs` - [Deviation] [apps/game/src/ui/save_list.rs:89](../apps/game/src/ui/save_list.rs#L89): `DateTime::AsString` (`0x1800c7d40`): the local date and time, `"%s %s"` of `GetDateFormatW(DATE_SHORTDATE)` and `GetTimeFormatW(TIME_NOSECONDS)`, in the user's locale. The browser formats them by its locale (`toLocaleDateString`, `toLocaleTimeString` without seconds). Deviation: native builds do not read the locale's formats; they write the en-US defaults (`M/d/yyyy h:mm tt`). ## `apps/game/src/view/cinematic.rs` - [Deviation] [apps/game/src/view/cinematic.rs:1](../apps/game/src/view/cinematic.rs#L1): A camera for videos made with headless captures: keyframed paths (`--camera`) and a camera that rides with a citizen, a trader boat or an animal (`--camera-follow`). It changes only what is drawn. The game camera, the simulation and saves stay as they are: [`Game::draw`](crate::Game::draw) builds the frame from this camera instead of the game's ([`SceneView::frame_from`](crate::view::scene::SceneView::frame_from)), and culling, shadows, the sky and the weather follow the frame. Times are capture seconds, as for `--script`. Deviation: not in the original; a capture tool for documentation videos. ## `apps/game/src/view/scene.rs` - [Deviation] [apps/game/src/view/scene.rs:114](../apps/game/src/view/scene.rs#L114): This frame seen from another camera: `eye` looking at `target` with a vertical field of view of `vfov` degrees. The game's own camera is left as it is; culling, shadows, the sky and the weather follow the frame's camera. Used by captures' cinematic camera ([`crate::view::cinematic`]). Deviation: not in the original; captures only (`--camera`, `--camera-follow`). ## `crates/formats/src/pkg.rs` - [Not traced] [crates/formats/src/pkg.rs:72](../crates/formats/src/pkg.rs#L72): +0x74 `Modification::RefreshList` leaves out a mod whose value is not 0 (0 in every package seen; its meaning is not traced). ## `crates/game/src/behaviour/activities.rs` - [Deviation] [crates/game/src/behaviour/activities.rs:309](../crates/game/src/behaviour/activities.rs#L309): Scan 13 x 13 cells around the citizen (rows outer) for reachable map objects, then the home; pick one from the set. Deviation: the original's set is a tree keyed by each object's `Object::Internal` address, which depends on the allocator's history; the port uses creation order. Measured on the CrossOver pair (docs/ITERATION-ORDER.md): the pick differs at draw 815. ## `crates/game/src/behaviour/agents.rs` - [Deviation] [crates/game/src/behaviour/agents.rs:1](../crates/game/src/behaviour/agents.rs#L1): The citizens' CharacterComponent and CitizenAIComponent run together each simulation iteration. See docs/CITIZEN-AI.md. Order per iteration: each citizen's model advances its clip (and draws for its sound events), then its character runs its actions and moves; "sequence finished" messages run the AI again with zero time, then the AI updates. One iteration runs in the entity manager's order (docs/ITERATION-ORDER.md): the every- iteration phase (bit `0x04`: the citizens' characters, then the sites' state machines, nomads, boats and tornadoes; [`Agents::every_iteration`]), then bucket 1's citizens ([`Agents::visit_citizens`]: the character's notify, CitizenComponent, CitizenAIComponent), then bucket 3's sites and piles ([`Agents::visit_sites`]), with the seeder's buckets 2 and 4 between and after them, then the deletions ([`Agents::finish`]). Deviation: the every-iteration phase runs one kind at a time (the animals, then the models, then the citizens, then the sites); the original runs it entity by entity, in its set's order. Animals and sites are also deleted at other points than citizens. See docs/ITERATION-ORDER.md, steps 3 and 4, and issue #22. This file holds the agents' state and set-up; the rest is split by topic: `update` (the iteration), `thinking` (the AI), `lives`, `commands`, `paths` and `views`. `FUN_140114810` (sequence finished); `FUN_1400c9560` (the buckets). ## `crates/game/src/behaviour/agents/update/animals.rs` - [Deviation] [crates/game/src/behaviour/agents/update/animals.rs:6](../crates/game/src/behaviour/agents/update/animals.rs#L6): The wild animals' character update: animate, run the actions, turn and move. Deviation: the entity manager runs these updates in the order of a tree keyed by the entity's address; the port takes them in the order they were made, which a growing heap usually gives too. tree at manager `+0x68` (`FUN_1400c90a0`). ## `crates/game/src/behaviour/animation.rs` - [Deviation] [crates/game/src/behaviour/animation.rs:149](../crates/game/src/behaviour/animation.rs#L149): Deviation: malformed negative times and empty loop spans must not index outside resources. ## `crates/game/src/behaviour/character.rs` - [Not ported] [crates/game/src/behaviour/character.rs:222](../crates/game/src/behaviour/character.rs#L222): RandFloat() < time since the last check / (+0x54 × 12 × 300 s × +0x58); Game +0xd0 Already hurt, or, at a job whose profession has accidents, `RandFloat < time since the last check / (× 12 × 300 s ×)` (the time restarts at every check). Not ported: the debug flag that stops it (`Game` bit 8). ## `crates/game/src/behaviour/character_tree.rs` - [Deviation] [crates/game/src/behaviour/character_tree.rs:229](../crates/game/src/behaviour/character_tree.rs#L229): Deviation: the original follows a character whose component sits at a higher address; the port takes the one put in the tree later. ## `crates/game/src/behaviour/loiter_order.rs` - [Deviation] [crates/game/src/behaviour/loiter_order.rs:1](../crates/game/src/behaviour/loiter_order.rs#L1): The original's Loiter picks, measured in a run of the original, for comparing draws past them. `Activity::Loiter` picks one of the objects near a citizen from a set that the original keys by each object's `Object::Internal` address (docs/ITERATION-ORDER.md). The port keeps the set in creation order, so the same draw can pick another object. A comparison run can give the map rectangle of each object the original picked, in order; each pick then takes the set member with that rectangle. Deviation: not in the original; a check run from the command line (`--loiter-picks`). ## `crates/game/src/behaviour/sounds.rs` - [Deviation] [crates/game/src/behaviour/sounds.rs:37](../crates/game/src/behaviour/sounds.rs#L37): For each event a character's clip fired, in order: one `RandFloat` from the game's generator against the event's probability; when it passes, its sound plays at the character. An event that is not a sound draws nothing. The draws come with each entity's model update in the every-iteration phase, just before its character runs, as in the original. Deviation: the original runs that phase entity by entity in its set's order (by address, step 3 of issue #22). The port runs one kind at a time (citizens, animals, boats, nomads), each in its own order, and the trees' draws come with the natural resources. ModelComponent's every-iteration update (`FUN_140129e30`). ## `crates/game/src/commerce/trade/visits.rs` - [Deviation] [crates/game/src/commerce/trade/visits.rs:201](../crates/game/src/commerce/trade/visits.rs#L201): Deviation: a merchant with nothing to sell brings nothing (the original reads an empty list). ## `crates/game/src/disasters/fire.rs` - [Deviation] [crates/game/src/disasters/fire.rs:353](../crates/game/src/disasters/fire.rs#L353): Deviation: a cell above the map's first row (the rows' range is not clamped at 0) makes the original read outside the cell array; nothing burns there here. ## `crates/game/src/events.rs` - [Deviation] [crates/game/src/events.rs:69](../crates/game/src/events.rs#L69): Whether `text` is shown after the event's season and year, as the game's own lines are ("Autumn 22: …"): a rule hook's line. Deviation: not in the original, which has no rule hooks. ## `crates/game/src/nature/environment.rs` - [Deviation] [crates/game/src/nature/environment.rs:170](../crates/game/src/nature/environment.rs#L170): State +0x10, level +0x14, temperature +0x18, renderer values +0x1c, baseline +0x2c/+0x30, bias +0x44/+0x48, last slice +0x4c; each effect re-created by FUN_140099790 with its +0xc4 direction and +0xc0 intensity. The environment as a save stores it: the state, the level, the temperature, the renderer's values, the baseline, the bias, the last slice, and each weather effect that exists (made again on load with its direction and intensity). Deviation: the temperature noise (`+0x34`) is not saved; after a load the original keeps its constructor's clock-seeded field until the next reseed (slice 0 or 24). The port keeps its constructor's fixed seed. - [Deviation] [crates/game/src/nature/environment.rs:214](../crates/game/src/nature/environment.rs#L214): A new environment for a climate: state 0, level 4, and the climate's baseline. Deviation: the constructor seeds its first Perlin field from two clock-seeded `Random()`s; the first update always reseeds it (slice 0), so a fixed seed is used here. `seed_noise_from_clock` gives the original's field for a known clock. ## `crates/game/src/nature/growth.rs` - [Deviation] [crates/game/src/nature/growth.rs:122](../crates/game/src/nature/growth.rs#L122): Deviation: malformed zero/negative intervals must not hang the browser. ## `crates/game/src/nature/spawn.rs` - [Deviation] [crates/game/src/nature/spawn.rs:47](../crates/game/src/nature/spawn.rs#L47): Deviation: invalid zero/negative resource periods must not hang the browser. ## `crates/game/src/nature/wildlife.rs` - [Deviation] [crates/game/src/nature/wildlife.rs:372](../crates/game/src/nature/wildlife.rs#L372): Deviation: a zero space would divide by zero in the original. ## `crates/game/src/nature/wildlife/livestock.rs` - [Deviation] [crates/game/src/nature/wildlife/livestock.rs:28](../crates/game/src/nature/wildlife/livestock.rs#L28): Deviation: a zero interval would never leave the loop in the original. ## `crates/game/src/people/life.rs` - [Deviation] [crates/game/src/people/life.rs:1](../crates/game/src/people/life.rs#L1): The lives of citizens and their homes: needs, age, death, health, happiness, disease, homes, partners and births. See [Citizens](https://tanepiper.github.io/unbanished/topics/citizens), docs/CITIZEN-NEEDS-AND-HOUSEHOLDS.md and docs/CITIZEN-LIFE.md. The citizen description is kept as a table by offset, so the port reads the same values as the original. Deviations: the entity references the original keeps (home, partner, guardian, dependents) are citizen and entity indices; the dependents' ring is a vector in ring order. `0x14016a6a0`); disease spread `FUN_140117940`. ## `crates/game/src/people/life/death.rs` - [Not ported] [crates/game/src/people/life/death.rs:6](../crates/game/src/people/life/death.rs#L6): Game +0xd0 Queue the citizen's death (`reason`) and tell the family. When the citizen is buried in a cemetery (found from the home's entrance, else from where the citizen stands), the family's bit is `0x40`; otherwise it is `2` for old age, else `0x80`. Not ported: the debug flag that stops deaths (`Game` bit 8). ## `crates/game/src/people/life/health.rs` - [Not ported] [crates/game/src/people/life/health.rs:6](../crates/game/src/people/life/health.rs#L6): Health from the last interval's events, at most the description's maximum. Not ported: the debug flag that keeps every citizen's health full. Game +0xd0 bit 3 ## `crates/game/src/people/life/update.rs` - [Not ported] [crates/game/src/people/life/update.rs:6](../crates/game/src/people/life/update.rs#L6): One scheduled update of citizen `c` over `dt`. Not ported: the debug flags that turn hunger and cold off and make every adult educated. Game +0xd0 bits 1, 2, 9 ## `crates/game/src/production/fishing.rs` - [Deviation] [crates/game/src/production/fishing.rs:226](../crates/game/src/production/fishing.rs#L226): Deviation: a column off the map's edge reads outside the cell array in the original; no catch here. ## `crates/game/src/production/forester.rs` - [Deviation] [crates/game/src/production/forester.rs:112](../crates/game/src/production/forester.rs#L112): Deviation: cells off the map's edge (and an entrance off the map) read outside the cell array in the original; no candidate here. ## `crates/game/src/production/herbalist.rs` - [Deviation] [crates/game/src/production/herbalist.rs:141](../crates/game/src/production/herbalist.rs#L141): Deviation: a column off the map's edge reads past the cell array in the original; such a cell is no candidate here. ## `crates/game/src/production/hunt.rs` - [Deviation] [crates/game/src/production/hunt.rs:51](../crates/game/src/production/hunt.rs#L51): Deviation: no workers allowed would divide by zero in the original. - [Deviation] [crates/game/src/production/hunt.rs:105](../crates/game/src/production/hunt.rs#L105): Deviation: a column off the map's edge reads outside the cell array; no walk. ## `crates/game/src/production/pasture.rs` - [Deviation] [crates/game/src/production/pasture.rs:74](../crates/game/src/production/pasture.rs#L74): Deviation: a zero pile size would never leave the loop in the original. ## `crates/game/src/world/placement.rs` - [Not ported] [crates/game/src/world/placement.rs:258](../crates/game/src/world/placement.rs#L258): The occupant is cell +0x00, the zone count +0x28. Activate a zone: the entity becomes the occupant of every footprint cell that is not `.`, and each `.` cell counts one more zone. Not ported: the path grid's blocked bit (citizens' mode 0 does not honour it). ## `crates/game/src/world/terraform.rs` - [Deviation] [crates/game/src/world/terraform.rs:1](../crates/game/src/world/terraform.rs#L1): Terraforming: a tunnel reshapes the terrain when it is built. See docs/TUNNELS.md. When the build is done (entity event 4; a multi-object passes it to its parts), the vertices of the ceiling mesh raise the terrain where it is below them, keeping what was there, and the vertices of the floor mesh lower it where it is above them. Then the rough cells (10) under the building become high ground (6). When the tunnel is removed, the raised heights are put back and those cells become rough again; the dug floor stays. `FUN_1400574b0` (ceiling and floor), `FUN_140057a80` (cell types), `FUN_140057cb0` (removed, slot `+0x38`). Deviation: the heights belong to the terrain outside the simulation, so the town queues the dig and the game applies it after the iteration (`StartingTown::apply_terraforms`), not during it. ## `crates/hooks/src/lib.rs` - [Deviation] [crates/hooks/src/lib.rs:1](../crates/hooks/src/lib.rs#L1): Rule hooks from WebAssembly plugins (not in the original): mods that change the game at fixed points of the step. Each plugin is a WebAssembly module made for the hook API ([`plugin::API_VERSION`]); they run in the order they were loaded, after every iteration, and behave the same on every computer: no floating point, a fixed budget per call, and the game's own random stream. See docs/develop/RULE-HOOKS.md. Deviation: not in the original, which has no rule hooks. ## `crates/mods/src/lib.rs` - [Deviation] [crates/mods/src/lib.rs:84](../crates/mods/src/lib.rs#L84): `+0x58`: where it is, under the data directory (`WinData\.pkm`). Deviation: the original shows the full path. ## `crates/session/src/link.rs` - [Deviation] [crates/session/src/link.rs:1](../crates/session/src/link.rs#L1): The ways to the other players: a [`Link`], the relay (`RelayLink`, the `relay` feature), a shared link, and a simulated network in one process for tests ([`SimNet`]). Deviation: not in the original, which has no multiplayer. ## `crates/session/src/lockstep.rs` - [Deviation] [crates/session/src/lockstep.rs:1](../crates/session/src/lockstep.rs#L1): Deterministic lockstep: several players run the same game, each on their own computer, and only their commands travel. See docs/MULTIPLAYER-PLAN.md, step 3. The game counts updates since it loaded. A command a player gives while `c` updates have begun is carried out in slot `c + delay` on every computer: after update `c + delay` and before the next. When a player begins an update it seals its commands for the slot `delay` ahead into a [`Turn`] and sends it. A computer carries a slot out, and begins the next update, only once it holds every player's turn for that slot; the commands run by player, then in the order given. The first `delay` slots are empty for everyone. Deviation: not in the original, which has no multiplayer. A single-player game has no lockstep and carries each command out at once (`unbanished_sim::command`). ## `crates/session/src/recording.rs` - [Deviation] [crates/session/src/recording.rs:1](../crates/session/src/recording.rs#L1): A recording: a game's player commands and digests, written as it is played, to replay it exactly from its save. Deviation: not in the original. ## `crates/session/src/session.rs` - [Deviation] [crates/session/src/session.rs:1](../crates/session/src/session.rs#L1): When a game carries out its players' commands. In a single-player game ([`Local`]) a command is carried out at once, where the player gave it. In a multiplayer game ([`LockstepSession`]) it waits for its slot, and every computer carries the same commands out at the same update (`crate::lockstep`). The game asks its session before each update and with each command; the session never touches the game itself, so a game app, a test or a server can drive one. Deviation: multiplayer is not in the original; a single-player game behaves as it does. ## `crates/session/src/watch.rs` - [Deviation] [crates/session/src/watch.rs:1](../crates/session/src/watch.rs#L1): A room's town run by the server (not in the original): the server's own copy of a multiplayer game. It gets every player's messages (the start, the turns, new players, resyncs) and runs the town update by update as each player's game does, with no window. Its digests are the game everyone must have; when a player's game differs, the server sends its own save ([`Event::Save`]) and the players go on from it. It plays no part in the lockstep: it sends no turns, so it never holds the players up. Each update repeats the game app's frame in a lockstep game (`gameplay/frame.rs`): the slot's commands (speed, pause and the town's name as the app handles them, and each player's own Path tool), then the update boundary (a save if one is wanted, a digest on check updates), then the speed's iterations, the achievements, the phase after them and the events (`Simulation::frame`). Deviation: not in the original, which has no multiplayer. ## `crates/sim/src/achievements.rs` - [Deviation] [crates/sim/src/achievements.rs:1](../crates/sim/src/achievements.rs#L1): Achievements (Runtime `Achievement::AchievementManager`, `AchievementInstance`, `GoalList`, `GoalInstance`; the goal classes in the Application). See docs/ACHIEVEMENTS.md. `Game/Achievement/AchievementList.rsc` lists the achievements; each has goals. A goal's state (`GoalInstance::CheckGoalState`) is 0 not met, 1 met or 2 failed; a failed goal stays failed (`GoalInstance::Update`). The manager's `Update` checks one achievement not yet awarded each frame in turn, its goals updated with the time since its last check; with every goal met and none failed it is awarded (`SetAchievementMet`) and the game logs event `0x19`. Deviation: the original keeps what is awarded in Steam's user stats; the port keeps it in the settings store (`Achievement`). ## `crates/sim/src/hooks.rs` - [Deviation] [crates/sim/src/hooks.rs:1](../crates/sim/src/hooks.rs#L1): The door for rule hooks (not in the original): code from a mod that changes the game at a fixed point of the step. The simulation calls its [`RuleHooks`] after every iteration, with a [`HookContext`]: a narrow view of the town with what a hook may read and do. A rule hook changes the game's results, so it must behave the same on every computer: it gets integers only, draws from the game's own random stream in a fixed order, and runs in the order the hooks were declared. With no hooks (the default, and always in a vanilla run) the step is exactly the original's. `unbanished-hooks` runs hooks from WebAssembly plugins. Deviation: not in the original, which has no rule hooks; a game with hooks plays differently. ## `crates/sim/src/town/map.rs` - [Deviation] [crates/sim/src/town/map.rs:99](../crates/sim/src/town/map.rs#L99): A saved game's map: its stored terrain, surface, rivers and water instead of a generated one (the original restores them; nothing is regenerated on load). ## `crates/sim/src/town/registry.rs` - [Deviation] [crates/sim/src/town/registry.rs:36](../crates/sim/src/town/registry.rs#L36): FUN_1400c9560 step 4 (FUN_1400c8db0): every entity queued for deletion (entity flag 0x400) leaves its bucket, its place taken by the bucket's last entity. The deletions of the iteration: every scheduled entity that is no longer alive leaves its bucket. Before, a destroyed site, a picked-up pile or a cleared resource stayed in its bucket and took one of its visits each time its turn came. Deviation: the original deletes in the order the deletions were asked for. Here the seeder's removals go in that order and the rest in their buckets' order, which differs only when two entities of one bucket are deleted in the same iteration (the bucket's order after the swaps then differs). ## `crates/sim/src/town/save/animation.rs` - [Not ported] [crates/sim/src/town/save/animation.rs:80](../crates/sim/src/town/save/animation.rs#L80): AnimationManager entries (FUN_18005d130): group +0x00, clip +0x08, users +0x0c, the instances +0x20 (FUN_18005cd90) and the nodes +0x10 (FUN_18005cbf0). The shared instances into the save's animation block, slot by slot: each entry's group, clip and users, and each instance's clock, speed, pose and root movement. A free slot is written free. Not ported: the group's nodes (its skeleton's bind transforms) and each instance's model-space transforms are not kept here. A slot keeps those it was saved with; a slot the save did not hold for this group copies them from one that it did, and writes none when there is no such slot. ## `crates/terrain/src/query.rs` - [Deviation] [crates/terrain/src/query.rs:80](../crates/terrain/src/query.rs#L80): Where a ray first hits the ground, no farther than `maximum`: the distance and the point. The game uses it to stop picking at the ground. Deviation: the port tests every cell in the rectangle the ray crosses, where the original walks the cells along the ray. ## `crates/ui/src/input/keyboard.rs` - [Deviation] [crates/ui/src/input/keyboard.rs:227](../crates/ui/src/input/keyboard.rs#L227): `EditElement::SelectCharacter`: the keys of a US keyboard give printable ASCII but `:` and `;`; each goes in while the text is shorter than its most and the edit takes it. Deviation: an edit whose allowed characters name `:` or `;` takes them (the Multiplayer window's relay address); the original's edits never name them. ## `crates/ui/src/input/pointer.rs` - [Deviation] [crates/ui/src/input/pointer.rs:218](../crates/ui/src/input/pointer.rs#L218): Deviation: the original keeps the drag flag after a release far away (until a release near it); the port ends the drag there.