Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Release notes for Arda. The design ledger (decisions, stage records and per-change detail)
lives in `docs/capstone/changelog.md` and `docs/capstone/changelog.d/`.

## Unreleased

**Content changes (flagged per the versioning policy)**

- Forest obscurement. Only a thicket is heavily obscured now: four or more small trees or woody shrubs (not ferns) within 2 squares of a square's centre. A wood's floor under two or more trunks is lightly obscured however closed the canopy (until now four trunks within 2.4 squares made it heavy). The canopy obscures in the rules sidecar (`blocks_sight`, `lightly_obscured`) and the scene (`obscured`) of tactical cells, windows, prefetches and bakes. On the contract kit's forest cell (479, 1245) `heavy` falls from 90.7 % of the squares to 0.2 %, and from its centre a creature sees every square within 60 ft instead of 1.8 % of them. No shape, image or dungeon body changes; the kit's `tactical-cell`, `tactical-scene-day`, `tactical-scene-night` and `tactical-window` bodies are re-recorded.

## 1.1.1 — 2026-11-14

Dependency security updates. No API, format or content change from 1.1.0, which was tagged but not published; 1.1.1 is the first published release with the dungeon and cave sites described under 1.1.0.
Expand Down
2 changes: 1 addition & 1 deletion contract-kit/golden/tactical-cell.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contract-kit/golden/tactical-scene-day.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contract-kit/golden/tactical-scene-night.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions contract-kit/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@
},
"schema": "TacticalBlockDto",
"body": {
"sha256": "e24225b5dc0c54f2219805a71378b5b23014a37b4367424059b7fea16150bdbb",
"bytes": 2106634
"sha256": "e1349d7180d60c7b363c05c82772a71677509621b7f406cfa590f7b75b11154c",
"bytes": 1949332
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion crates/arda-refine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ Each map is written as three files.
- `difficult`: undergrowth, scrub, scree, mud, marsh, reed bed, snow, ice, cliff (climbing), logs, or wading water;
- `water_depth_ft`;
- `cover`: `half` for a slender trunk or large rock, `three_quarters` for a thick trunk or boulder;
- `blocks_sight`: four or more large trunks within 2.4 squares, which counts as dense canopy;
- `blocks_sight`: a thicket, four or more small trees or woody shrubs (not ferns) within 2 squares (logic/09 §rules-sidecar);
- `lightly_obscured`: two or more large trunks within 2.4 squares (a wood's canopy), or a reed bed;
- `blocks_movement`: always false for natural ground;
- `deck`: never set.
- **`*.meta.json`** is this crate's own review record (format `arda-refine.meta/2`): the name, the size, the relaxed flag, the `review` square indices, and per-block WFC attempts and repairs. It also holds `placements`, running parallel to the layout's placements, each with its semantic tag (`tree:broadleaf:large`, `rock:boulder`, `water_plant:reeds` and so on), cover and difficulty.
Expand Down
147 changes: 132 additions & 15 deletions crates/arda-refine/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,53 @@ use std::collections::BTreeSet;

/// Trunks within this radius of a square centre count toward its canopy.
const CANOPY_R: f64 = 2.4;
/// Trunks needed for a canopy to block sight.
const CANOPY_BLOCKS: usize = 4;
/// Trunks for a thinner canopy that lightly obscures (logic/09
/// §rules-sidecar "moderate foliage"; count assumed, tunable).
/// Trunks for a canopy that lightly obscures (logic/09 §rules-sidecar
/// "moderate foliage"; count assumed, tunable). A denser canopy obscures no
/// more: a closed wood is foliage overhead, not a thicket.
const CANOPY_LIGHT: usize = 2;
/// Woody understory within this radius of a square centre counts toward a
/// thicket (logic/09 §rules-sidecar "thicket").
const THICKET_R: f64 = 2.0;
/// Small trees and woody shrubs that make a thicket, which heavily
/// obscures (SRD 5.1 "dense foliage"; count tuned on the MICRO-42 kit
/// world, 2026-11-14).
const THICKET_MIN: usize = 4;

/// Whether an item is foliage the sight rules count: a large trunk (canopy)
/// or woody understory (a small or stunted tree, a shrub; not a fern).
fn foliage(it: &Item) -> bool {
match it.kind {
Kind::TreeLarge | Kind::TreeSmall => true,
Kind::Undergrowth => it.tag != "undergrowth:fern",
_ => false,
}
}

/// `(blocks_sight, lightly_obscured)` of the square centred on `at`
/// (logic/09 §rules-sidecar): a thicket, at least [`THICKET_MIN`] woody
/// understory items within [`THICKET_R`], blocks sight; a canopy of at
/// least [`CANOPY_LIGHT`] trunks within [`CANOPY_R`], or reeds, lightly
/// obscures. Water is never a thicket or a canopy floor. `items` may hold
/// any items; only [`foliage`] counts.
fn sight(items: &[Item], at: (f64, f64), depth: u8, ground: &str) -> (bool, bool) {
let near = |it: &Item, r: f64| {
let (dx, dy) = (it.x - at.0, it.y - at.1);
dx * dx + dy * dy < r * r
};
let mut canopy = 0;
let mut thicket = 0;
for it in items.iter().filter(|it| foliage(it)) {
if it.kind == Kind::TreeLarge {
canopy += usize::from(near(it, CANOPY_R));
} else {
thicket += usize::from(near(it, THICKET_R));
}
}
let dry = depth == 0;
let heavy = dry && thicket >= THICKET_MIN;
let light = !heavy && ((dry && canopy >= CANOPY_LIGHT) || ground == "reed_bed");
(heavy, light)
}

/// Cover and difficulty of one item, refined by its tag.
#[must_use]
Expand Down Expand Up @@ -51,29 +93,22 @@ pub fn square_rules(b: &Block, items: &[Item], illegal: &BTreeSet<usize>) -> Vec
cover[j * SIDE + i] = cover[j * SIDE + i].max(rules_of(it).0);
}
}
let trunks: Vec<&Item> = items
.iter()
.filter(|it| it.kind == Kind::TreeLarge)
.collect();
let leaves: Vec<Item> = items.iter().filter(|it| foliage(it)).cloned().collect();
for j in 0..SIDE {
for i in 0..SIDE {
let k = j * SIDE + i;
let (cx, cy) = (
b.origin.0 as f64 + i as f64 + 0.5,
b.origin.1 as f64 + j as f64 + 0.5,
);
let canopy = trunks
.iter()
.filter(|t| (t.x - cx) * (t.x - cx) + (t.y - cy) * (t.y - cy) < CANOPY_R * CANOPY_R)
.count();
let depth = b.depth_ft[k];
let (blocks_sight, lightly_obscured) = sight(&leaves, (cx, cy), depth, b.ground[k]);
out.push(SquareRules {
difficult: difficult_ground(b.ground[k], depth),
water_depth_ft: depth,
cover: cover[k],
blocks_sight: canopy >= CANOPY_BLOCKS && depth == 0,
lightly_obscured: ((CANOPY_LIGHT..CANOPY_BLOCKS).contains(&canopy) && depth == 0)
|| b.ground[k] == "reed_bed",
blocks_sight,
lightly_obscured,
review: b.relaxed && illegal.contains(&k),
});
}
Expand Down Expand Up @@ -258,3 +293,85 @@ pub fn fixed64(v: f64) -> f32 {
let f = q as f32 / 64.0;
f
}

#[cfg(test)]
mod tests {
use super::sight;
use crate::scatter::{Item, Kind};

fn item(x: f64, y: f64, kind: Kind, tag: &'static str) -> Item {
Item {
x,
y,
kind,
asset: "veg.test",
tag,
rotation: 0,
mirror: false,
}
}

/// Items at `n` points on a ring of radius `r` around (10.5, 10.5).
fn ring(n: usize, r: f64, kind: Kind, tag: &'static str) -> Vec<Item> {
let pts = [
(1.0, 0.0),
(0.0, 1.0),
(-1.0, 0.0),
(0.0, -1.0),
(0.7, 0.7),
(-0.7, -0.7),
];
pts.iter()
.take(n)
.map(|(dx, dy)| item(10.5 + dx * r, 10.5 + dy * r, kind, tag))
.collect()
}

const AT: (f64, f64) = (10.5, 10.5);

// logic/09 §rules-sidecar: a closed canopy is foliage overhead, not a
// thicket; a creature under it is lightly obscured, never blind.
#[test]
fn a_closed_canopy_lightly_obscures() {
let trunks = ring(6, 1.5, Kind::TreeLarge, "tree:broadleaf:large");
assert_eq!(sight(&trunks, AT, 0, "forest_floor"), (false, true));
}

#[test]
fn a_thicket_of_woody_understory_heavily_obscures() {
let mut items = ring(2, 1.5, Kind::TreeSmall, "tree:broadleaf:small");
items.extend(
ring(4, 1.8, Kind::Undergrowth, "undergrowth:bush")
.into_iter()
.skip(2),
);
assert_eq!(sight(&items, AT, 0, "forest_floor"), (true, false));
}

#[test]
fn three_shrubs_or_ferns_are_no_thicket() {
let shrubs = ring(3, 1.5, Kind::Undergrowth, "undergrowth:bush");
assert_eq!(sight(&shrubs, AT, 0, "scrub"), (false, false));
let ferns = ring(6, 1.5, Kind::Undergrowth, "undergrowth:fern");
assert_eq!(sight(&ferns, AT, 0, "forest_floor"), (false, false));
}

#[test]
fn understory_beyond_two_squares_does_not_count() {
let far = ring(6, 2.1, Kind::TreeSmall, "tree:conifer:small");
assert_eq!(sight(&far, AT, 0, "forest_floor"), (false, false));
}

#[test]
fn water_is_never_a_thicket_and_reeds_lightly_obscure() {
let items = ring(6, 1.5, Kind::TreeSmall, "tree:broadleaf:small");
assert_eq!(sight(&items, AT, 2, "forest_floor"), (false, false));
assert_eq!(sight(&[], AT, 1, "reed_bed"), (false, true));
}

#[test]
fn open_ground_is_clear() {
let lone = ring(1, 1.0, Kind::TreeLarge, "tree:broadleaf:large");
assert_eq!(sight(&lone, AT, 0, "grass"), (false, false));
}
}
5 changes: 4 additions & 1 deletion crates/arda-server/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,10 @@ type: `TacticalScene` (adapter A12):
(`Runs<T>`, `[count, value][]` row-major, the counts summing to `width × height`):
`movement` (`MovementDto`: `normal`, `difficult`, `wade`, `swim`, `impassable`), `climb`
(bit `d` set, `d` = 0 N … 7 NW, means that step needs climbing), `cover` (`CoverLevelDto`),
`obscured` (`ObscurementDto`: `clear`, `light`, `heavy`), `elevation_ft`, `water_depth_ft`;
`obscured` (`ObscurementDto`: `clear`, `light`, `heavy`; on natural ground a wood's floor
is `light` under two or more trunks, a thicket of woody understory is `heavy`, and only
sight-blocking props, walls and rock are `heavy` otherwise: logic/09 §rules-sidecar),
`elevation_ft`, `water_depth_ft`;
then `walls` (`SceneWallDto`: `kind`, `open?`, `points` as `[x, y]` grid vertices,
`blocks_sight`, `blocks_movement`, `blocks_light`, `cover`, `kit`, `locked?` (`true` on a
locked door, gate or secret door)), `vision_blockers`,
Expand Down
15 changes: 15 additions & 0 deletions docs/capstone/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
generated_date: 2026-08-24
---

## 2026-11-14 - implement: 2026-11-14-thicket-obscurement
key: implement/2026-11-14-thicket-obscurement@Q2

- What: refine marks only thickets heavily obscured, for DiceMaster, whose ruling of 2026-11-14 keeps the SRD rule that a heavily obscured square blocks sight.
- Approach: a thicket is 4 or more woody understory items (`TreeSmall`, `Undergrowth` but ferns) anchored within 2 squares of a square's centre, dry; 2 or more large trunks within 2.4 squares is light, however many. One pure function, `output::sight`, replaces the inline canopy count in `square_rules`.
- Rejected: keeping a canopy threshold for heavy at a higher count (a closed canopy is overhead foliage, not eye-level cover; any count leaves the interior of a dense wood blind).
- Rejected: a thicket from the cell's `forest_density` or `Woods::edge` fields (coarse; the placed items are what the picture shows and what the scene's cover reads).
- Rejected: light from understory alone; the ruling concerns `heavy`, and scrub would read differently from today with no ask behind it.
- Tuning: candidate counts and radii measured on 14 cells of the kit world from the placements (4 dense woods, 3 mid-density woods, 2 cleared, 3 scrub, 1 grass); 4 within 2 squares gives 0 to 1 % of a dense wood and 1 to 3 % of a scrubby edge.
- Measured on the kit world, before and after: cell (479, 1245) heavy 90.7 % → 0.2 %, light 9.3 % → 99.8 %, squares visible within 60 ft of its centre 8/440 → 440/440; dense woods (632, 1160), (560, 776), (560, 1160) heavy 88.8, 90.0, 86.8 % → 0.0, 0.0, 1.1 %.
- Kit: `tactical-cell`, `tactical-scene-day`, `tactical-scene-night` goldens and the `tactical-window` hash re-recorded; every image, dungeon and site case unchanged.
- Tests: `output::tests` (closed canopy light, a thicket heavy, three shrubs or ferns no thicket, the 2-square radius, water and reeds, open ground clear).
- Process: the user was away; spec and plan written from the DiceMaster session's brief without the approval gates; the pull request is the gate.
- `logic/09` §rules-sidecar: the two rows and the thicket definition. `API.md` scene `obscured`. `arda-refine` README.

## 2026-11-14 - implement: 2026-11-14-dungeon-sites
key: implement/2026-11-14-dungeon-sites@Q12

Expand Down
6 changes: 4 additions & 2 deletions docs/capstone/logic/09-tactical-refinement.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ Per-square SRD rules are written into the `arda-scene` `RulesSidecar` (format 2,
| `difficult` | `true` where the ground is `scrub`, `heath` (undergrowth), `scree`, `mud`, `mudflat`, `marsh`, `reed_bed`, `snow`, `ice` or `cliff`, or the water is wadeable | SRD 5.1 difficult terrain examples (undergrowth, snow, shallow bogs, rubble); the key mapping is assumed |
| `water_depth_ft` | always (equal to the layout's) | §linear-features |
| `cover` | on the square an item is anchored in: trunk of a large tree or a boulder → `three_quarters`; an outcrop → `total`; small tree, rock or log → `half`; the scene takes the stronger of this and the catalogue's | SRD 5.1 cover ("a narrow tree trunk" half, "a thick tree trunk" three-quarters); boulder mapping assumed |
| `blocks_sight` | `true` where 4 or more large trunks stand within 2.4 squares (dense foliage, heavily obscured) | SRD 5.1 obscurement; threshold assumed |
| `lightly_obscured` | `true` for 2–3 trunks within 2.4 squares, or `reed_bed` | SRD 5.1 "moderate foliage"; threshold assumed |
| `blocks_sight` | `true` on a dry **thicket** square: 4 or more woody understory items (a small or stunted tree, a bush, juniper, krummholz or sagebrush; not a fern) anchored within 2 squares of its centre | SRD 5.1 "dense foliage" (heavily obscured); the DiceMaster ruling of 2026-11-14 that only thickets are heavy; count tuned on the MICRO-42 kit world |
| `lightly_obscured` | `true` on a dry square with 2 or more large trunks within 2.4 squares (a wood's canopy, however closed), or `reed_bed`; never on a thicket square, which is heavy | SRD 5.1 "moderate foliage"; threshold assumed |
| `blocks_movement` | never: a boulder, large rock or outcrop blocks by its catalogue footprint (review 3.4-1, which also ends refine's own 3 × 3 outcrop walls drawn from items anchored next door; review 3.4-6's invisible walls at layout edges cannot recur, `tests/schema.rs` pins that refine states no blocking) | 12 §scene-movement |

A **thicket** is dense woody growth at eye level, which is what SRD 5.1's "dense foliage" hides a creature in; a closed canopy is foliage overhead, under which a creature is only lightly obscured (until 2026-11-14 four or more trunks within 2.4 squares blocked sight, which left a dense wood about 90 % heavy and a creature in it seeing about 2 % of the squares within 60 ft). Woody understory is what the scatter places from the `TreeSmall` and `Undergrowth` layers, whose density rises at wood edges (`Woods::edge`), in scrub (`Eco::scrub`) and with canopy (`crates/arda-refine/src/density.rs`); ferns on a closed wood's floor do not count. The hard-core spacing of those layers (grid 1.6 to 1.8 squares) makes 4 items within 2 squares a local clump: on the MICRO-42 kit world a dense wood is 0 to 1 % thicket and a scrubby wood edge 1 to 3 % (`crates/arda-refine/src/output.rs` `sight`).

Wading and swimming are derived by the scene from depth (12 §scene-movement), not set here.

### §hash
Expand Down
Loading