diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 738c480..37d7b2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,6 +26,11 @@ jobs: run: | set -o pipefail gradle --no-daemon build --stacktrace 2>&1 | tee build-verification.log + - name: Verify distribution and export actual reference blocks + shell: bash + run: | + python3 scripts/verify-artifact.py fabric/build/libs/castleforge-fabric-0.3.0-alpha.3.jar + java -Xmx512m -cp core/build/classes/java/main:core/build/classes/java/test dev.castleforge.core.ReferenceExport build/reference - uses: actions/upload-artifact@v4 with: name: castleforge-fabric-26.1.2 @@ -39,4 +44,7 @@ jobs: build-verification.log core/build/reports/ fabric/build/reports/ + build/reference/ + build/JAR_SHA256.txt if-no-files-found: warn + diff --git a/.gitignore b/.gitignore index e808685..1baa5ca 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,12 @@ .vscode/ *.iml *.class +__pycache__/ +*.pyc *.log *.jar *.zip !gradle/wrapper/gradle-wrapper.jar hs_err_pid* replay_pid* + diff --git a/README.md b/README.md index 8de1352..fbbfe48 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,49 @@ Terrain-aware procedural castles and independent culture regions for Minecraft. Original idea: Emre's brother. Concept and project direction: Emre (`badmon61`). -## Status: 0.2.1-alpha.1 — identity and architectural diagnostics +## Status: 0.3.0-alpha.3 - connected wall-walk study, not visually accepted + +**Experimental, opt-in, disposable test worlds only. No automatic generation.** + +**The owner rejected Falkenwacht v1's visual quality after an in-game trial.** +V2 adds real residential partitions, wider framed facade bays, roof lights, +gable joinery, a furnished court and corrected hall furniture proportions. +It remains a fixed-layout study, below the intended hand-built benchmark. +V3 adds a modeled three-wide wall-walk circuit through the four corner towers +and upper gatehouse, a court stair, explicit parapets and post-furnishing checks. +The independent elevated centreline is 340 blocks; this is not a measured +Minecraft traversal duration. See [v3 evidence and focused test](docs/REFERENCE_V3_WALLWALK.md). +See [the rejection and design decision](docs/ADR_0002_VISUAL_REJECTION_AND_DETAIL_STUDY.md), +[v2 comparison and evidence](docs/REFERENCE_V2_STUDY.md) and the preserved +[long-term product direction](docs/PRODUCT_DIRECTION.md). + +0.3 adds one independently authored reference castle, Falkenwacht. A typed +architecture model defines building masses, room functions, floor levels, +connections, stair flights, windows and roofs before any block placement. +The new module and interior passes create a dominant keep, a great hall, +residential/service wings, a framed gatehouse and a courtyard, with protected +routes and final geometry checks. No schematics or third-party templates. + +Use `/castleforge preview reference [x z]`. Snapshot and preflight work run over +several server ticks; pure planning runs on a bounded worker. **Wait for +`PREVIEW READY`**, then use `/castleforge inspect` and `/castleforge build confirm`. +The reference surveys 109 x 109 already-loaded columns; its default centre is +58 blocks north of you. `/castleforge status` reports preparation and placement; +`/castleforge cancel` also cancels reference preparation. + +This is one maintained central-European architectural study, independent of the +site's culture identity. Existing culture regions, 7x scale and saved settings +are unchanged. Furniture uses safe single-block primitives, not inventories or +multi-block beds/doors. Hearths are decorative. The original classic and terraced +paths remain available and retain their regression tests. + +See [reference architecture, limits and manual test](docs/REFERENCE_ARCHITECTURE.md), +[design decision](docs/ADR_0001_REFERENCE_ARCHITECTURE.md) and +[verification evidence](docs/REFERENCE_VALIDATION.md). Technical images are +rendered from generated block data; they are **not Minecraft screenshots or +proof of visual acceptance, block physics, actual collision shapes or FPS**. + +## Previously: 0.2.1-alpha.1 — identity and architectural diagnostics **New in 0.2.1:** Seed-stable, culture-dependent castle names and regional dynasties, symbolic heraldry, age, chronological construction milestones, and a condition-derived *planned* occupancy category. These are narrative metadata only: **no NPCs, loot, actual banners or timeline simulation are spawned**. The two existing castle shapes and culture map remain unchanged. Different regions may coincidentally share generated names; uniqueness is not promised. @@ -40,19 +82,25 @@ Automatic exploration-time generation; automatically measured biome scaling; arb Target remains **Minecraft Java 26.1.2**, **Java 25**, **Fabric Loader 0.19.5+**, **Fabric API 0.155.3+26.1.2**. 1. Use a separate Prism/Fabric instance and a new disposable Creative world with commands enabled. -2. Install `castleforge-fabric-0.2.1-alpha.1.jar` from a successful branch Actions build plus the matching Fabric API. Replace the old CastleForge JAR; do not install two versions or a `-sources.jar`. -3. Start on superflat to verify the build workflow, then test a second disposable world with open, gradual slopes. The new survey is 105 × 105 blocks; the whole site must already be loaded. +2. Install `castleforge-fabric-0.3.0-alpha.2.jar` from a successful branch Actions build plus the matching Fabric API. Replace the old CastleForge JAR; do not install two versions or a `-sources.jar`. +3. Start on superflat to verify the reference workflow, then test a second disposable world with shallow, open terrain. Reference uses a 109 × 109 survey; legacy terraced uses 105 × 105. The whole site must already be loaded. 4. Execute separately: ```mcfunction /castleforge region -/castleforge preview terraced +/castleforge preview reference +/castleforge status +``` + +After `PREVIEW READY`: + +```mcfunction /castleforge inspect /castleforge build confirm /castleforge status ``` -The default new site is centred 56 blocks north of you. Its entrance may face another direction because the planner rotates to fit terrain. Explicit coordinates work with `/castleforge preview terraced `. Preview is a **text report**, not a visual ghost building. Confirmation expires after 120 seconds. Stay near the entire build area. +Reference is centred 58 blocks north of you; legacy terraced is centred 56 blocks north. Reference orientation is deterministic from seed and position. Explicit coordinates work with `/castleforge preview reference ` and `/castleforge preview terraced `. Preview is a **text report**, not a visual ghost building. Confirmation expires 120 seconds after readiness. Stay near the entire build area. The original generator is still selected by `/castleforge preview` or `/castleforge preview `; its default centre remains 28 blocks north of you. @@ -63,7 +111,11 @@ The original generator is still selected by `/castleforge preview` or `/castlefo Cancel leaves a partial building. Undo only covers the last build in this server session and is lost on server shutdown, world close, crash or the next build. It skips conflicting later edits, with the documented exception for automatically recomputed stair shape. It does not journal every neighboring physics effect. **Undo is not a backup.** -All commands require moderator permission/cheats. No chunks are force-loaded. Terrain sampling and planning are bounded but synchronous: a preview can still briefly stall a tick. Placement uses the existing cooperative per-tick budget; a single Minecraft block update can exceed it. +All commands require moderator permission/cheats. No chunks are force-loaded. +Reference snapshot/preflight use cooperative tick budgets and its pure planner +runs on a worker. Legacy previews and final confirmation checks remain +synchronous. Placement uses the existing cooperative per-tick budget; a single +Minecraft operation can exceed it. This is not a hard real-time or FPS guarantee. ## Generation settings @@ -84,6 +136,17 @@ The CI uses pinned Gradle; a Gradle wrapper is not yet checked in. Pure generato bash scripts/verify-core.sh ``` +Windows PowerShell (JDK 21+ on PATH): + +```powershell +./scripts/verify-core.ps1 -ExportReference +``` + +The additional `verifyReference` suite checks the separate architecture and final +furnished blocks, deterministic rotations, bounded sites, deliberate invalid +fixtures and the terrain approach. Exact cases and results are recorded in +[reference validation](docs/REFERENCE_VALIDATION.md). + The classic suite checks 50 seeds. A third suite checks narrative identities across 100 seeds and eight cultures, coherent chronology, region-level dynasties, diagnostic counts and reporting. The new suite checks **32 seeds × 5 synthetic terrains = 160 combinations**, all eight culture profiles, all four rotations, roofs and condition states, determinism, navigation, bounded supports, rejection cases, negative/world-edge coordinates and concurrent planning. A golden geometry digest detects unintended generator drift. Repeated per-voxel assertions are not millions of different test scenarios. Passing these checks is **not a Minecraft launch, entity-pathfinding, block-physics or visual test**. See [terraced architecture and acceptance checklist](docs/TERRACED_ARCHITECTURE.md), [original architecture](docs/ARCHITECTURE.md), [classic test checklist](docs/TESTING.md), [initial alpha validation](docs/VALIDATION.md), and [long-term roadmap](docs/ROADMAP.md). @@ -93,3 +156,4 @@ Passing these checks is **not a Minecraft launch, entity-pathfinding, block-phys A redistribution license has not been selected. Public visibility does not grant a redistribution license. No Mojang binaries, third-party schematics or texture assets are included. Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft. + diff --git a/build.gradle b/build.gradle index 76d59af..9b67b2c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,8 @@ plugins { } allprojects { group = 'dev.castleforge' - version = '0.2.1-alpha.1' + version = '0.3.0-alpha.3' repositories { mavenCentral() } } tasks.named('build') { dependsOn ':core:build', ':fabric:build' } + diff --git a/core/build.gradle b/core/build.gradle index 057dcca..fd0ac12 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -23,4 +23,13 @@ tasks.register('verifyIdentity', JavaExec) { maxHeapSize = '512m' mustRunAfter verifyTerraces } -tasks.named('check') { dependsOn verifyCore, verifyTerraces, verifyIdentity } +tasks.register('verifyReference', JavaExec) { + dependsOn testClasses + classpath = sourceSets.test.runtimeClasspath + mainClass = 'dev.castleforge.core.ReferenceVerification' + maxHeapSize = '512m' + mustRunAfter verifyIdentity +} + +tasks.named('check') { dependsOn verifyCore, verifyTerraces, verifyIdentity, verifyReference } + diff --git a/core/src/main/java/dev/castleforge/core/architecture/ArchitecturalDetails.java b/core/src/main/java/dev/castleforge/core/architecture/ArchitecturalDetails.java new file mode 100644 index 0000000..7f3fc8e --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/ArchitecturalDetails.java @@ -0,0 +1,127 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import static dev.castleforge.core.architecture.ArchitectureModel.*; +import static dev.castleforge.core.architecture.ReferenceBlock.*; + +/** Original masonry/joinery vocabulary applied to declared bays, partitions and court ensembles. */ +final class ArchitecturalDetails { + static void build(ArchitectureModel model,OwnedBlockBuffer b) { + for(Partition p:model.partitions()) { + Box a=p.wall(); + for(int x=a.minX();x<=a.maxX();x++)for(int z=a.minZ();z<=a.maxZ();z++)for(int y=a.minY();y<=a.maxY();y++) { + Pos pos=new Pos(x,y,z); + if(p.portals().stream().anyMatch(portal->portal.contains(pos))) continue; + boolean post=a.width()==1?Math.floorMod(z-a.minZ(),4)==0:Math.floorMod(x-a.minX(),4)==0; + b.put(p.moduleId(),x,y,z,post||y==a.maxY()?Kind.TIMBER:Kind.PLASTER); + } + } + for(FacadeBay bay:model.facadeBays())bay(bay,b); + gableJoinery(model,b); + hallStructure(model,b); + for(Dormer d:model.dormers())dormer(d,b); + for(CourtFeature f:model.courtFeatures())court(f,b); + } + private static void gableJoinery(ArchitectureModel model,OwnedBlockBuffer b) { + for(String id:new String[]{"residence","service"}) { + var m=model.module(id);Box a=m.bounds();int mid=(a.minX()+a.maxX())/2; + for(int z:new int[]{a.minZ(),a.maxZ()})for(int x=a.minX();x<=a.maxX();x++)for(int y=a.maxY()+1;y<=a.maxY()+12;y++) { + Pos p=new Pos(x,y,z);ReferenceBlock old=b.at(p); + if(old==null||old.kind()!=Kind.STONE)continue; + boolean frame=x==mid||y==a.maxY()+2||Math.abs(x-mid)==y-a.maxY()-2; + b.put(id,x,y,z,frame?Kind.TIMBER:Kind.PLASTER); + } + } + } + private static void dormer(Dormer d,OwnedBlockBuffer b) { + int front=d.frontX(),mid=d.centerZ(),base=d.baseY();String id=d.moduleId(); + // The rear edge meets the existing roof at its own height. No cross-owner crop or overwrite. + for(int x=front-4;x<=front;x++)for(int z=mid-2;z<=mid+2;z++) { + int oldRoof=base-1+front-x; + for(int y=oldRoof+1;y<=base+3;y++) { + boolean frontWall=x==front,side=Math.abs(z-mid)==2; + b.put(id,x,y,z,frontWall?(side||y==base?Kind.TIMBER:Kind.GLASS):side?Kind.TIMBER:Kind.AIR); + } + } + for(int x=front-4;x<=front+1;x++)for(int z=mid-3;z<=mid+3;z++) { + int y=base+3+(3-Math.abs(z-mid)); + // Preserve the dominant roof where it rises above the subordinate eave. + int parentRoof=base-1+front-x; + if(y<=parentRoof)continue; + if(x==front)for(int fill=base+4;filla.maxY()+1)b.put(id,cx+tx*t,a.maxY()+1,cz+tz*t,Kind.TRIM); + } + } + private static void hallStructure(ArchitectureModel model,OwnedBlockBuffer b) { + var hall=model.module("hall");Box a=hall.bounds(); + // Buttresses are between the window bays; capitals align with the cornice and roof trusses. + for(int x:new int[]{-18,-12,-6,0,6,12})for(int z:new int[]{a.minZ()-1,a.maxZ()+1}) { + if(x==0&&z==a.maxZ()+1)continue; // principal portal + for(int y=0;y<=12;y++)b.put("hall",x,y,z,y==0||y==4||y==11?Kind.TRIM:Kind.STONE); + b.put("hall",x,13,z,Kind.STONE_SLAB); + } + for(int x=a.minX()+1;x { + for(int x=cx-1;x<=cx+1;x++)for(int z=cz-1;z<=cz+1;z++) + b.put(id,x,1,z,x==cx&&z==cz?Kind.ROOF:Kind.TRIM); + for(int x:new int[]{cx-2,cx+2})for(int y=1;y<=5;y++)b.put(id,x,y,cz,Kind.TIMBER); + for(int x=cx-2;x<=cx+2;x++)b.put(id,x,5,cz,Kind.TIMBER,Facing.EAST); + b.put(id,cx,4,cz,Kind.TIMBER); // stylized covered winch, no fluid or moving block + for(int x=a.minX();x<=a.maxX();x++)for(int z=cz-2;z<=cz+2;z++) { + int h=5+(2-Math.abs(z-cz)); + b.put(id,x,h-1,z,Kind.ROOF); + b.put(id,x,h,z,z==cz?Kind.ROOF_SLAB:Kind.ROOF_STAIRS,z==cz?Facing.NONE:z { + for(int x=a.minX();x<=a.maxX();x++)for(int z=a.minZ();z<=a.maxZ();z++) { + boolean edge=x==a.minX()||x==a.maxX()||z==a.minZ()||z==a.maxZ(); + if(edge)b.put(id,x,1,z,Kind.STONE_SLAB); + else if(x!=cx&&z!=cz)b.put(id,x,0,z,Kind.GARDEN); + } + for(int x:new int[]{a.minX()+2,a.maxX()-2})b.put(id,x,1,cz,Kind.WOOD_STAIRS,Facing.SOUTH); + } + case SEATING_ARBOR -> { + for(int x:new int[]{a.minX(),a.maxX()})for(int z:new int[]{a.minZ(),a.maxZ()}) + b.box(id,x,1,z,x,5,z,Kind.TIMBER); + for(int x=a.minX();x<=a.maxX();x++)for(int z:new int[]{a.minZ(),a.maxZ()})b.put(id,x,5,z,Kind.TIMBER,Facing.EAST); + for(int x=a.minX();x<=a.maxX();x+=2)for(int z=a.minZ();z<=a.maxZ();z++)b.put(id,x,6,z,Kind.TIMBER,Facing.NORTH); + for(int x=a.minX()+1;x modules, List rooms, + List connections,List stairs,List windows, + Set clearance,Set circulation,Pos entrance, + List partitions,List facadeBays,List courtFeatures,List dormers, + List wallWalks) { + public ArchitectureModel { + modules=List.copyOf(modules);rooms=List.copyOf(rooms);connections=List.copyOf(connections); + stairs=List.copyOf(stairs);windows=List.copyOf(windows); + clearance=Collections.unmodifiableSet(new LinkedHashSet<>(clearance)); + circulation=Collections.unmodifiableSet(new LinkedHashSet<>(circulation)); + partitions=List.copyOf(partitions);facadeBays=List.copyOf(facadeBays);courtFeatures=List.copyOf(courtFeatures); + dormers=List.copyOf(dormers); + wallWalks=List.copyOf(wallWalks); + } + public enum ModuleType { KEEP, GREAT_HALL, RESIDENCE, SERVICE_WING, GATEHOUSE, CORNER_TOWER, CURTAIN, WALL_STAIR } + public enum RoomType { GREAT_HALL, KITCHEN, BEDCHAMBER, LIBRARY, STORE, GUARDROOM, STAIR_HALL, SOLAR } + public enum RoofType { GABLE_X, GABLE_Z, HIP, BATTLEMENT } + public record Box(int minX,int minY,int minZ,int maxX,int maxY,int maxZ) { + public Box { if(minX>maxX||minY>maxY||minZ>maxZ)throw new IllegalArgumentException("Inverted box"); } + public boolean contains(Pos p) { return p.x()>=minX&&p.x()<=maxX&&p.y()>=minY&&p.y()<=maxY&&p.z()>=minZ&&p.z()<=maxZ; } + public boolean overlaps(Box b) { return minX<=b.maxX&&maxX>=b.minX&&minY<=b.maxY&&maxY>=b.minY&&minZ<=b.maxZ&&maxZ>=b.minZ; } + public int width(){return maxX-minX+1;} public int depth(){return maxZ-minZ+1;} + } + public record Module(String id,ModuleType type,Box bounds,List floors,RoofType roof,int chamfer) { + public Module { floors=List.copyOf(floors); } + public boolean footprint(int x,int z) { + if(xbounds.maxX||zbounds.maxZ)return false; + int edgeX=Math.min(x-bounds.minX,bounds.maxX-x),edgeZ=Math.min(z-bounds.minZ,bounds.maxZ-z); + return edgeX+edgeZ>=chamfer; + } + public boolean inside(int x,int z) { return footprint(x,z)&&footprint(x-1,z)&&footprint(x+1,z)&&footprint(x,z-1)&&footprint(x,z+1); } + } + public record Room(String id,String moduleId,RoomType type,Box interior,int floorY,Pos target) {} + /** Explicit owner pair and air aperture, including a two-block-thick shared junction where necessary. */ + public record Connection(String id,String from,String to,Box aperture) {} + /** Treads are ordered bottom-to-top, each list contains the full usable tread width. */ + public record StairFlight(String id,String moduleId,Facing facing,List> treads) { + public StairFlight { treads=treads.stream().map(List::copyOf).toList(); } + } + public record Window(String moduleId,Box opening,Facing outward) {} + /** A real interior wall; its open portals are reserved before furnishing, not carved afterwards. */ + public record Partition(String id,String moduleId,Box wall,List portals) { + public Partition { portals=List.copyOf(portals); } + } + public enum BayStyle { HALL_LANCET, CHAMBER_CASEMENT } + /** Planned facade depth and a declared window, independently inspectable before emission. */ + public record FacadeBay(String id,Window window,BayStyle style,Box envelope) {} + public enum CourtUse { COVERED_WELL, HERB_GARDEN, SEATING_ARBOR } + public record CourtFeature(String id,CourtUse use,Box bounds) {} + /** Small east-facing roof light, with an explicit owned roof junction; not a declared habitable room. */ + public record Dormer(String id,String moduleId,int frontX,int centerZ,int baseY) {} + /** Explicit deck/support cells and parapets/merlons. Routes remain part of global circulation. */ + public record WallWalk(String id,String moduleId,Set deck,Set guards) { + public WallWalk { + deck=Collections.unmodifiableSet(new LinkedHashSet<>(deck)); + guards=Collections.unmodifiableSet(new LinkedHashSet<>(guards)); + } + } + public Module module(String id) { return modules.stream().filter(m->m.id.equals(id)).findFirst().orElseThrow(); } +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/InteriorDesigner.java b/core/src/main/java/dev/castleforge/core/architecture/InteriorDesigner.java new file mode 100644 index 0000000..c9d109c --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/InteriorDesigner.java @@ -0,0 +1,305 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import java.util.*; +import static dev.castleforge.core.architecture.ArchitectureModel.*; +import static dev.castleforge.core.architecture.ReferenceBlock.*; + +/** Authored furniture groups. They are decorative solids, never inventories, beds or live fire. */ +final class InteriorDesigner { + private record Detail(int x,int y,int z,Kind kind,Facing facing) {} + + static void furnish(ArchitectureModel model,OwnedBlockBuffer blocks,long seed) { + Designer d=new Designer(model,blocks); + for(Room room:model.rooms()) { + if(room.type()==RoomType.GREAT_HALL) d.greatHall(room); + else d.room(room); + d.requireFunction(room); + } + } + + private static final class Designer { + private final ArchitectureModel model; + private final OwnedBlockBuffer blocks; + private final Map> furniture=new HashMap<>(); + Designer(ArchitectureModel model,OwnedBlockBuffer blocks){this.model=model;this.blocks=blocks;} + + void greatHall(Room r) { + int f=r.floorY(); + // Long-axis dining arrangement leaves the southern processional aisle completely free. + for(int[] span:new int[][]{{-13,-6},{-2,6}}) { + table(r,span[0],f+1,-25,span[1],-24); + bench(r,span[0],f+1,-27,span[1],Facing.NORTH); + bench(r,span[0],f+1,-22,span[1],Facing.SOUTH); + } + counter(r,-18,f+1,-28,-17,-21); + List tapestry=new ArrayList<>(); + box(tapestry,-19,3,-26,-19,7,-23,Kind.WOOL); + box(tapestry,-19,8,-27,-19,8,-22,Kind.TIMBER); + place(r,tapestry); + // A deliberate processional floor band, separate from the dining setting. + for(int x=-18;x<=15;x++)for(int z=-16;z<=-14;z++)blocks.put(r.moduleId(),x,f,z,z==-15?Kind.WOOL:Kind.TRIM); + fireplace(r,11,f+1,-27); + List dais=new ArrayList<>(); + box(dais,12,f+1,-24,15,f+1,-18,Kind.PLANKS); + for(int z=-23;z<=-19;z++) { + add(dais,12,f+2,z,Kind.TIMBER); + add(dais,12,f+3,z,Kind.SLAB); + } + for(int z:new int[]{-22,-20}) add(dais,14,f+2,z,Kind.WOOD_STAIRS,Facing.EAST); + place(r,dais); + // Visible transverse roof structure, with suspended lighting below each beam. + for(int x:new int[]{-18,-12,-6,0,6}) { + List truss=new ArrayList<>(); + for(int z=-29;z<=-12;z++) add(truss,x,f+12,z,Kind.TIMBER,Facing.NORTH); + for(int y=f+8;y pendant=new ArrayList<>(); + int toward=wallZ==-29?1:-1; + for(int n=0;n<=2;n++)add(pendant,x,5,wallZ+n*toward,Kind.TIMBER,Facing.NORTH); + add(pendant,x,4,wallZ+2*toward,Kind.LANTERN);place(r,pendant); + } + } + } + + void room(Room r) { + Box b=r.interior();int f=r.floorY(),x=b.minX()+1,z=b.minZ()+1; + if(r.id().startsWith("chamber-")||r.id().startsWith("study-")) { + fittedChamber(r); + return; + } + switch(r.type()) { + case KITCHEN -> { + counter(r,x,f+1,z,Math.min(x+9,b.maxX()-1),z+1); + fireplace(r,b.maxX()-5,f+1,b.minZ()+1); + table(r,x,f+1,b.maxZ()-5,Math.min(x+6,b.maxX()-1),b.maxZ()-3); + rack(r,b.maxX()-3,f+1,b.maxZ()-5,3); + } + case STORE -> { + for(int dx:new int[]{0,4,8}) for(int dz:new int[]{0,5}) + crate(r,x+dx,f+1,z+dz,1+Math.floorMod(dx+dz,2)); + rack(r,b.maxX()-3,f+1,b.maxZ()-7,5); + } + case LIBRARY -> { + bookcase(r,x,f+1,z,Math.min(11,b.width()-4),true); + bookcase(r,x,f+1,z+4,Math.min(7,b.depth()-7),false); + table(r,b.maxX()-7,f+1,b.maxZ()-5,b.maxX()-3,b.maxZ()-3); + bench(r,b.maxX()-7,f+1,b.maxZ()-1,b.maxX()-3,Facing.SOUTH); + } + case BEDCHAMBER -> { + sleepingPlatform(r,x,f+1,z); + sleepingPlatform(r,b.maxX()-4,f+1,z); + table(r,b.maxX()-7,f+1,b.maxZ()-5,b.maxX()-3,b.maxZ()-4); + bookcase(r,x,f+1,b.maxZ()-2,5,true); + } + case GUARDROOM -> { + table(r,x,f+1,z,x+5,z+2); + bench(r,x,f+1,z+4,x+5,Facing.SOUTH); + crate(r,b.maxX()-3,f+1,b.maxZ()-3,2); + rack(r,b.maxX()-3,f+1,z+1,4); + } + case SOLAR -> { + bookcase(r,x,f+1,z,Math.min(7,b.width()-4),true); + table(r,b.maxX()-7,f+1,b.maxZ()-5,b.maxX()-3,b.maxZ()-3); + bench(r,x,f+1,b.maxZ()-2,Math.min(x+6,b.maxX()-1),Facing.SOUTH); + } + case STAIR_HALL -> bench(r,x,f+1,b.maxZ()-2,Math.min(x+4,b.maxX()-1),Facing.SOUTH); + default -> {} + } + // Deliberately fitted groups in the asymmetric wings. These use the actual room's free bays, + // not a generic corner that may be occupied by the circulation spine or switchback stair. + switch(r.id()) { + case "residence-0" -> { + table(r,27,f+1,-10,32,-8); + bench(r,27,f+1,-6,32,Facing.SOUTH); + } + case "residence-8" -> { + sleepingPlatform(r,28,f+1,-10); + sleepingPlatform(r,32,f+1,-4); + } + case "kitchen-room" -> counter(r,27,f+1,10,28,16); + case "northwest-guard" -> crate(r,-47,f+1,-38,2); + case "northeast-guard" -> crate(r,46,f+1,-38,2); + case "southwest-guard" -> crate(r,-47,f+1,36,2); + case "southeast-guard" -> crate(r,46,f+1,36,2); + case "gate-watch" -> bench(r,8,f+1,33,9,Facing.SOUTH); + default -> {} + } + // A short ceiling tie and two lamps. Skip the entire group if it crosses the stair clearance. + int beamY=Math.min(f+6,b.maxY()); + if(beamY>=f+5) { + int midZ=(b.minZ()+b.maxZ())/2; + List tie=new ArrayList<>(); + for(int bx=b.minX();bx<=b.maxX();bx++)add(tie,bx,beamY,midZ,Kind.TIMBER,Facing.EAST); + add(tie,b.minX()+2,beamY-1,midZ,Kind.LANTERN); + add(tie,b.maxX()-2,beamY-1,midZ,Kind.LANTERN); + place(r,tie); + } + // Individual hanging lamps remain possible when a stairwell prevents the full tie beam. + for(int lx:new int[]{b.minX()+2,b.maxX()-2})for(int lz:new int[]{b.minZ()+2,b.maxZ()-2}) { + int y=Math.min(f+5,b.maxY()-1); + if(y bracket=new ArrayList<>(); + int wallEnd=lx==b.minX()+2?b.minX():b.maxX(); + for(int bx=Math.min(lx,wallEnd);bx<=Math.max(lx,wallEnd);bx++) + add(bracket,bx,y+1,lz,Kind.TIMBER,Facing.EAST); + add(bracket,lx,y,lz,Kind.LANTERN); + place(r,bracket); + } + } + + void fittedChamber(Room r) { + Box a=r.interior();int f=r.floorY(); + // These six rooms have actual partitions. Keep the three-wide western doorway free. + if(r.id().startsWith("chamber-")) { + switch(r.type()) { + case BEDCHAMBER -> { + sleepingPlatform(r,32,f+1,-11); + bookcase(r,28,f+1,-12,3,true); + List canopy=new ArrayList<>(); + for(int x:new int[]{31,34})for(int z:new int[]{-12,-7})for(int y=f+1;y<=f+5;y++)add(canopy,x,y,z,Kind.TIMBER); + box(canopy,31,f+5,-12,34,f+5,-7,Kind.SLAB);place(r,canopy); + } + case LIBRARY -> { + bookcase(r,28,f+1,-11,7,true); + table(r,31,f+1,-7,33,-6); + bench(r,31,f+1,-5,33,Facing.SOUTH); + } + default -> { + table(r,31,f+1,-10,33,-9); + bench(r,31,f+1,-7,33,Facing.SOUTH); + rack(r,34,f+1,-12,5); + } + } + } else if(r.type()==RoomType.STORE) { + for(int x:new int[]{30,33})crate(r,x,f+1,-2,2); + } else { + bookcase(r,29,f+1,-3,6,true); + table(r,31,f+1,0,33,1); + bench(r,31,f+1,2,33,Facing.SOUTH); + } + List ceiling=new ArrayList<>(); + int beam=Math.min(f+6,a.maxY()); + for(int x=a.minX();x<=a.maxX();x++)add(ceiling,x,beam,a.minZ()+1,Kind.TIMBER,Facing.EAST); + add(ceiling,28,beam-1,a.minZ()+1,Kind.LANTERN); + place(r,ceiling); + } + + void requireFunction(Room room) { + EnumMap counts=furniture.getOrDefault(room.id(),new EnumMap<>(Kind.class)); + int planks=counts.getOrDefault(Kind.PLANKS,0),slabs=counts.getOrDefault(Kind.SLAB,0)+counts.getOrDefault(Kind.TABLE_TOP,0); + int seats=counts.getOrDefault(Kind.WOOD_STAIRS,0),books=counts.getOrDefault(Kind.BOOKSHELF,0); + boolean fitted=switch(room.type()) { + case GREAT_HALL -> slabs>=12&&seats>=8; + case KITCHEN,STORE -> planks>=4; + case BEDCHAMBER -> counts.getOrDefault(Kind.WOOL,0)>=6; + case LIBRARY -> books>=6; + case GUARDROOM -> planks>=4||seats>=2; + case SOLAR -> books>=2||slabs>=3||seats>=3; + case STAIR_HALL -> true; + }; + if(!fitted)throw new IllegalArgumentException("Room lacks functional furnishing: "+room.id()+" ("+room.type()+") "+counts); + } + + void table(Room r,int x1,int y,int z1,int x2,int z2) { + if(x2 group=new ArrayList<>(); + box(group,x1,y,z1,x2,y,z2,Kind.TABLE_TOP); + // Solid end supports meet the top slabs at one block above the floor, not 2.5 blocks. + add(group,x1,y,z1,Kind.TIMBER);add(group,x2,y,z2,Kind.TIMBER); + place(r,group); + } + void bench(Room r,int x1,int y,int z,int x2,Facing facing) { + List group=new ArrayList<>(); + for(int x=x1;x<=x2;x++)add(group,x,y,z,Kind.WOOD_STAIRS,facing); + place(r,group); + } + void counter(Room r,int x1,int y,int z1,int x2,int z2) { + List group=new ArrayList<>(); + box(group,x1,y,z1,x2,y,z2,Kind.PLANKS); + box(group,x1,y+1,z1,x2,y+1,z2,Kind.SLAB); + place(r,group); + } + void crate(Room r,int x,int y,int z,int height) { + List group=new ArrayList<>();box(group,x,y,z,x+1,y+height-1,z+1,Kind.PLANKS); + add(group,x,y+height,z,Kind.SLAB);add(group,x+1,y+height,z,Kind.SLAB); + place(r,group); + } + void rack(Room r,int x,int y,int z,int length) { + List group=new ArrayList<>(); + box(group,x,y,z,x,y+3,z,Kind.TIMBER); + box(group,x,y,z+length,x,y+3,z+length,Kind.TIMBER); + for(int dz=1;dz group=new ArrayList<>(); + for(int i=0;i group=new ArrayList<>(); + box(group,x,y,z,x+1,y,z+3,Kind.PLANKS); + box(group,x,y+1,z+1,x+1,y+1,z+3,Kind.WOOL); + box(group,x,y+1,z,x+1,y+2,z,Kind.TIMBER); + place(r,group); + } + void fireplace(Room r,int x,int y,int z) { + List group=new ArrayList<>(); + // A safe glowing hearth niche; no fire tick, smoke entity or inventory. + box(group,x,y,z,x+4,y+4,z,Kind.STONE); + box(group,x,y,z+1,x,y+3,z+2,Kind.TRIM); + box(group,x+4,y,z+1,x+4,y+3,z+2,Kind.TRIM); + box(group,x+1,y,z+1,x+3,y,z+2,Kind.STONE); + box(group,x+1,y+3,z+1,x+3,y+3,z+2,Kind.TRIM); + add(group,x+2,y+2,z+1,Kind.LANTERN); + place(r,group); + } + + /** No partial furniture groups or untracked overwrites: reserve the whole ensemble bounding volume. */ + boolean place(Room room,List group) { + if(group.isEmpty())return false; + var module=model.module(room.moduleId()); + int minX=Integer.MAX_VALUE,minY=minX,minZ=minX,maxX=Integer.MIN_VALUE,maxY=maxX,maxZ=maxX; + Map unique=new LinkedHashMap<>(); + for(Detail d:group) { + Pos p=new Pos(d.x,d.y,d.z);unique.put(p,d); + if(!module.inside(d.x,d.z)||d.y<=room.floorY()||d.y>module.bounds().maxY())return false; + // Great-hall trusses extend into the roof volume; furnishings still stay in its footprint. + Box rb=room.interior(); + if(d.xrb.maxX()||d.zrb.maxZ())return false; + ReferenceBlock existing=blocks.at(p); + if(existing==null||existing.kind()!=Kind.AIR)return false; + minX=Math.min(minX,d.x);minY=Math.min(minY,d.y);minZ=Math.min(minZ,d.z); + maxX=Math.max(maxX,d.x);maxY=Math.max(maxY,d.y);maxZ=Math.max(maxZ,d.z); + } + for(int x=minX;x<=maxX;x++)for(int z=minZ;z<=maxZ;z++)for(int y=minY;y<=maxY;y++) + if(model.clearance().contains(new Pos(x,y,z)))return false; + // Full support above every hanging lantern is explicit in the ensemble or already structural. + for(Detail d:unique.values())if(d.kind==Kind.LANTERN) { + Pos support=new Pos(d.x,d.y+1,d.z);Detail planned=unique.get(support); + ReferenceBlock actual=blocks.at(support); + if(planned==null ? actual==null||!actual.fullCube() : !new ReferenceBlock(support,planned.kind,planned.facing).fullCube())return false; + } + for(Detail d:unique.values())blocks.put(room.moduleId(),d.x,d.y,d.z,d.kind,d.facing); + EnumMap counts=furniture.computeIfAbsent(room.id(),id->new EnumMap<>(Kind.class)); + for(Detail d:unique.values())counts.merge(d.kind,1,Integer::sum); + return true; + } + } + private static void add(List g,int x,int y,int z,Kind k){add(g,x,y,z,k,Facing.NONE);} + private static void add(List g,int x,int y,int z,Kind k,Facing f){g.add(new Detail(x,y,z,k,f));} + private static void box(List g,int x1,int y1,int z1,int x2,int y2,int z2,Kind k) { + for(int x=x1;x<=x2;x++)for(int z=z1;z<=z2;z++)for(int y=y1;y<=y2;y++)add(g,x,y,z,k); + } + private InteriorDesigner() {} +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/ModuleLibrary.java b/core/src/main/java/dev/castleforge/core/architecture/ModuleLibrary.java new file mode 100644 index 0000000..cff19c3 --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/ModuleLibrary.java @@ -0,0 +1,128 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import static dev.castleforge.core.architecture.ArchitectureModel.*; +import dev.castleforge.core.architecture.ArchitectureModel.Module; +import static dev.castleforge.core.architecture.ReferenceBlock.*; + +/** Original code-built masonry, articulated bays, roof shells and broad switchback stairs. */ +final class ModuleLibrary { + static void build(ArchitectureModel model,OwnedBlockBuffer b){ + for(Module m:model.modules())shell(model,m,b); + for(Module m:model.modules())roof(model,m,b); + for(Window w:model.windows())window(model,w,b); + ArchitecturalDetails.build(model,b); + WallWalkLibrary.build(model,b); + for(StairFlight f:model.stairs())flight(model,f,b); + for(Pos p:model.clearance())b.airIfEmpty("clearance",p.x(),p.y(),p.z()); + } + private static void shell(ArchitectureModel model,Module m,OwnedBlockBuffer b){ + if(m.type()==ModuleType.WALL_STAIR)return; + Box a=m.bounds();String id=m.id(); + for(int x=a.minX();x<=a.maxX();x++)for(int z=a.minZ();z<=a.maxZ();z++){ + if(!m.footprint(x,z))continue; + boolean wall=!m.inside(x,z);int height=wallHeight(m,x); + for(int y=0;y<=height;y++){ + Pos p=new Pos(x,y,z); + Kind k; + if(model.clearance().contains(p))k=Kind.AIR; + else if(m.type()==ModuleType.CURTAIN)k=y==0||y==height?Kind.TRIM:Kind.STONE; + else if(wall)k=y<=1||y==height||y%8==7?Kind.TRIM: + m.type()==ModuleType.RESIDENCE&&y>=8?Kind.PLASTER:Kind.STONE; + else if(m.floors().contains(y))k=Kind.PLANKS; + else k=Kind.AIR; + // Corner piers and restrained half-timber upper service/residential facades. + if(wall&&(k==Kind.STONE||k==Kind.PLASTER)&&(m.type()==ModuleType.RESIDENCE||m.id().equals("service"))&&y>=8 + &&(x==a.minX()||x==a.maxX())&&Math.floorMod(z-a.minZ(),6)==0)k=Kind.TIMBER; + b.put(id,x,y,z,k); + } + } + // Reinforced arch with a stepped intrados; this is an open passage, not an incomplete door block. + if(m.type()==ModuleType.GATEHOUSE){ + for(int z:new int[]{a.minZ(),a.maxZ()}){ + for(int x=-3;x<=3;x++){ + int h=8-Math.abs(x); + for(int y=1;y!other.id().equals(m.id())&&other.footprint(px,pz)))continue; + int rise=roof==RoofType.GABLE_X?dz:roof==RoofType.GABLE_Z?dx:Math.min(dx,dz); + int y=a.maxY()+1+rise; + // Explicit roof-abutment rule: the earlier dominant mass owns a shared eave column. + // Crop this subordinate overhang; never overwrite another module's roof or masonry. + if(b.occupiedByOther(m.id(),new Pos(x,y,z))||b.occupiedByOther(m.id(),new Pos(x,y-1,z)))continue; + Facing face=roof==RoofType.GABLE_X?(z<=(z1+z2)/2?Facing.SOUTH:Facing.NORTH) + :roof==RoofType.GABLE_Z?(x<=(x1+x2)/2?Facing.EAST:Facing.WEST) + :dx=Math.min(a.width(),a.depth())/2; + b.put(m.id(),x,y,z,ridge?Kind.ROOF_SLAB:Kind.ROOF_STAIRS, ridge?Facing.NONE:face); + // Gable masonry closes the end triangle; central timber expresses the ridge load. + boolean end=roof==RoofType.GABLE_X?(x==a.minX()||x==a.maxX()):(roof==RoofType.GABLE_Z&&(z==a.minZ()||z==a.maxZ())); + if(end)for(int fill=a.maxY()+1;fill claims=new LinkedHashMap<>(); + private final Set clearance; + OwnedBlockBuffer(Set clearance){this.clearance=clearance;} + ReferenceBlock at(Pos p){Claim c=claims.get(p);return c==null?null:c.block;} + boolean occupiedByOther(String owner,Pos p){Claim c=claims.get(p);return c!=null&&!c.owner.equals(owner)&&c.block.kind()!=Kind.AIR;} + void put(String owner,int x,int y,int z,Kind kind){put(owner,x,y,z,kind,Facing.NONE);} + void put(String owner,int x,int y,int z,Kind kind,Facing facing){ + ReferenceCastlePlanner.interrupted(); + Pos p=new Pos(x,y,z); + if(kind!=Kind.AIR&&clearance.contains(p))throw new IllegalArgumentException("Reserved route collision "+owner+" at "+p); + Claim old=claims.get(p); + // Empty outside air is deliberately ownerless. The common courtyard slab is an explicit base interface. + if(old!=null&&!old.owner.equals(owner)&&old.block.kind()!=Kind.AIR&&kind!=Kind.AIR + &&!(old.owner.equals("site")&&y<=0)) + throw new IllegalArgumentException("Module collision "+old.owner+" / "+owner+" at "+p); + if(old!=null&&!old.owner.equals(owner)&&old.block.kind()!=Kind.AIR&&kind==Kind.AIR) + throw new IllegalArgumentException("Cross-owner carving "+owner+" at "+p+" owned by "+old.owner); + claims.put(p,new Claim(owner,new ReferenceBlock(p,kind,facing))); + if(claims.size()>ReferenceCastlePlanner.MAX_BLOCKS)throw new IllegalArgumentException("Reference block budget exceeded"); + } + void airIfEmpty(String owner,int x,int y,int z){Pos p=new Pos(x,y,z);if(!claims.containsKey(p))put(owner,x,y,z,Kind.AIR);} + void box(String owner,int x1,int y1,int z1,int x2,int y2,int z2,Kind kind){ + for(int x=x1;x<=x2;x++)for(int z=z1;z<=z2;z++)for(int y=y1;y<=y2;y++)put(owner,x,y,z,kind); + } + List finish(){return claims.values().stream().map(Claim::block).sorted(Comparator + .comparingInt((ReferenceBlock b)->b.kind()==Kind.LANTERN?1:0) + .thenComparingInt(b->b.pos().y()).thenComparingInt(b->b.pos().z()).thenComparingInt(b->b.pos().x())).toList();} +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/QualityChecks.java b/core/src/main/java/dev/castleforge/core/architecture/QualityChecks.java new file mode 100644 index 0000000..df972dd --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/QualityChecks.java @@ -0,0 +1,327 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import dev.castleforge.core.architecture.ArchitectureModel.*; +import dev.castleforge.core.architecture.ReferenceBlock.Facing; +import dev.castleforge.core.architecture.ReferenceBlock.Kind; +import java.util.*; + +/** + * Conservative checks on the final, furnished local voxel plan. The navigation domain is the + * deliberately declared circulation graph: roofs and furniture cannot accidentally become shortcuts. + * This is an architecture contract, not an emulation of Minecraft collision shapes or entity AI. + */ +public final class QualityChecks { + private static final int MAX_CELLS = 200_000; + private QualityChecks() {} + + public static QualityReport verify(ArchitectureModel model, List localBlocks) { + Objects.requireNonNull(model, "model"); Objects.requireNonNull(localBlocks, "blocks"); + validateModel(model); + require(!localBlocks.isEmpty() && localBlocks.size() <= MAX_CELLS, "block budget", "count=" + localBlocks.size()); + Map blocks = new HashMap<>(); + Map placementIndex = new HashMap<>(); + int index = 0; + for (ReferenceBlock b : localBlocks) { + require(b != null, "null block", "plan"); + require(blocks.putIfAbsent(b.pos(), b) == null, "duplicate block", b.pos()); + require(!b.stair() || b.facing() != Facing.NONE, "stair facing", b.pos()); + placementIndex.put(b.pos(), index++); + } + for (Pos p : model.clearance()) air(blocks, p, "reserved clearance"); + for(Partition p:model.partitions()) { + Box a=p.wall(); + for(int x=a.minX();x<=a.maxX();x++)for(int z=a.minZ();z<=a.maxZ();z++)for(int y=a.minY();y<=a.maxY();y++) { + Pos pos=new Pos(x,y,z); + if(p.portals().stream().anyMatch(portal->portal.contains(pos)))air(blocks,pos,"partition portal "+p.id()); + else { + ReferenceBlock block=blocks.get(pos); + require(block!=null&&(block.kind()==Kind.TIMBER||block.kind()==Kind.PLASTER),"missing partition "+p.id(),pos); + } + } + } + for(FacadeBay bay:model.facadeBays()) { + Window w=bay.window();Box a=w.opening();int cx=(a.minX()+a.maxX())/2,cz=(a.minZ()+a.maxZ())/2; + int tx=w.outward().dz==0?0:1,tz=w.outward().dx==0?0:1; + for(int side:new int[]{-2,2}) { + Pos p=new Pos(cx+tx*side+w.outward().dx,a.minY(),cz+tz*side+w.outward().dz); + require(blocks.containsKey(p)&&blocks.get(p).kind()==Kind.TRIM,"missing facade reveal "+bay.id(),p); + } + } + for(Dormer d:model.dormers()) { + Pos glazing=new Pos(d.frontX(),d.baseY()+1,d.centerZ()); + require(blocks.containsKey(glazing)&&blocks.get(glazing).kind()==Kind.GLASS,"missing dormer glazing",d.id()); + air(blocks,offset(glazing,-1,0,0),"dormer interior "+d.id()); + Pos ridge=new Pos(d.frontX(),d.baseY()+6,d.centerZ()); + require(blocks.containsKey(ridge)&&blocks.get(ridge).kind()==Kind.ROOF_SLAB,"missing dormer ridge",d.id()); + } + for (Connection c : model.connections()) { + Box a = c.aperture(); + for (int x=a.minX(); x<=a.maxX(); x++) for (int z=a.minZ(); z<=a.maxZ(); z++) { + supported(blocks, new Pos(x,a.minY(),z), "connection floor " + c.id()); + for (int y=a.minY(); y<=a.maxY(); y++) air(blocks,new Pos(x,y,z),"connection " + c.id()); + } + } + for(WallWalk walk:model.wallWalks()) { + for(Pos deck:walk.deck()) { + ReferenceBlock block=blocks.get(deck); + require(block!=null&&(block.fullCube()||block.stair()),"wall-walk deck "+walk.id(),deck); + // The full route and its headroom are checked again after furniture below. + } + for(Pos guard:walk.guards()) { + ReferenceBlock block=blocks.get(guard),below=blocks.get(offset(guard,0,-1,0)); + require(block!=null&&block.fullCube(),"wall-walk guard "+walk.id(),guard); + require(below!=null&&below.fullCube(),"wall-walk guard support "+walk.id(),guard); + } + for(Pos deck:walk.deck())for(Facing side:List.of(Facing.NORTH,Facing.EAST,Facing.SOUTH,Facing.WEST)) { + boolean passage=false; + for(int dy=0;dy<=2;dy++)if(model.circulation().contains(offset(deck,side.dx,dy,side.dz)))passage=true; + if(!passage) { + Pos edge=offset(deck,side.dx,1,side.dz); + ReferenceBlock guard=blocks.get(edge); + require(guard!=null&&guard.fullCube(),"unguarded wall-walk edge "+walk.id(),edge); + } + } + } + for (StairFlight s : model.stairs()) verifyStair(model, blocks, s); + for (Window w : model.windows()) { + Box a=w.opening(); + for (int x=a.minX(); x<=a.maxX(); x++) for (int z=a.minZ(); z<=a.maxZ(); z++) for (int y=a.minY(); y<=a.maxY(); y++) { + Pos p=new Pos(x,y,z); ReferenceBlock b=blocks.get(p); + require(b != null && b.kind()==Kind.GLASS,"window glazing",p); + air(blocks,offset(p,w.outward().dx,0,w.outward().dz),"window exterior " + w.moduleId()); + air(blocks,offset(p,-w.outward().dx,0,-w.outward().dz),"window interior " + w.moduleId()); + } + } + for (ReferenceBlock b : localBlocks) if (b.kind()==Kind.LANTERN) { + ReferenceBlock above=blocks.get(offset(b.pos(),0,1,0)); + require(above != null && above.fullCube(),"hanging lantern support",b.pos()); + require(placementIndex.get(above.pos()) < placementIndex.get(b.pos()),"lantern placed before support",b.pos()); + } + verifyRoofs(blocks); + for (ArchitectureModel.Module m : model.modules()) if (m.roof()!=RoofType.BATTLEMENT) { + boolean present=localBlocks.stream().anyMatch(b -> isRoof(b.kind()) + && b.pos().y()>m.bounds().maxY() && m.footprint(b.pos().x(),b.pos().z())); + require(present,"missing module roof",m.id()); + } + for (Pos p : model.circulation()) { + supported(blocks,p,"circulation support"); + for (int y=0;y<3;y++) air(blocks,offset(p,0,y,0),"circulation headroom"); + } + require(model.circulation().contains(model.entrance()),"entrance outside circulation",model.entrance()); + Set reached=flood(model.circulation(),blocks,model.entrance()); + for (Room r : model.rooms()) require(reached.contains(r.target()),"unreachable room " + r.id(),r.target()); + require(reached.size()==model.circulation().size(),"disconnected circulation", + model.circulation().stream().filter(p->!reached.contains(p)).findFirst().orElse(null)); + return new QualityReport(model.modules().size(),model.rooms().size(),model.stairs().size(), + model.windows().size(),localBlocks.size(),model.rooms().size(),model.clearance().size()); + } + + /** Checks the semantic model independently of block emission. */ + public static void validateModel(ArchitectureModel model) { + require(model.variant()!=null && !model.variant().isBlank(),"missing variant","model"); + require(!model.modules().isEmpty(),"missing modules","model"); + Map modules=new LinkedHashMap<>(); + for (ArchitectureModel.Module m : model.modules()) { + require(m != null && m.id()!=null && !m.id().isBlank(),"module id","model"); + require(!m.id().equals("courtyard") && !m.id().equals("outside"),"reserved module id",m.id()); + require(modules.putIfAbsent(m.id(),m)==null,"duplicate module id",m.id()); + require(m.type()!=null && m.roof()!=null,"module type/roof",m.id()); + Box b=m.bounds(); + require(b!=null && b.width()>=3 && b.depth()>=3 && b.maxY()-b.minY()>=3,"module dimensions",m.id()); + require(m.chamfer()>=0 && m.chamfer()=b.minY() && floor+3<=b.maxY(),"floor outside module",m.id()+" floor="+floor); + require(floor>previous,"unordered or duplicate floors",m.id()); previous=floor; + } + } + for (int i=0;i roomIds=new HashSet<>(); + for (Room r : model.rooms()) { + require(r != null && r.id()!=null && !r.id().isBlank() && roomIds.add(r.id()),"duplicate/invalid room id",r); + var m=modules.get(r.moduleId()); + require(m!=null,"unknown room owner",r.id()); + require(r.type()!=null && r.interior()!=null && r.target()!=null,"incomplete room",r.id()); + require(m.floors().contains(r.floorY()),"undeclared room floor",r.id()); + Box a=r.interior();Box b=m.bounds(); + require(a.minY()>=r.floorY()+1 && a.maxY()<=b.maxY(),"room vertical bounds",r.id()); + require(a.minY()<=r.floorY()+1 && a.maxY()>=r.floorY()+3,"room clear height",r.id()); + for (int x : new int[]{a.minX(),a.maxX()}) for (int z : new int[]{a.minZ(),a.maxZ()}) + require(m.inside(x,z),"room outside module interior",r.id()); + require(a.contains(r.target()) && r.target().y()==r.floorY()+1,"room target outside interior",r.id()); + } + for (int i=0;i connectionIds=new HashSet<>(); + Map> graph=new HashMap<>(); + for (Connection c : model.connections()) { + require(c!=null && c.id()!=null && connectionIds.add(c.id()),"duplicate/invalid connection id",c); + require(endpoint(modules,c.from()) && endpoint(modules,c.to()) && !c.from().equals(c.to()),"connection owners",c.id()); + Box a=c.aperture(); + require(a!=null && a.maxY()-a.minY()>=2 && Math.max(a.width(),a.depth())>=2,"connection clearance dimensions",c.id()); + for (String owner : List.of(c.from(),c.to())) if (modules.containsKey(owner)) + require(modules.get(owner).bounds().overlaps(a),"connection misses owner",c.id()+" / "+owner); + graph.computeIfAbsent(c.from(),k->new HashSet<>()).add(c.to()); + graph.computeIfAbsent(c.to(),k->new HashSet<>()).add(c.from()); + } + Set connected=new HashSet<>(); ArrayDeque queue=new ArrayDeque<>(); + connected.add("courtyard");queue.add("courtyard"); + while(!queue.isEmpty()) for(String next:graph.getOrDefault(queue.removeFirst(),Set.of())) if(connected.add(next)) queue.addLast(next); + for(Room r:model.rooms()) require(connected.contains(r.moduleId()),"disconnected module",r.moduleId()); + Set stairIds=new HashSet<>(); + Set detailIds=new HashSet<>(); + Set walkDeck=new HashSet<>(),walkGuards=new HashSet<>(); + for(WallWalk walk:model.wallWalks()) { + require(walk!=null&&walk.id()!=null&&detailIds.add(walk.id()),"wall-walk identity",walk); + var owner=modules.get(walk.moduleId()); + require(owner!=null&&!walk.deck().isEmpty()&&!walk.guards().isEmpty(),"wall-walk owner/program",walk.id()); + Box a=owner.bounds(); + for(Pos p:walk.deck()) { + require(walkDeck.add(p),"duplicate wall-walk deck",p); + require(p.x()>=a.minX()-2&&p.x()<=a.maxX()+2&&p.z()>=a.minZ()-2&&p.z()<=a.maxZ()+2&&p.y()>0&&p.y()<=a.maxY(),"wall-walk outside owner envelope",p); + require(model.circulation().contains(offset(p,0,1,0)),"wall-walk missing route",p); + } + for(Pos p:walk.guards()) { + require(walkGuards.add(p),"duplicate wall-walk guard ownership",p); + require(!model.clearance().contains(p),"wall-walk guard obstructs route",p); + require(p.x()>=a.minX()-3&&p.x()<=a.maxX()+3&&p.z()>=a.minZ()-3&&p.z()<=a.maxZ()+3&&p.y()>0&&p.y()<=a.maxY()+2,"wall-walk guard outside owner envelope",p); + } + } + for(Partition p:model.partitions()) { + require(p!=null&&p.id()!=null&&detailIds.add(p.id()),"partition id",p); + var owner=modules.get(p.moduleId());Box a=p.wall(); + require(owner!=null&&a!=null&&(a.width()==1||a.depth()==1),"partition owner/plane",p.id()); + require(a.minY()>owner.bounds().minY()&&a.maxY()=2,"partition portal height",p.id()); + for(int x=portal.minX();x<=portal.maxX();x++)for(int z=portal.minZ();z<=portal.maxZ();z++) + require(model.circulation().contains(new Pos(x,portal.minY(),z)),"partition portal missing route",p.id()); + } + } + for(FacadeBay bay:model.facadeBays()) { + require(bay!=null&&bay.id()!=null&&detailIds.add(bay.id())&&bay.style()!=null,"facade bay identity",bay); + require(model.windows().contains(bay.window()),"facade bay lacks declared window",bay.id()); + Box a=bay.window().opening(); + require(Math.max(a.width(),a.depth())==3&&Math.min(a.width(),a.depth())==1,"facade bay opening width",bay.id()); + require(bay.envelope().contains(new Pos(a.minX(),a.minY(),a.minZ()))&&bay.envelope().contains(new Pos(a.maxX(),a.maxY(),a.maxZ())),"facade envelope misses glazing",bay.id()); + } + for(CourtFeature f:model.courtFeatures()) { + require(f!=null&&f.id()!=null&&detailIds.add(f.id())&&f.use()!=null,"court feature identity",f); + for(var m:model.modules())require(!f.bounds().overlaps(m.bounds()),"court feature collides with module",f.id()+" / "+m.id()); + } + for(Dormer d:model.dormers()) { + require(d!=null&&d.id()!=null&&detailIds.add(d.id()),"dormer identity",d); + var owner=modules.get(d.moduleId()); + require(owner!=null&&owner.roof()==RoofType.GABLE_Z,"dormer requires longitudinal roof",d.id()); + Box a=owner.bounds(); + require(d.frontX()==a.maxX()&&d.baseY()==a.maxY()+3&&d.centerZ()-3>a.minZ()&&d.centerZ()+3 modules,String id) { + return id!=null && (modules.containsKey(id)||id.equals("courtyard")||id.equals("outside")); + } + private static void verifyStair(ArchitectureModel model,Map blocks,StairFlight s) { + var module=model.module(s.moduleId()); + Set previous=null; int width=-1; + for (List tread:s.treads()) { + Set cells=new HashSet<>(tread); + require(cells.size()==tread.size() && cells.size()>=2,"stair width",s.id()); + if(width<0)width=cells.size(); + require(cells.size()==width,"changing stair width",s.id()); + Pos first=tread.getFirst(); + int min=Integer.MAX_VALUE,max=Integer.MIN_VALUE; + for(Pos p:tread) { + require(p.y()==first.y() && (s.facing().dx==0?p.z()==first.z():p.x()==first.x()),"nonlinear tread",s.id()); + int across=s.facing().dx==0?p.x():p.z();min=Math.min(min,across);max=Math.max(max,across); + require(module.footprint(p.x(),p.z()) && p.y()>=module.bounds().minY() && p.y() flood(Set allowed,Map blocks,Pos start) { + Set seen=new HashSet<>();ArrayDeque queue=new ArrayDeque<>();seen.add(start);queue.add(start); + while(!queue.isEmpty()) { + Pos p=queue.removeFirst(); + for(Facing d:List.of(Facing.NORTH,Facing.EAST,Facing.SOUTH,Facing.WEST))for(int dy=-1;dy<=1;dy++) { + Pos n=offset(p,d.dx,dy,d.dz); + if(!allowed.contains(n)||seen.contains(n))continue; + if(dy==1) { + ReferenceBlock step=blocks.get(offset(n,0,-1,0)); + if(step==null||!step.stair()||step.facing()!=d)continue; + } else if(dy==-1) { + ReferenceBlock step=blocks.get(offset(p,0,-1,0)); + if(step==null||!step.stair()||step.facing()!=d.rotate(2))continue; + } + seen.add(n);queue.addLast(n); + } + } + return seen; + } + private static void verifyRoofs(Map blocks) { + Set roof=new HashSet<>();for(ReferenceBlock b:blocks.values())if(isRoof(b.kind()))roof.add(b.pos()); + Set seen=new HashSet<>(); + for(Pos start:roof)if(seen.add(start)) { + ArrayDeque queue=new ArrayDeque<>();queue.add(start);boolean anchored=false; + while(!queue.isEmpty()) { + Pos p=queue.removeFirst(); + for(int dx=-1;dx<=1;dx++)for(int dz=-1;dz<=1;dz++)for(int dy=-1;dy<=1;dy++) { + if(dx==0&&dy==0&&dz==0)continue; + Pos n=offset(p,dx,dy,dz); + if(roof.contains(n)) { if(seen.add(n))queue.addLast(n); } + else if(dy<=0) { + ReferenceBlock support=blocks.get(n); + if(support!=null && structural(support.kind()))anchored=true; + } + } + } + require(anchored,"unsupported roof component",start); + } + } + private static boolean isRoof(Kind k) {return k==Kind.ROOF||k==Kind.ROOF_STAIRS||k==Kind.ROOF_SLAB;} + private static boolean structural(Kind k) {return k==Kind.FOUNDATION||k==Kind.STONE||k==Kind.TRIM||k==Kind.TIMBER||k==Kind.PLANKS;} + private static void supported(Map blocks,Pos feet,String context) { + ReferenceBlock below=blocks.get(offset(feet,0,-1,0)); + require(below!=null && (below.fullCube()||below.stair()),context,feet); + } + private static void air(Map blocks,Pos p,String context) { + ReferenceBlock b=blocks.get(p);require(b!=null && b.kind()==Kind.AIR,context,p); + } + private static Pos offset(Pos p,int x,int y,int z){return new Pos(p.x()+x,p.y()+y,p.z()+z);} + private static void require(boolean ok,String category,Object detail) { + if(!ok)throw new IllegalArgumentException("Reference quality: "+category+" at "+detail); + } +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/QualityReport.java b/core/src/main/java/dev/castleforge/core/architecture/QualityReport.java new file mode 100644 index 0000000..4c24481 --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/QualityReport.java @@ -0,0 +1,6 @@ +package dev.castleforge.core.architecture; + +public record QualityReport(int modules,int rooms,int flights,int windows,int blocks,int reachableRooms,int reservedCells) { + public String compact() { return modules+" modules, "+rooms+" rooms ("+reachableRooms+" reachable), "+flights+ + " stair flights, "+windows+" windows; "+blocks+" planned cells, "+reservedCells+" protected route cells"; } +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/ReferenceBlock.java b/core/src/main/java/dev/castleforge/core/architecture/ReferenceBlock.java new file mode 100644 index 0000000..658c8e3 --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/ReferenceBlock.java @@ -0,0 +1,24 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import java.util.Objects; + +/** A deliberately small, block-entity-free palette contract. All stairs/slabs use bottom half. */ +public record ReferenceBlock(Pos pos, Kind kind, Facing facing) { + public enum Kind { AIR, FOUNDATION, STONE, TRIM, TIMBER, PLANKS, ROOF, GLASS, BOOKSHELF, WOOL, + STONE_STAIRS, WOOD_STAIRS, ROOF_STAIRS, SLAB, ROOF_SLAB, LANTERN, + PLASTER, PAVING, GARDEN, TABLE_TOP, STONE_SLAB } + public enum Facing { + NONE(0,0), NORTH(0,-1), EAST(1,0), SOUTH(0,1), WEST(-1,0); + public final int dx, dz; + Facing(int dx,int dz) { this.dx=dx;this.dz=dz; } + public Facing rotate(int turns) { return this==NONE ? this : values()[1+Math.floorMod(ordinal()-1+turns,4)]; } + } + public ReferenceBlock { Objects.requireNonNull(pos); Objects.requireNonNull(kind); Objects.requireNonNull(facing); } + public ReferenceBlock(Pos pos,Kind kind) { this(pos,kind,Facing.NONE); } + public boolean stair() { return kind==Kind.STONE_STAIRS || kind==Kind.WOOD_STAIRS || kind==Kind.ROOF_STAIRS; } + public boolean fullCube() { return switch(kind) { + case AIR,STONE_STAIRS,WOOD_STAIRS,ROOF_STAIRS,SLAB,ROOF_SLAB,LANTERN,TABLE_TOP,STONE_SLAB -> false; + default -> true; + }; } +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/ReferenceCastlePlanner.java b/core/src/main/java/dev/castleforge/core/architecture/ReferenceCastlePlanner.java new file mode 100644 index 0000000..b7805ff --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/ReferenceCastlePlanner.java @@ -0,0 +1,100 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner; +import dev.castleforge.core.CastlePlanner.Pos; +import dev.castleforge.core.CultureMap; +import java.util.*; +import java.util.concurrent.CancellationException; +import static dev.castleforge.core.architecture.ReferenceBlock.*; + +/** Bounded, immutable model -> owned geometry -> furnishings -> independent quality validation. */ +public final class ReferenceCastlePlanner { + public static final int VERSION=3,RADIUS=54,MAX_BLOCKS=200_000,MAX_RELIEF=3; + public record Plan(List blocks,ArchitectureModel architecture,QualityReport report, + int floorY,int relief,int quarterTurns,CultureMap.Region region,int originX,int originZ) { + public Plan { blocks=List.copyOf(blocks); } + public Pos toWorld(Pos p){Pos r=rotate(p,quarterTurns);return new Pos(originX+r.x(),floorY+r.y(),originZ+r.z());} + public Pos toLocal(Pos p){return rotate(new Pos(p.x()-originX,p.y()-floorY,p.z()-originZ),-quarterTurns);} + public List localBlocks(){return sort(blocks.stream().map(b->new ReferenceBlock(toLocal(b.pos()),b.kind(),b.facing().rotate(-quarterTurns))).toList());} + } + public static Plan plan(long seed,int x,int z,CastlePlanner.Ground ground,CultureMap.Region region){ + Objects.requireNonNull(ground);Objects.requireNonNull(region); + if(Math.abs((long)x)>29_999_800||Math.abs((long)z)>29_999_800)throw new IllegalArgumentException("Reference site outside supported coordinates"); + long detailSeed=CultureMap.hash(seed^0x5245464552454e31L,x,z); + int turns=Math.floorMod(detailSeed,4),side=RADIUS*2+1; + int[][] heights=new int[side][side];int min=Integer.MAX_VALUE,max=Integer.MIN_VALUE; + for(int dx=-RADIUS;dx<=RADIUS;dx++)for(int dz=-RADIUS;dz<=RADIUS;dz++){ + interrupted();Pos r=rotate(new Pos(dx,0,dz),turns); + int height=ground.surfaceY(x+r.x(),z+r.z()); + if(height< -1024||height>4096)throw new IllegalArgumentException("Reference unsuitable ground at "+(x+r.x())+","+(z+r.z())+" (dry known surface required)"); + heights[dx+RADIUS][dz+RADIUS]=height;min=Math.min(min,height);max=Math.max(max,height); + } + if(max-min>MAX_RELIEF)throw new IllegalArgumentException("Reference terrain relief "+(max-min)+" exceeds "+MAX_RELIEF+" blocks; use a flat or gentle test site"); + ArchitectureModel model=ReferenceLayout.create();QualityChecks.validateModel(model); + OwnedBlockBuffer b=new OwnedBlockBuffer(model.clearance()); + int floor=max; + for(int dx=-49;dx<=49;dx++)for(int dz=-40;dz<=40;dz++){ + final int px=dx,pz=dz; + boolean court=dx>=-46&&dx<=46&&dz>=-37&&dz<=37; + if(!court&&model.modules().stream().noneMatch(m->m.footprint(px,pz)))continue; + int start=heights[dx+RADIUS][dz+RADIUS]-floor; + for(int y=start;y<0;y++)b.put("site",dx,y,dz,Kind.FOUNDATION); + boolean processional=Math.abs(dx)<=3||Math.abs(dz-15)<=2; + b.put("site",dx,0,dz,processional?Kind.TRIM:Math.floorMod(dx,7)==0||Math.floorMod(dz,7)==0?Kind.STONE:Kind.PAVING); + } + ModuleLibrary.build(model,b); + InteriorDesigner.furnish(model,b,detailSeed); + // The approach drops at most one tread per row and never excavates sampled terrain. + int previous=0; + for(int dz=41;dz<=52;dz++){ + int topGround=Integer.MIN_VALUE; + for(int dx=-2;dx<=2;dx++)topGround=Math.max(topGround,heights[dx+RADIUS][dz+RADIUS]-floor-1); + int top=Math.max(topGround,previous-1); + for(int dx=-2;dx<=2;dx++){ + int start=heights[dx+RADIUS][dz+RADIUS]-floor; + // Descending stairs occupy the HIGH row's block layer: two half-block drops. + int tread=top=start)descent=true; + for(int y=start;y=start)b.put("approach",dx,tread,dz,descent?Kind.STONE_STAIRS:Kind.STONE,descent?Facing.NORTH:Facing.NONE); + for(int y=top+1;y<=Math.max(3,top+3);y++)b.airIfEmpty("approach",dx,y,dz); + } + previous=top; + } + for(int dx=-2;dx<=2;dx++)for(int y=heights[dx+RADIUS][53+RADIUS]-floor;y<=3;y++)b.airIfEmpty("approach",dx,y,53); + verifyApproach(b,heights,floor); + List local=b.finish();QualityReport report=QualityChecks.verify(model,local); + final int base=floor; + List world=sort(local.stream().map(block->{Pos r=rotate(block.pos(),turns); + return new ReferenceBlock(new Pos(x+r.x(),base+r.y(),z+r.z()),block.kind(),block.facing().rotate(turns));}).toList()); + return new Plan(world,model,report,floor,max-min,turns,region,x,z); + } + private static void verifyApproach(OwnedBlockBuffer b,int[][] heights,int floor){ + for(int x=-2;x<=2;x++){ + Integer previous=null; + for(int z=53;z>=40;z--)for(boolean north:new boolean[]{false,true}){ + int surface=2*(heights[x+RADIUS][z+RADIUS]-floor); + for(int y=-MAX_RELIEF-1;y<=0;y++){ + ReferenceBlock block=b.at(new Pos(x,y,z)); + if(block==null||block.kind()==Kind.AIR)continue; + if(block.kind()==Kind.STONE_STAIRS)surface=Math.max(surface,2*y+(north?2:1)); + else if(block.fullCube())surface=Math.max(surface,2*(y+1)); + } + if(previous!=null&&Math.abs(surface-previous)>1) + throw new IllegalArgumentException("Reference entrance needs a terrain step larger than half a block at local "+x+","+z+"; choose a gentler approach"); + previous=surface; + } + } + } + static List sort(List blocks){return blocks.stream().sorted(Comparator + .comparingInt((ReferenceBlock b)->b.kind()==Kind.LANTERN?1:0).thenComparingInt(b->b.pos().y()) + .thenComparingInt(b->b.pos().z()).thenComparingInt(b->b.pos().x())).toList();} + static Pos rotate(Pos p,int turns){return switch(Math.floorMod(turns,4)){ + case 0->p;case 1->new Pos(-p.z(),p.y(),p.x());case 2->new Pos(-p.x(),p.y(),-p.z());default->new Pos(p.z(),p.y(),-p.x());};} + static void interrupted(){if(Thread.currentThread().isInterrupted())throw new CancellationException("Reference planning cancelled");} + private ReferenceCastlePlanner(){} +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/ReferenceLayout.java b/core/src/main/java/dev/castleforge/core/architecture/ReferenceLayout.java new file mode 100644 index 0000000..48e641c --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/ReferenceLayout.java @@ -0,0 +1,225 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import java.util.*; +import static dev.castleforge.core.architecture.ArchitectureModel.*; +import dev.castleforge.core.architecture.ArchitectureModel.Module; +import static dev.castleforge.core.architecture.ReferenceBlock.Facing.*; + +/** An authored composition, not randomized boxes. Canonical south entrance; rotations happen last. */ +final class ReferenceLayout { + private final List modules=new ArrayList<>(); + private final List rooms=new ArrayList<>(); + private final List connections=new ArrayList<>(); + private final List stairs=new ArrayList<>(); + private final List windows=new ArrayList<>(); + private final List partitions=new ArrayList<>(); + private final List bays=new ArrayList<>(); + private final List courtFeatures=new ArrayList<>(); + private final List wallWalks=new ArrayList<>(); + private final Set circulation=new LinkedHashSet<>(),clearance=new LinkedHashSet<>(); + static ArchitectureModel create(){return new ReferenceLayout().createModel();} + private ArchitectureModel createModel(){ + module("keep",ModuleType.KEEP,-39,-30,-21,-12,32,List.of(0,8,16,24),RoofType.HIP,3); + module("hall",ModuleType.GREAT_HALL,-20,-30,17,-11,14,List.of(0),RoofType.GABLE_X,0); + module("residence",ModuleType.RESIDENCE,18,-30,36,3,22,List.of(0,8,16),RoofType.GABLE_Z,0); + module("kitchen",ModuleType.SERVICE_WING,18,4,36,19,10,List.of(0),RoofType.HIP,0); + module("service",ModuleType.SERVICE_WING,-39,-11,-21,12,16,List.of(0,8),RoofType.GABLE_Z,0); + module("gate",ModuleType.GATEHOUSE,-11,28,11,40,19,List.of(0,8),RoofType.HIP,0); + module("northwest",ModuleType.CORNER_TOWER,-49,-40,-40,-31,13,List.of(0,6),RoofType.HIP,1); + module("northeast",ModuleType.CORNER_TOWER,40,-40,49,-31,17,List.of(0,6),RoofType.HIP,1); + module("southwest",ModuleType.CORNER_TOWER,-49,30,-40,40,10,List.of(0,6),RoofType.BATTLEMENT,1); + module("southeast",ModuleType.CORNER_TOWER,40,30,49,40,14,List.of(0,6),RoofType.HIP,1); + module("northwall",ModuleType.CURTAIN,-39,-40,39,-38,6,List.of(0),RoofType.BATTLEMENT,0); + module("westwall",ModuleType.CURTAIN,-49,-30,-47,29,6,List.of(0),RoofType.BATTLEMENT,0); + module("eastwall",ModuleType.CURTAIN,47,-30,49,29,6,List.of(0),RoofType.BATTLEMENT,0); + module("southwall-west",ModuleType.CURTAIN,-39,37,-12,40,12,List.of(0),RoofType.BATTLEMENT,0); + module("southwall-east",ModuleType.CURTAIN,12,37,39,40,12,List.of(0),RoofType.BATTLEMENT,0); + module("wall-stair",ModuleType.WALL_STAIR,-45,14,-41,26,10,List.of(0,6),RoofType.BATTLEMENT,0); + courtFeatures.add(new CourtFeature("well",CourtUse.COVERED_WELL,new Box(-10,0,3,-4,7,9))); + courtFeatures.add(new CourtFeature("herbs",CourtUse.HERB_GARDEN,new Box(-35,0,20,-25,2,28))); + courtFeatures.add(new CourtFeature("arbor",CourtUse.SEATING_ARBOR,new Box(25,0,23,35,6,28))); + for(int x=-46;x<=46;x++)for(int z=-37;z<=37;z++) { + final int px=x,pz=z; + boolean facadeMargin=modules.stream().anyMatch(m->m.type()!=ModuleType.CURTAIN&& + (m.footprint(px,pz)||m.footprint(px-1,pz)||m.footprint(px+1,pz)||m.footprint(px,pz-1)||m.footprint(px,pz+1))); + boolean feature=courtFeatures.stream().anyMatch(c->c.bounds().contains(new Pos(px,0,pz))); + if(!facadeMargin&&!feature&&modules.stream().noneMatch(m->m.footprint(px,pz)))walk(x,0,z); + } + for(int f:new int[]{0,8,16,24}) { + corridor(-36,f,-17,-23,-15); corridor(-26,f,-16,-24,-13); + room("keep-"+f,"keep",f==0?RoomType.STAIR_HALL:f==8?RoomType.LIBRARY:f==16?RoomType.BEDCHAMBER:RoomType.SOLAR,f,-24,-15); + } + staircase("keep",-36,-19,0);staircase("keep",-36,-19,8);staircase("keep",-36,-19,16); + corridor(-19,0,-16,16,-14);corridor(-1,0,-14,1,-10); + room("great-hall","hall",RoomType.GREAT_HALL,0,0,-15); + for(int f:new int[]{0,8,16}) { + corridor(21,f,-28,23,2);corridor(19,f,-17,34,-15); + rooms.add(new Room("residence-"+f,"residence",RoomType.STAIR_HALL,new Box(19,f+1,-29,35,Math.min(f+6,21),-14),f,new Pos(22,f+1,-15))); + int top=Math.min(f+7,21); + partitions.add(new Partition("residence-cross-"+f,"residence",new Box(19,f+1,-13,35,top,-13),List.of(new Box(21,f+1,-13,23,f+3,-13)))); + partitions.add(new Partition("residence-spine-"+f,"residence",new Box(25,f+1,-12,25,top,2),List.of(new Box(25,f+1,-9,25,f+3,-7),new Box(25,f+1,-1,25,f+3,1)))); + partitions.add(new Partition("residence-divider-"+f,"residence",new Box(26,f+1,-4,35,top,-4),List.of())); + rooms.add(new Room("chamber-"+f,"residence",f==0?RoomType.GUARDROOM:f==8?RoomType.BEDCHAMBER:RoomType.LIBRARY,new Box(26,f+1,-12,35,Math.min(f+6,21),-5),f,new Pos(28,f+1,-8))); + rooms.add(new Room("study-"+f,"residence",f==0?RoomType.STORE:RoomType.SOLAR,new Box(26,f+1,-3,35,Math.min(f+6,21),2),f,new Pos(28,f+1,0))); + corridor(23,f,-9,28,-7);corridor(23,f,-1,28,1); + } + staircase("residence",26,-19,0);staircase("residence",26,-19,8); + corridor(21,0,3,23,17);corridor(18,0,9,23,11); + room("kitchen-room","kitchen",RoomType.KITCHEN,0,22,10); + for(int f:new int[]{0,8}) { + corridor(-26,f,-10,-24,10);corridor(-36,f,7,-24,9); + room("service-"+f,"service",f==0?RoomType.STORE:RoomType.LIBRARY,f,-25,8); + } + staircase("service",-36,5,0); + corridor(-2,0,27,2,40);corridor(-10,0,38,9,39); + corridor(-10,8,38,9,39);corridor(4,8,30,6,39); + room("gate-guard","gate",RoomType.GUARDROOM,0,5,38); + room("gate-watch","gate",RoomType.GUARDROOM,8,5,38); + staircase("gate",-10,37,0); + connection("court-hall","courtyard","hall",-1,1,-11,1,3,-11); + connection("hall-keep","hall","keep",-21,1,-17,-20,3,-15); + connection("hall-residence","hall","residence",17,1,-17,18,3,-15); + connection("keep-service","keep","service",-26,1,-12,-24,3,-11); + connection("court-service","courtyard","service",-21,1,7,-21,3,9); + corridor(-25,0,7,-20,9); + connection("residence-kitchen","residence","kitchen",21,1,3,23,3,4); + connection("court-kitchen","courtyard","kitchen",18,1,9,18,3,11); + connection("court-gate","courtyard","gate",-2,1,28,2,5,28); + connection("gate-outside","gate","outside",-2,1,40,2,5,40); + for(String id:List.of("northwest","northeast","southwest","southeast")) { + Module m=find(id);int cx=(m.bounds().minX()+m.bounds().maxX())/2; + int cz=(m.bounds().minZ()+m.bounds().maxZ())/2; + boolean north=m.bounds().minZ()<0;int wall=north?m.bounds().maxZ():m.bounds().minZ(); + corridor(cx-1,0,Math.min(cz,wall),cx+1,Math.max(cz,wall)); + connection("court-"+id,"courtyard",id,cx-1,1,wall,cx+1,3,wall); + room(id+"-guard",id,RoomType.GUARDROOM,0,cx,cz); + } + // Articulated bays on exposed walls only. Adjacent wings deliberately receive no blind glazing. + for(int x:new int[]{-15,-9,-3,3,9,15})bay("hall",x-1,4,-30,x+1,8,-30,NORTH,BayStyle.HALL_LANCET); + for(int x:new int[]{-15,-9,9,15})bay("hall",x-1,4,-11,x+1,8,-11,SOUTH,BayStyle.HALL_LANCET); + for(int f:new int[]{0,8,16,24})for(int z:new int[]{-25,-19})window("keep",-39,f+3,z,-39,f+5,z,WEST); + for(int f:new int[]{0,8,16,24})for(int x:new int[]{-34,-28})window("keep",x,f+3,-30,x,f+5,-30,NORTH); + for(int z:new int[]{-25,-19})window("keep",-21,28,z,-21,30,z,EAST); + for(int x:new int[]{-34,-28})window("keep",x,28,-12,x,30,-12,SOUTH); + for(int f:new int[]{0,8,16})for(int z:new int[]{-25,-19,-8,0})bay("residence",36,f+3,z-1,36,f+5,z+1,EAST,BayStyle.CHAMBER_CASEMENT); + for(int f:new int[]{0,8,16})for(int z:new int[]{-7,-1})window("residence",18,f+3,z,18,f+5,z,WEST); + for(int f:new int[]{0,8,16})for(int x:new int[]{23,30})window("residence",x,f+3,-30,x,f+5,-30,NORTH); + for(int f:new int[]{0,8})for(int z:new int[]{-6,0,6})window("service",-39,f+3,z,-39,f+5,z,WEST); + for(int f:new int[]{0,8})for(int z:new int[]{-6,0,6})window("service",-21,f+3,z,-21,f+5,z,EAST); + for(int x:new int[]{23,30})window("kitchen",x,3,19,x,5,19,SOUTH); + for(int z:new int[]{9,15})window("kitchen",36,3,z,36,5,z,EAST); + for(int x:new int[]{-7,7})window("gate",x,11,40,x,13,40,SOUTH); + corridor(29,0,22,31,26); // a reserved seated-court approach, through the arbor's open front + wallWalkCircuit(); + for(Pos p:circulation)for(int h=0;h<3;h++)clearance.add(new Pos(p.x(),p.y()+h,p.z())); + // Taller arch openings are protected beyond the minimum route headroom. + for(Connection c:connections)for(int x=c.aperture().minX();x<=c.aperture().maxX();x++) + for(int z=c.aperture().minZ();z<=c.aperture().maxZ();z++)for(int y=c.aperture().minY();y<=c.aperture().maxY();y++)clearance.add(new Pos(x,y,z)); + return new ArchitectureModel("falkenwacht-v3-wallwalk",modules,rooms,connections,stairs,windows,clearance,circulation,new Pos(0,1,40),partitions,bays,courtFeatures, + List.of(new Dormer("residence-roof-north","residence",36,-23,25),new Dormer("residence-roof-south","residence",36,-5,25)),wallWalks); + } + private void wallWalkCircuit(){ + Map> decks=new LinkedHashMap<>(); + deck(decks,"northwall",-39,6,-39,39,-37); + deck(decks,"westwall",-48,6,-30,-46,29); + deck(decks,"eastwall",46,6,-30,48,29); + deck(decks,"southwall-west",-39,6,37,-14,39); + deck(decks,"southwall-east",14,6,37,39,39); + deck(decks,"gate",-11,8,37,11,39); + for(String id:List.of("northwest","northeast","southwest","southeast")){ + Module m=find(id);Box a=m.bounds(); + deck(decks,id,a.minX()+1,6,a.minZ()+1,a.maxX()-1,a.maxZ()-1); + boolean west=a.minX()<0,north=a.minZ()<0; + int side=west?a.maxX():a.minX(),end=north?a.maxZ():a.minZ(); + deck(decks,id,side,6,north?-39:37,side,north?-37:39); + deck(decks,id,west?-48:46,6,end,west?-46:48,end); + } + // Three-wide straight court stair, plus two short gatehouse transitions. + straightStair(decks,"wall-stair","court-wall-stair",-44,23,0,6,NORTH); + corridor(-44,0,24,-42,27); + corridor(-40,0,13,-38,27); // service wing / court-stair passage across facade margins + deck(decks,"wall-stair",-45,6,15,-42,17); + straightStair(decks,"southwall-west","west-gate-rise",-13,39,6,2,EAST); + straightStair(decks,"southwall-east","east-gate-rise",13,37,6,2,WEST); + Set guardColumns=new HashSet<>(); + for(var entry:decks.entrySet()) { + Set guards=new LinkedHashSet<>(); + Set ownColumns=new HashSet<>(); + for(Pos p:entry.getValue())for(var dir:List.of(NORTH,EAST,SOUTH,WEST)) { + int x=p.x()+dir.dx,z=p.z()+dir.dz; + boolean neighbour=false; + for(int dy=0;dy<=2;dy++)if(circulation.contains(new Pos(x,p.y()+dy,z)))neighbour=true; + if(neighbour)continue; + String column=x+":"+z; + if(guardColumns.contains(column))continue; + ownColumns.add(column); + guards.add(new Pos(x,p.y()+1,z)); + boolean outer=x==-49||x==49||z==-40||z==40; + if(outer&&Math.floorMod(x+z,4)<2)guards.add(new Pos(x,p.y()+2,z)); + } + guardColumns.addAll(ownColumns); + wallWalks.add(new WallWalk(entry.getKey()+"-walk",entry.getKey(),entry.getValue(),guards)); + } + } + private void deck(Map> decks,String owner,int x1,int f,int z1,int x2,int z2){ + Set cells=decks.computeIfAbsent(owner,k->new LinkedHashSet<>()); + for(int x=x1;x<=x2;x++)for(int z=z1;z<=z2;z++){cells.add(new Pos(x,f,z));walk(x,f,z);} + } + private void straightStair(Map> decks,String owner,String id,int x,int z,int base,int rise,ReferenceBlock.Facing facing){ + List> rows=new ArrayList<>(); + for(int n=0;n row=new ArrayList<>(); + for(int w=0;w<3;w++){ + int px=x+n*facing.dx+w*(facing.dx==0?1:0),pz=z+n*facing.dz-w*(facing.dz==0?facing.dx:0); + Pos p=new Pos(px,base+n+1,pz);row.add(p); + deck(decks,owner,px,p.y(),pz,px,pz); + } + rows.add(row); + } + stairs.add(new StairFlight(id,owner,facing,rows)); + } + private void module(String id,ModuleType type,int x1,int z1,int x2,int z2,int height,List floors,RoofType roof,int chamfer){ + modules.add(new Module(id,type,new Box(x1,0,z1,x2,height,z2),floors,roof,chamfer)); + } + private Module find(String id){return modules.stream().filter(m->m.id().equals(id)).findFirst().orElseThrow();} + private void room(String id,String owner,RoomType type,int f,int x,int z){ + Module m=find(owner);Box b=m.bounds(); + int inset=m.type()==ModuleType.CORNER_TOWER?2:m.chamfer()/2+1; + rooms.add(new Room(id,owner,type,new Box(b.minX()+inset,f+1,b.minZ()+inset,b.maxX()-inset,Math.min(f+6,m.type()==ModuleType.CORNER_TOWER?5:b.maxY()-1),b.maxZ()-inset),f,new Pos(x,f+1,z))); + } + private void walk(int x,int floor,int z){circulation.add(new Pos(x,floor+1,z));} + private void corridor(int x1,int floor,int z1,int x2,int z2){for(int x=x1;x<=x2;x++)for(int z=z1;z<=z2;z++)walk(x,floor,z);} + private void connection(String id,String from,String to,int x1,int y1,int z1,int x2,int y2,int z2){ + connections.add(new Connection(id,from,to,new Box(x1,y1,z1,x2,y2,z2))); + corridor(x1,y1-1,z1,x2,z2); + // Cross the reserved facade margin at an actual portal, without widening its jambs. + if(!from.equals("outside")&&!to.equals("outside")) { + if(x1==x2)corridor(x1-2,y1-1,z1,x2+2,z2); + if(z1==z2)corridor(x1,y1-1,z1-2,x2,z2+2); + } + } + private void window(String owner,int x1,int y1,int z1,int x2,int y2,int z2,ReferenceBlock.Facing out){windows.add(new Window(owner,new Box(x1,y1,z1,x2,y2,z2),out));} + private void bay(String owner,int x1,int y1,int z1,int x2,int y2,int z2,ReferenceBlock.Facing out,BayStyle style){ + Window w=new Window(owner,new Box(x1,y1,z1,x2,y2,z2),out);windows.add(w); + int tx=out.dz==0?0:1,tz=out.dx==0?0:1; + Box e=new Box(Math.min(x1-tx,x1+out.dx-tx),y1-1,Math.min(z1-tz,z1+out.dz-tz),Math.max(x2+tx,x2+out.dx+tx),y2+2,Math.max(z2+tz,z2+out.dz+tz)); + bays.add(new FacadeBay(owner+"-bay-"+bays.size(),w,style,e)); + } + private void staircase(String owner,int x,int z,int floor){ + List> up=new ArrayList<>(),back=new ArrayList<>(); + for(int n=1;n<=4;n++){ + List a=new ArrayList<>(),b=new ArrayList<>(); + for(int w=0;w<3;w++){ + Pos p=new Pos(x+w,floor+n,z-n);a.add(p);walk(p.x(),p.y(),p.z()); + Pos q=new Pos(x+5+w,floor+4+n,z-5+n);b.add(q);walk(q.x(),q.y(),q.z()); + } + up.add(a);back.add(b); + } + stairs.add(new StairFlight(owner+"-"+floor+"-out",owner,NORTH,up)); + stairs.add(new StairFlight(owner+"-"+floor+"-back",owner,SOUTH,back)); + corridor(x,floor+4,z-6,x+7,z-5); + corridor(x,floor,z,x+2,z+2); + corridor(x+5,floor+8,z,x+7,z+2); + } +} diff --git a/core/src/main/java/dev/castleforge/core/architecture/WallWalkLibrary.java b/core/src/main/java/dev/castleforge/core/architecture/WallWalkLibrary.java new file mode 100644 index 0000000..0c23afe --- /dev/null +++ b/core/src/main/java/dev/castleforge/core/architecture/WallWalkLibrary.java @@ -0,0 +1,34 @@ +package dev.castleforge.core.architecture; + +import dev.castleforge.core.CastlePlanner.Pos; +import java.util.*; +import static dev.castleforge.core.architecture.ArchitectureModel.*; +import static dev.castleforge.core.architecture.ReferenceBlock.*; + +/** Emits the modeled defensive circuit under the existing module ownership rules. */ +final class WallWalkLibrary { + static void build(ArchitectureModel model,OwnedBlockBuffer b){ + Set treads=new HashSet<>(); + for(StairFlight stair:model.stairs())for(var row:stair.treads())treads.addAll(row); + for(WallWalk walk:model.wallWalks()){ + var module=model.module(walk.moduleId()); + boolean masonry=module.type()==ModuleType.CURTAIN||module.type()==ModuleType.WALL_STAIR; + for(Pos p:walk.deck()){ + if(masonry)for(int y=1;y1 ? Long.parseLong(args[1]) : 20261020L; + Files.createDirectories(directory); + long start=System.nanoTime(); + var plan=ReferenceCastlePlanner.plan(seed,0,0,(x,z)->64,new CultureMap(seed,1024,7).at(0,0)); + long millis=(System.nanoTime()-start)/1_000_000; + StringBuilder tsv=new StringBuilder("x\ty\tz\tkind\tfacing\n"); + for(var b:plan.localBlocks()) tsv.append(b.pos().x()).append('\t').append(b.pos().y()).append('\t') + .append(b.pos().z()).append('\t').append(b.kind()).append('\t').append(b.facing()).append('\n'); + byte[] data=tsv.toString().getBytes(StandardCharsets.UTF_8); + Files.write(directory.resolve("blocks.tsv"),data); + String digest=HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(data)); + StringBuilder model=new StringBuilder("Actual generated architecture, canonical local coordinates\n") + .append("variant=").append(plan.architecture().variant()).append('\n') + .append("seed=").append(seed).append(" origin=0,0 ground=64 rotation=").append(plan.quarterTurns()).append('\n') + .append("planMillis=").append(millis).append(" (one cold invocation; not a benchmark)\n") + .append("blocks.tsv.sha256=").append(digest).append('\n').append(plan.report().compact()).append("\n\nModules\n"); + plan.architecture().modules().forEach(m->model.append(m).append('\n')); + model.append("\nRooms\n"); plan.architecture().rooms().forEach(r->model.append(r).append('\n')); + model.append("\nConnections\n"); plan.architecture().connections().forEach(c->model.append(c).append('\n')); + model.append("\nStair flights\n"); plan.architecture().stairs().forEach(s->model.append(s).append('\n')); + model.append("\nPartitions\n");plan.architecture().partitions().forEach(p->model.append(p).append('\n')); + model.append("\nFacade bays\n");plan.architecture().facadeBays().forEach(p->model.append(p).append('\n')); + model.append("\nCourt uses\n");plan.architecture().courtFeatures().forEach(p->model.append(p).append('\n')); + model.append("\nRoof lights\n");plan.architecture().dormers().forEach(p->model.append(p).append('\n')); + model.append("\nWall-walk sections (support-block coordinates, not feet)\n"); + plan.architecture().wallWalks().forEach(w->model.append(w.id()).append(" owner=").append(w.moduleId()) + .append(" deckCells=").append(w.deck().size()).append(" guardCells=").append(w.guards().size()).append('\n')); + Files.writeString(directory.resolve("model.txt"),model,StandardCharsets.UTF_8); + System.out.println(model.substring(0,model.indexOf("\n\nModules"))); + System.out.println("Exported "+directory.toAbsolutePath()); + } + private ReferenceExport() {} +} diff --git a/core/src/test/java/dev/castleforge/core/ReferenceVerification.java b/core/src/test/java/dev/castleforge/core/ReferenceVerification.java new file mode 100644 index 0000000..5479fe5 --- /dev/null +++ b/core/src/test/java/dev/castleforge/core/ReferenceVerification.java @@ -0,0 +1,373 @@ +package dev.castleforge.core; + +import dev.castleforge.core.architecture.ReferenceBlock; +import dev.castleforge.core.architecture.ReferenceCastlePlanner; +import dev.castleforge.core.architecture.ArchitectureModel; +import dev.castleforge.core.architecture.QualityChecks; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.CancellationException; +import java.security.MessageDigest; +import java.nio.charset.StandardCharsets; + +import static dev.castleforge.core.CastlePlanner.Pos; +import static dev.castleforge.core.architecture.ReferenceBlock.Kind; +import static dev.castleforge.core.architecture.ReferenceBlock.Facing; +import static dev.castleforge.core.architecture.ArchitectureModel.*; +import static dev.castleforge.core.architecture.ReferenceCastlePlanner.*; + +/** Geometry/contract tests; this does not simulate Minecraft collisions, lighting or block updates. */ +public final class ReferenceVerification { + private static int assertions, accepted, negativeScenarios; + private static final CastlePlanner.Ground FLAT = (x,z) -> 64; + private static final String[] STYLES = {"central_european", "nordic", "mediterranean", "desert_citadel", + "east_asian", "gothic", "high_fantasy", "maritime"}; + + private static void check(boolean pass, String message) { + assertions++; + if (!pass) throw new AssertionError(message); + } + private static void rejects(Runnable action, String message) { + boolean rejected = false; + try { action.run(); } catch (IllegalArgumentException expected) { rejected = true; } + check(rejected, message); + negativeScenarios++; + } + private static CultureMap.Region region(int index) { + String style = STYLES[Math.floorMod(index, STYLES.length)]; + return new CultureMap.Region("verification-region",style,style,0,0,0,7168); + } + public static void main(String[] args) throws Exception { + long started = System.nanoTime(); + Set rotations = new HashSet<>(); + Map rotationSeeds = new TreeMap<>(); + Set signatures = new HashSet<>(); + for (int seed = 0; seed < 16; seed++) { + Plan plan = plan(seed,0,0,FLAT,region(seed)); + accepted++; + check(plan.equals(plan(seed,0,0,FLAT,region(seed))),"repeat planning is deterministic, including model and order"); + check(plan.region().equals(region(seed)),"source region metadata retained"); + rotations.add(plan.quarterTurns()); + rotationSeeds.putIfAbsent(plan.quarterTurns(),seed); + signatures.add(digest(plan.blocks())); + verifyBlocks(plan, FLAT); + verifyModel(plan); + verifyApproach(plan, FLAT); + } + check(rotations.size() == 4,"representative seeds exercise all four rotations"); + check(signatures.size() > 1,"seed affects reference output"); + for (int x : new int[]{-29_999_800,-7168,-1,29_999_800}) { + Plan plan = plan(42,x,-x,FLAT,region(0)); + accepted++; + check(plan.equals(plan(42,x,-x,FLAT,region(0))),"negative/world-edge position deterministic"); + verifyBlocks(plan, FLAT); + } + for(CastlePlanner.Ground ground:List.of((x,z)->x<0?64:65,(x,z)->64+Math.floorMod(x,2))) for(int seed:rotationSeeds.values()) { + Plan plan=plan(seed,0,0,ground,region(0)); + accepted++; + check(plan.relief()==1,"small ground variation preserved in diagnostics"); + verifyBlocks(plan,ground); + verifyModel(plan); + verifyApproach(plan,ground); + } + AtomicInteger reads = new AtomicInteger(); + Plan reference = plan(42,0,0,(x,z) -> { reads.incrementAndGet(); return 64; },region(0)); + accepted++; + check(reads.get() == (2*RADIUS+1)*(2*RADIUS+1),"each terrain column is captured once; no hidden planning resampling"); + Plan otherCulture=plan(42,0,0,FLAT,region(5));accepted++; + check(reference.blocks().equals(otherCulture.blocks()),"reference geometry stays explicitly central-European across metadata regions"); + check(otherCulture.region().equals(region(5)),"fixed reference design does not replace culture metadata"); + rejects(() -> plan(42,29_999_999,0,FLAT,region(0)),"unsafe world-edge coordinate rejected"); + rejects(() -> plan(42,Integer.MIN_VALUE,0,FLAT,region(0)),"negative coordinate overflow rejected"); + rejects(() -> plan(42,0,Integer.MAX_VALUE,FLAT,region(0)),"positive coordinate overflow rejected"); + rejects(() -> plan(42,0,0,(x,z) -> Integer.MIN_VALUE,region(0)),"unusable terrain rejected"); + rejects(() -> plan(42,0,0,(x,z) -> Integer.MAX_VALUE,region(0)),"overflow terrain rejected"); + rejects(() -> plan(42,0,0,(x,z) -> x < 0 ? 64 : 100,region(0)),"cliff rejected rather than excavated"); + verifyMutations(reference); + verifyArchitecturalDetails(reference); + verifyCancellation(); + System.out.println("Reference SHA-256: " + digest(reference.blocks())); + System.out.printf(Locale.ROOT,"PASS reference: %d accepted sites, %d rejected invalid scenarios, 1 cancellation scenario, %d invariant assertions; %.2f s.%n", + accepted,negativeScenarios,assertions,(System.nanoTime()-started)/1e9); + } + private static void verifyArchitecturalDetails(Plan plan) { + var model=plan.architecture();var local=plan.localBlocks(); + Map blocks=new HashMap<>();for(var b:local)blocks.put(b.pos(),b); + check(model.partitions().size()==9,"three actual dividing walls per residential floor"); + check(model.facadeBays().size()==22,"hall and east residential elevations use declared facade bays"); + check(model.dormers().size()==2,"two explicitly joined roof lights break the long roof plane"); + check(model.courtFeatures().size()==3,"court has three declared uses, not random clutter"); + for(Room room:model.rooms())if(room.id().startsWith("chamber-")||room.id().startsWith("study-")) { + check(room.interior().width()<=10&&room.interior().depth()<=8,"chamber has human-scale dimensions"); + check(model.circulation().contains(room.target()),"each actual chamber has its own route"); + } + Pos wall=new Pos(25,10,-5),portal=new Pos(25,10,-8); + rejects(()->QualityChecks.verify(model,replace(local,wall,Kind.AIR,Facing.NONE)),"removing a real dividing wall fails final validation"); + rejects(()->QualityChecks.verify(model,replace(local,portal,Kind.PLASTER,Facing.NONE)),"blocking a chamber doorway fails final validation"); + var bay=model.facadeBays().getFirst();Box a=bay.window().opening(); + Pos reveal=new Pos(a.minX()-1,a.minY(),a.minZ()-1); + rejects(()->QualityChecks.verify(model,replace(local,reveal,Kind.AIR,Facing.NONE)),"missing projected window jamb fails final validation"); + Pos insideWindow=new Pos(a.minX(),a.minY(),a.minZ()+1); + rejects(()->QualityChecks.verify(model,replace(local,insideWindow,Kind.BOOKSHELF,Facing.NONE)),"furniture behind glazing fails final validation"); + check(blocks.get(new Pos(-7,1,-24)).kind()==Kind.TABLE_TOP,"hall table uses a one-block-high top instead of a 2.5-block platform"); + check(!new ReferenceBlock(new Pos(0,0,0),Kind.TABLE_TOP).fullCube(),"top slab is not a full navigation support"); + for(Dormer d:model.dormers()) { + check(blocks.get(new Pos(d.frontX(),d.baseY()+1,d.centerZ())).kind()==Kind.GLASS,"dormer front contains glazing"); + check(blocks.get(new Pos(d.frontX()-1,d.baseY()+1,d.centerZ())).kind()==Kind.AIR,"dormer glazing has an interior air pocket"); + } + Dormer first=model.dormers().getFirst(); + rejects(()->QualityChecks.verify(model,replace(local,new Pos(first.frontX(),first.baseY()+6,first.centerZ()),Kind.AIR,Facing.NONE)),"missing dormer cap fails final validation"); + } + private static void verifyCancellation() { + boolean cancelled=false, interruptPreserved; + Thread.currentThread().interrupt(); + try { plan(42,0,0,FLAT,region(0)); } + catch(CancellationException expected) { cancelled=true; } + finally { interruptPreserved=Thread.interrupted(); } + check(cancelled,"preinterrupted pure planning aborts with CancellationException"); + check(interruptPreserved&&!Thread.currentThread().isInterrupted(),"caller observes interruption and test clears it in finally"); + } + /** Sample both stair halves: a full-cube jump must not masquerade as a walkable main entrance. */ + private static void verifyApproach(Plan plan,CastlePlanner.Ground ground) { + Map blocks=new HashMap<>(); + for(var block:plan.localBlocks())blocks.put(block.pos(),block); + for(int x=-1;x<=1;x++) { + Integer previousHalfHeight=null; + for(int z=53;z>=40;z--) for(boolean northHalf:new boolean[]{false,true}) { + Pos world=plan.toWorld(new Pos(x,0,z)); + int halfHeight=2*(ground.surfaceY(world.x(),world.z())-plan.floorY()); + for(int y=-MAX_RELIEF-1;y<=0;y++) { + var b=blocks.get(new Pos(x,y,z)); + if(b==null||b.kind()==Kind.AIR)continue; + if(b.fullCube())halfHeight=Math.max(halfHeight,2*(y+1)); + else if(b.kind()==Kind.STONE_STAIRS) { + if(b.facing()!=Facing.NORTH)throw new AssertionError("approach stair faces away from gate: "+b); + halfHeight=Math.max(halfHeight,2*y+(northHalf?2:1)); + } else throw new AssertionError("unexpected approach obstruction: "+b); + } + if(previousHalfHeight!=null&&Math.abs(halfHeight-previousHalfHeight)>1) + throw new AssertionError("entrance requires full-block jump/drop at "+x+","+z+" half="+northHalf+ + " surface="+previousHalfHeight+" -> "+halfHeight+" rotation="+plan.quarterTurns()); + int clearY=Math.floorDiv(halfHeight+1,2); + for(int y=clearY;y=6,"separate authored building masses"); + check(model.rooms().size()>=8,"meaningful room program"); + check(model.stairs().size()>=4,"connected multi-storey stair program"); + check(!model.connections().isEmpty(),"explicit module connections"); + Set moduleTypes=new HashSet<>(); + for(var module:model.modules()) moduleTypes.add(module.type()); + check(moduleTypes.containsAll(Set.of(ModuleType.KEEP,ModuleType.GREAT_HALL,ModuleType.RESIDENCE,ModuleType.GATEHOUSE)), + "keep, great hall, residence and gatehouse are distinct modules"); + Set roomTypes=new HashSet<>(); + for(var room:model.rooms()) { + roomTypes.add(room.type()); + var module=model.module(room.moduleId()); + check(module.floors().contains(room.floorY()),"room belongs to declared storey: "+room.id()); + check(room.interior().contains(room.target()),"room access target lies inside room: "+room.id()); + } + check(roomTypes.containsAll(Set.of(RoomType.GREAT_HALL,RoomType.KITCHEN,RoomType.BEDCHAMBER,RoomType.LIBRARY,RoomType.STORE,RoomType.GUARDROOM)), + "functional hall, kitchen, living, study, storage and defence rooms"); + var local=plan.localBlocks(); + Map map=new HashMap<>(); + for(var block:local) map.put(block.pos(),block); + Set worldBlocks=new HashSet<>(plan.blocks()); + for(var block:local) { + int x=block.pos().x(),z=block.pos().z(); + for(int q=0;q blocks){ + var model=plan.architecture(); + check(model.wallWalks().size()==11,"five curtains, four tower platforms, gate and court-stair are modeled"); + List corners=List.of(new Pos(-47,7,-38),new Pos(47,7,-38),new Pos(47,7,38), + new Pos(14,7,38),new Pos(13,8,38),new Pos(12,9,38),new Pos(-12,9,38), + new Pos(-13,8,38),new Pos(-14,7,38),new Pos(-47,7,38),new Pos(-47,7,-38)); + int length=0; + for(int i=1;i local=reference.localBlocks(); + var duplicate=new ArrayList<>(local); duplicate.add(local.getFirst()); + rejects(()->QualityChecks.verify(model,duplicate),"duplicate coordinates rejected before map deduplication"); + Pos corridor=model.clearance().iterator().next(); + rejects(()->QualityChecks.verify(model,replace(local,corridor,Kind.STONE,Facing.NONE)),"obstructed reserved route rejected"); + var lantern=local.stream().filter(b->b.kind()==Kind.LANTERN).findFirst().orElseThrow(); + Pos support=new Pos(lantern.pos().x(),lantern.pos().y()+1,lantern.pos().z()); + rejects(()->QualityChecks.verify(model,replace(local,support,Kind.AIR,Facing.NONE)),"missing hanging lamp support rejected"); + var wrongOrder=new ArrayList<>(local);wrongOrder.remove(lantern);wrongOrder.addFirst(lantern); + rejects(()->QualityChecks.verify(model,wrongOrder),"attachment before supporting block rejected"); + var flight=model.stairs().getFirst(); + Pos tread=flight.treads().getFirst().getFirst(); + var actual=local.stream().filter(b->b.pos().equals(tread)).findFirst().orElseThrow(); + rejects(()->QualityChecks.verify(model,replace(local,tread,actual.kind(),actual.facing().rotate(2))),"backwards primary stair rejected"); + rejects(()->QualityChecks.verify(model,replace(local,tread,Kind.AIR,Facing.NONE)),"missing primary stair tread rejected"); + var window=model.windows().getFirst(); + Box opening=window.opening(); + Pos outsideWindow=new Pos(opening.minX()+window.outward().dx,opening.minY(),opening.minZ()+window.outward().dz); + rejects(()->QualityChecks.verify(model,replace(local,outsideWindow,Kind.STONE,Facing.NONE)),"accidentally blocked exterior window rejected"); + Pos floatingRoof=new Pos(RADIUS,80,RADIUS); + rejects(()->QualityChecks.verify(model,replace(local,floatingRoof,Kind.ROOF,Facing.NONE)),"unanchored roof component rejected"); + var blockedRoom=model.rooms().getFirst(); + rejects(()->QualityChecks.verify(model,replace(local,blockedRoom.target(),Kind.BOOKSHELF,Facing.NONE)),"furniture cannot block room access target"); + var modules=new ArrayList<>(model.modules());modules.add(modules.getFirst()); + ArchitectureModel duplicatedModule=copyModel(model,modules,model.rooms(),model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.verify(duplicatedModule,local),"duplicate module id rejected"); + var first=model.modules().getFirst(); + modules=new ArrayList<>(model.modules()); + modules.add(new ArchitectureModel.Module("intruding-module",first.type(),first.bounds(),first.floors(),first.roof(),first.chamfer())); + ArchitectureModel overlap=copyModel(model,modules,model.rooms(),model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.verify(overlap,local),"distinct modules cannot silently own the same volume"); + rejects(()->new Box(1,0,0,0,1,1),"inverted volume rejected by constructor"); + modules=new ArrayList<>(model.modules()); + modules.set(0,new ArchitectureModel.Module(first.id(),first.type(),first.bounds(),List.of(first.bounds().maxY()+1),first.roof(),first.chamfer())); + ArchitectureModel invalidFloor=copyModel(model,modules,model.rooms(),model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.verify(invalidFloor,local),"storey outside module bounds rejected"); + modules=new ArrayList<>(model.modules()); + modules.set(0,new ArchitectureModel.Module(first.id(),first.type(),first.bounds(),List.of(first.floors().getFirst(),first.floors().getFirst()),first.roof(),first.chamfer())); + ArchitectureModel duplicateFloors=copyModel(model,modules,model.rooms(),model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.validateModel(duplicateFloors),"duplicate storey heights rejected"); + modules=new ArrayList<>(model.modules()); + modules.set(0,new ArchitectureModel.Module(first.id(),first.type(),first.bounds(),first.floors(),first.roof(),-1)); + ArchitectureModel invalidChamfer=copyModel(model,modules,model.rooms(),model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.validateModel(invalidChamfer),"negative tower chamfer rejected"); + var rooms=new ArrayList<>(model.rooms()); + Room firstRoom=rooms.getFirst(); + rooms.set(0,new Room(firstRoom.id(),"unknown-module",firstRoom.type(),firstRoom.interior(),firstRoom.floorY(),firstRoom.target())); + ArchitectureModel orphan=copyModel(model,model.modules(),rooms,model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.verify(orphan,local),"room with nonexistent owner rejected"); + rooms=new ArrayList<>(model.rooms()); + rooms.add(new Room("overlapping-room",firstRoom.moduleId(),firstRoom.type(),firstRoom.interior(),firstRoom.floorY(),firstRoom.target())); + ArchitectureModel overlappingRooms=copyModel(model,model.modules(),rooms,model.connections(),model.stairs(),model.windows()); + rejects(()->QualityChecks.verify(overlappingRooms,local),"two logical rooms cannot silently overlap"); + var connections=new ArrayList<>(model.connections()); + var connection=connections.getFirst(); + connections.set(0,new Connection(connection.id(),connection.from(),connection.from(),connection.aperture())); + ArchitectureModel selfConnection=copyModel(model,model.modules(),model.rooms(),connections,model.stairs(),model.windows()); + rejects(()->QualityChecks.validateModel(selfConnection),"self-connected module port rejected"); + WallWalk wall=model.wallWalks().getFirst(); + Pos deck=wall.deck().iterator().next(),guard=wall.guards().iterator().next(); + rejects(()->QualityChecks.verify(model,replace(local,deck,Kind.AIR,Facing.NONE)),"missing wall-walk deck rejected"); + rejects(()->QualityChecks.verify(model,replace(local,guard,Kind.AIR,Facing.NONE)),"removed parapet rejected"); + for(String id:List.of("court-wall-stair","west-gate-rise","east-gate-rise")){ + StairFlight s=model.stairs().stream().filter(f->f.id().equals(id)).findFirst().orElseThrow(); + Pos p=s.treads().getFirst().getFirst(); + rejects(()->QualityChecks.verify(model,replace(local,p,Kind.STONE_STAIRS,s.facing().rotate(2))),"wrong new stair facing rejected: "+id); + } + rejects(()->QualityChecks.verify(model,replace(local,new Pos(-40,7,-38),Kind.STONE,Facing.NONE)),"blocked tower crossing rejected"); + rejects(()->QualityChecks.verify(model,replace(local,new Pos(0,9,38),Kind.STONE,Facing.NONE)),"blocked elevated gate passage rejected"); + } + private static ArchitectureModel copyModel(ArchitectureModel model,List modules,List rooms, + List connections,List stairs,List windows) { + return new ArchitectureModel(model.variant(),modules,rooms,connections,stairs,windows, + model.clearance(),model.circulation(),model.entrance(),model.partitions(),model.facadeBays(),model.courtFeatures(),model.dormers(),model.wallWalks()); + } + private static List replace(List input,Pos pos,Kind kind,Facing facing) { + var output=new ArrayList(input.size()+1); + boolean found=false; + for(var block:input) { + if(block.pos().equals(pos)) { output.add(new ReferenceBlock(pos,kind,facing));found=true; } + else output.add(block); + } + if(!found)output.add(new ReferenceBlock(pos,kind,facing)); + return List.copyOf(output); + } + private static void verifyBlocks(Plan plan, CastlePlanner.Ground ground) { + check(!plan.blocks().isEmpty() && plan.blocks().size() <= MAX_BLOCKS,"nonempty bounded write set"); + Map blocks = new HashMap<>(); + Map order = new HashMap<>(); + for (int i=0; iRADIUS || Math.abs((long)block.pos().z()-plan.originZ())>RADIUS) + throw new AssertionError("outside survey bounds: "+block.pos()); + if (block.pos().y() < ground.surfaceY(block.pos().x(),block.pos().z())) + throw new AssertionError("terrain excavation at " + block.pos()); + } + check(blocks.size() == plan.blocks().size(),"all coordinates unique and within surveyed non-excavating envelope"); + long lights=0,stairs=0,books=0; + for (var block:plan.blocks()) { + if (block.kind()==Kind.LANTERN) { + lights++; + Pos above=new Pos(block.pos().x(),block.pos().y()+1,block.pos().z()); + ReferenceBlock support=blocks.get(above); + if (support==null || support.kind()==Kind.AIR || support.kind()==Kind.LANTERN) + throw new AssertionError("unsupported hanging lantern: "+block.pos()); + if (order.get(above)>=order.get(block.pos())) throw new AssertionError("lantern before support: "+block.pos()); + } + if (block.kind()==Kind.STONE_STAIRS || block.kind()==Kind.WOOD_STAIRS) stairs++; + if (block.kind()==Kind.BOOKSHELF) books++; + } + check(lights>=6,"functional spaces contain supported lighting"); + check(stairs>=20,"substantial actual stair geometry"); + check(books>0,"furnished study/library"); + } + private static String digest(List blocks) throws Exception { + MessageDigest digest=MessageDigest.getInstance("SHA-256"); + for (var block:blocks) digest.update((block.toString()+"\n").getBytes(StandardCharsets.UTF_8)); + return HexFormat.of().formatHex(digest.digest()); + } + private ReferenceVerification() {} +} diff --git a/docs/ADR_0001_REFERENCE_ARCHITECTURE.md b/docs/ADR_0001_REFERENCE_ARCHITECTURE.md new file mode 100644 index 0000000..e9f420b --- /dev/null +++ b/docs/ADR_0001_REFERENCE_ARCHITECTURE.md @@ -0,0 +1,73 @@ +# ADR 0001: one authored reference before procedural diversity + +Status: accepted for the experimental 0.3 branch, not a visual acceptance decision. + +## Baseline and branch decision + +Inspected on 2026-10-20: open draft PR #3 contains identity/diagnostics at +`740bcd699957f4cf36faf2820cccdc92e757be51`, stacked on terraced PR #2. +Open draft PR #6 adds only the Work order at +`d2224b09c2b6ca34f13fb6ce7fb64ca4611a0378`. +`feat/castleforge-0.3-architecture-core` starts from that exact #6 head, thereby +preserving both the latest implementation and its design brief. It targets the +preparation branch `feat/reference-castle-0.3`; nothing is merged into `main`. + +The baseline's three dependency-free suites were rerun locally with Temurin +21.0.5 before implementation: classic 50 seeds, terraces 160 terrain/seed cases, +identity 100 seeds x eight cultures. All passed; the existing terraced golden +digest remains `6fd20d8855fdc190a7e81e9772cef9d4aad3974a3a405ca25f31161b643f7828`. + +## Decision + +Create a separate `dev.castleforge.core.architecture` package. Compose a typed +architecture model before rendering blocks. Author one connected, asymmetric +castle with a dominant keep, a great hall, residential/service rooms, gatehouse, +courtyard and curtain walls. Module ownership, intentional connections, +circulation reservations and final block checks are explicit contracts. + +Use one central-European material palette and maintained condition for the +reference. The site still has its original culture-region identity. This is +deliberately not a claim of eight new cultural grammars. Seed and position choose +stable orientation under a separate architecture signature; they do not +modify `CultureMap` or `generation-v1.properties`. + +Use a bounded authored footprint, smaller than the Work order's aspirational +120-160-block long axis. This gives the design room for distinct masses without +blindly raising the old generator budgets or making whole-bounding-box AIR plans. +Keep terrain handling conservative: shallow supports and explicit rejection, +not deep excavation, global plate filling or arbitrary mountain adaptation. + +Reserve intended main routes and validate them after the furniture pass. A +global two-block voxel flood-fill that can climb roofs is insufficient evidence +of an internal staircase. Checks are a conservative model of supported building +primitives, not a substitute for Minecraft collision and player movement tests. + +## Placement and undo compatibility + +Keep classic/terraced implementation and palettes intact. Use a separate +`/castleforge preview reference` path with the existing confirmation, conflict +checks, placement budget, status and session-only undo semantics. + +For this milestone furniture is built from blocks without BlockEntities: +timber, planks, stairs, slabs, ordinary bookshelves, wool and supported lanterns. +Hearths are decorative; no live fire, lava, campfires or inventory containers. +Open framed doorways avoid half-placed multi-block doors. No fences, iron bars +or wall connection states are added. This deliberate subset fits the existing +BlockState-only journal; safe data-preserving container undo is deferred. +Hanging lanterns are placed after their supports and undone before them. + +## Evidence and remaining boundaries + +The reproducible exporter/renderer uses actual generated block data and no +Minecraft assets. Its views show composition, floor plans and sections. The +primitive renderer does not prove vanilla-texture appearance, lighting, +neighbor-update behavior, real navigation, performance or visual approval. + +Local JDK 25 is present, but pinned Gradle 9.4.0 and Fabric/Mojang dependencies +were unavailable in the offline cache. The complete pinned build is verified +separately by GitHub Actions. No installed Prism instance or existing world is +modified by this development session. No EULA is accepted on the user's behalf. + +Automatic worldgen/exploration generation, arbitrary slopes, monuments, NPCs, +loot, Bedrock/consoles and NeoForge remain outside this milestone. See the +reference guide and validation record for actual results and open checks. diff --git a/docs/ADR_0002_VISUAL_REJECTION_AND_DETAIL_STUDY.md b/docs/ADR_0002_VISUAL_REJECTION_AND_DETAIL_STUDY.md new file mode 100644 index 0000000..13f345d --- /dev/null +++ b/docs/ADR_0002_VISUAL_REJECTION_AND_DETAIL_STUDY.md @@ -0,0 +1,96 @@ +# ADR 0002: reject v1 visually; develop bounded architectural detail studies + +Date: 2026-10-20. Status: implemented experimental study, **not visual acceptance**. + +## Evidence and decision + +Emre rejected Falkenwacht v1 after a real Minecraft trial. Four supplied +screenshots (19:22:20, :36, :40, :46) show a broad empty stone court, largely +flat walls, narrow unframed glazing and undivided rooms. Furniture and beams +do not rescue the overall composition. Hostile mobs are visible; this does not +prove exactly where they spawned, but lantern counts never established spawn +safety. Successful geometry assertions did not establish design quality. + +Repository checked before edits: PR #7 open/draft, head +`e94e13f638a2e27d588661a4d06c482570a2b369`, based on PR #6 at `d2224b0`; +PRs #2/#3/#6 remain open drafts. Both Actions runs on the inspected #7 head +passed. Local work was clean. Continue the existing #7 branch, preserving +the baseline commit, old evidence and classic/terraced generators. + +The existing ownership/route/worker architecture is useful. Its **design +vocabulary is insufficient**: a Room mostly represented a whole storey, +window rules cut single-block slits, and all courtyard cells were reserved +as circulation, leaving no modeled place for purposeful amenities. + +Extend that model, not a parallel engine: actual partitions and portals, +facade bays with depth/envelopes, owned dormer junctions, and court-use areas +are specified before emission. Add independent checks for those contracts. +The next version is named `falkenwacht-v2-study`, not a production standard. + +## External examples: inspection only + +User supplied Louvre (semi-finished), Creepy Blackstone Castle by +NevasBuildings, Palace of the Ancients, Confessor's Palace v1.1, and local +Falcon's Rock v2.0.0. All five ZIPs were read without importing them into +Minecraft. World metadata/region files and a bounded 256-chunk (256 x 256 +block) sample around each saved player position were decoded locally. +That includes older numeric block IDs in Falcon's Rock. Approximate top +surfaces were inspected; this is **not a complete architectural survey or +interior walkthrough** of those large maps. Some saved positions show +approaches/terrain rather than the principal building. + +They establish the user's intended category and ambition, not a source of +modules to copy. No foreign world, schematic, voxel sample, extracted asset +or template is checked in or used by the runtime. User screenshots and +downloaded worlds are not republished with this PR. + +## Implemented scope + +- Nine physical partitions and six additional residential rooms with their + own protected door approaches. Furniture is constrained to its room bounds. +- Twenty-two articulated facade bays, wider glazing, projected jambs, sills + and hoods; hall buttresses and a framed main entrance. Upper residential + plaster infill and timber gable framing differentiate building uses. +- Two east-facing roof lights with owned subordinate roof junctions. They + are attic details, not new habitable rooms or accessible balconies. +- Corrected hall table height (v1 was 2.5 blocks above floor), processional + floor band, lower supported wall lamps, and hearth/chimney placement. +- Covered decorative well, bounded herb garden and a seating arbor with a + reserved approach. Court paving distinguishes paths from open areas. +- Window checks now require clear cells on both sides. This caught a hearth + obscuring a hall window during iteration; the hearth was relocated. +- Terrain rejection now includes the actual BlockState and distinguishes a + block entity from an unsupported surface type. No whitelist relaxation or + claim of reliable player-placed-block detection. + +## What this does not solve + +The enclosing rectangle, large court, repetitive curtains, simple keep, +ground-floor tower rooms and incomplete wall walks remain. The new study is +**still below the requested hand-built benchmark**. Do not mark visual +acceptance complete or present the project as release-ready. + +There is still one fixed composition with four deterministic rotations; +no epoch selection, parametric size families, terrain-driven massing or +eight cultural building grammars. This bounded authored vocabulary is only +a step toward that engine. The three-block relief limit is unchanged. + +No live fire, block-entity furniture, working beds/doors, inventories, loot, +inhabitants, worldgen or platform ports. Table tops introduce explicit top +slabs; renderer and Fabric adapter distinguish them from bottom slabs. +No neighbor-sensitive fences/bars or new multi-block objects were added. +Actual lighting, movement, stairs, slab behavior and undo need separate +runtime checks. Existing session-only undo is not a backup. + +## Visual gate and resource discipline + +Compare actual block output at identical seed/site before another broad +playtest. Improve one coherent architectural ensemble and show close views; +do not request repeated full-castle tests merely because tests are green. +The project owner decides visual acceptance. No numeric assertion count, +shader, concept image or claimed development effort substitutes for it. + +Work is bounded by a concrete comparison deliverable. No parallel agents, +speculative platform ports or repeated full baseline tests during each +small iteration. There is no reliable access here to the user's remaining +ChatGPT allowance, and no promise of a cheap or one-prompt production engine. diff --git a/docs/PRODUCT_DIRECTION.md b/docs/PRODUCT_DIRECTION.md new file mode 100644 index 0000000..afaaf2f --- /dev/null +++ b/docs/PRODUCT_DIRECTION.md @@ -0,0 +1,98 @@ +# Product direction and implementation boundary + +Owner: Emre / badmon61. Original idea: Emre's brother. Updated 2026-10-20 +from the owner's full handoff. Live code determines implementation status; +these goals must survive subsequent refactors and chat handoffs. + +## Product ambition + +An original procedural architecture engine for outposts, castles, fortresses, +citadels, palaces and very rare monumental fantasy compounds. Results should +look intentionally designed for their site and be worth exploring with +Vanilla textures, without shader assistance. Some future compounds should +offer roughly three minutes of interesting traversal, not three minutes of +repeated corridors or an enormous bounding box. + +Historical inspiration with coherent fantasy. The metaphor "95% credible, +5% madness" is not an agreed spawn probability. Extreme structures still +need purposeful support, circulation and a legible composition. + +Culture, epoch/building phase, local climate/materials, terrain, scale, +building use and condition should eventually influence design. Variation +means different architectural decisions, not palette swaps or random boxes. +Own authored modules are welcome; no downloaded schematics/templates. +Eventually contributors should author modules without understanding the +entire generator. No data-authoring interface is implemented yet. + +## Stable decisions + +- An independent invisible culture map, not a direct biome-to-style mapping. + Families: central European, Nordic, Mediterranean, desert/oriental-inspired, + east Asian, dark Gothic, high fantasy and maritime. These are planned + design families, not eight already implemented architectural grammars. +- Default culture scale: approximately **7 times linear biome extent**, + not seven biome areas. Current 1,024-block biome reference and 7,168-block + nominal region-site spacing are configurable development values, not a + measured Vanilla average. Do not rescale regions as exploration proceeds. +- Save parameters and algorithm versions must remain stable. No unasked + changes to existing structures or destructive regeneration on update. +- Materials derive from culture and local conditions. Vanilla remains the + base; optional mod mappings later. No compulsory content-mod dependency. +- Building history should ultimately affect constructed phases, repairs and + abandoned wings. Names, dynasties, heraldry and history currently remain + metadata; they are not physical banners, NPCs or reconstruction simulation. +- Occupancy eventually depends on condition **and** region; not every castle + is hostile. Population needs independent performance/simulation limits. + +## Architectural obligations + +Site constraints -> composition -> rooms/functions -> doors/stairs/routes -> +facades/roof junctions -> materials/condition -> furniture/light -> final +geometry checks -> bounded placement. Preserve ownership and model explicit +shared interfaces rather than allowing silent last-write-wins geometry. + +Judge distance silhouette, close facade/roof depth, and interior spatial +sequence separately. Purposeful primary/secondary masses, human-scale rooms, +planned windows, usable stair landings, protected routes and meaningful +furnishing matter. Access assertions are minimum technical requirements. + +Later terrain planning must choose among site-appropriate compositions, +terraces, ridge walls, foundations and bridges. Blindly increasing foundation +height or burying a fixed rectangle in a mountain is not adaptation. + +## Current milestone and status + +**One visually accepted medium-sized reference comes first.** Falkenwacht v1 +was rejected by the owner. V2 is a bounded detail study and remains unaccepted. +See ADR 0002 and its actual block views. Fixed composition/rotation, single +central-European study, shallow dry terrain only; max survey relief 3 blocks. + +Core model, deterministic generation, ownership and geometry checks exist. +Fabric has manual preview/confirm, tick-sliced terrain/preflight, bounded pure +worker, cancellation/stale-request handling, inspect and session-only undo. +Final confirmation is still synchronous. A block whitelist cannot establish +who placed a block. No guarantee of safe restoration of neighboring updates, +all-mod compatibility, real-time performance or spawn-safe lighting. + +Next gates: visual foundation, actual traversal/block behavior, then more +layout families and demanding terrain. Only after that: exploration worldgen, +larger compounds, more cultures, population and physical history/condition. +Automatic worldgen remains disabled now. + +Java/Fabric 26.1.2 is the current platform. Bedrock/consoles and NeoForge are +future adapters; portable architectural data is desirable, a common mod +binary is not promised. Keep existing dependency pins until intentionally +changed and checked. + +## Evidence and authorization + +Track compilation, pure generator checks, actual block renders, Minecraft +runtime, real movement/light/updates, owner visual approval and modpack/FPS +testing separately. Do not imply one establishes the others. No AI concept +image may masquerade as implemented geometry. + +Continue on the development PR chain; do not merge main, force-push shared +history, publish a release, accept EULAs or alter normal Prism instances, +long-term worlds, global Java/graphics settings or unrelated software without +explicit authorization. Use a clearly identified isolated environment for +runtime tests. Another chat does not supervise this work live. diff --git a/docs/REFERENCE_ARCHITECTURE.md b/docs/REFERENCE_ARCHITECTURE.md new file mode 100644 index 0000000..218a635 --- /dev/null +++ b/docs/REFERENCE_ARCHITECTURE.md @@ -0,0 +1,142 @@ +# Falkenwacht reference / 0.3.0-alpha.3 + +An experimental, independently authored reference castle. This is the start of +the new architecture direction, not a final procedural castle library or an +approved visual design. No schematics, external templates or game assets are used. + +## Layers + +| Layer | Responsibility | +|---|---| +| ArchitectureModel | Typed masses, room functions, floor levels, connections, roofs, windows, stair flights and route reservations, in canonical local coordinates | +| Module library | Authored composition and block construction for the keep, hall, residence, service wing, gate, corner towers and curtains | +| Interior designer | Furniture, bookshelves, seating, timber, decorative hearths and supported lights with circulation respected | +| Owned block buffer | Module ownership and explicit base interfaces; cross-owner solid writes/carving fail instead of silently replacing another module | +| QualityChecks | Structural/model validation and final checks after decoration, including intended routes and directed stairs | +| ReferenceCastlePlanner | Bounded terrain input, separate variant signature, deterministic site orientation and translation to world blocks | +| Fabric reference preview | Tick-sliced snapshot/preflight, bounded pure planning worker, existing protected confirmation and placement/undo jobs | + +The model uses integer blocks. Floor Y means the supporting floor block, so room +targets stand one block above it. Stair treads are ordered bottom to top; the +renderer and Fabric palette agree on facing and bottom stair/slab halves. +Canonical model coordinates are independent of the seed-selected world rotation. + +## How to try the reference + +Use a **separate disposable Creative world**, initially superflat, with cheats. +Keep the pinned Minecraft Java 26.1.2, Java 25, Fabric Loader 0.19.5+ and +Fabric API 0.155.3+26.1.2 environment. Install only the runtime +`castleforge-fabric-0.3.0-alpha.3.jar` from a successful branch build, not a +sources JAR and not two CastleForge versions simultaneously. + +```mcfunction +/castleforge preview reference +/castleforge status +``` + +The default centre is 58 blocks north of the command source. An explicit site +uses `/castleforge preview reference `. The 109 x 109 terrain survey must +already be loaded. The orientation depends on seed and position; the material +study remains central-European even in another culture region. + +Preparation takes several ticks and does not place blocks. Wait for +`PREVIEW READY`, then: + +```mcfunction +/castleforge inspect +/castleforge build confirm +/castleforge status +``` + +Confirm within 120 seconds after readiness and remain near the site. Inspect +reports the design signature, dimensions, rooms, stair flights, route checks, +rotation, relief, edits and timings. It describes the plan, not a rendered ghost. +At most one large reference preview is retained per server session. A pending +reference request belongs to its operator; a disconnected or dimension-changed +operator cannot later publish or reuse that request. + +`/castleforge cancel` cancels preparation or discards the operator's ready +reference preview. During placement it stops further edits, leaving a partial +castle. `/castleforge undo` reverts this session's most recent build, skipping +conflicting later edits. It is in-memory, is lost on shutdown and does not journal +all neighboring physics effects. It is not a world backup. + +Legacy controls remain `/castleforge preview [x z]` and +`/castleforge preview terraced [x z]`. No automatic placement is registered. + +## Deliberate boundaries + +- One maintained, authored layout; not eight cultural architectural grammars, + historical reconstruction, arbitrary castle diversity or ruin simulation. +- V2 divides the residential south wing into six real chambers, leaving the + northern stair lobbies open. It adds facade bays, roof lights and court uses; + this is still below the owner's visual benchmark. See REFERENCE_V2_STUDY.md. + V3 adds the elevated wall-walk circuit, tower platforms, a court stair and + upper gate crossing. These are checked in the final block plan, with runtime + traversal still pending. See REFERENCE_V3_WALLWALK.md. Tower roofs remain + outside the required route; the four new upper platforms are circulation, + not four additional furnished rooms. +- Shallow, dry, open terrain only. Difficult slopes and unknown/protected ground + are rejected; maximum survey relief is three blocks, and a rough approach can + be rejected separately. There is no deep excavation or automatic site search. +- Furniture is architectural blockwork. Bookshelves are ordinary blocks; + storage forms are decorative. No working containers, beds, doors, loot or NPCs. +- Hearths contain no real fire or lava. Lighting uses supported hanging lanterns, + without an exposed glowstone ceiling. +- The quality model supports the deliberately limited primitive palette. It + does not prove Minecraft collision shapes, stair corner recomputation, + player pathfinding, lighting, spawn safety, neighbor updates or undo at runtime. +- Snapshot and preflight have cooperative budgets (256 cells / 2 ms per tick), + and pure planning uses a worker. Final confirmation still checks synchronously; + individual Minecraft operations can exceed a cooperative budget. +- Existing terrain/building detection is conservative and permits only the + existing natural/replaceable-block set. No chunks are loaded automatically. +- No Bedrock, consoles, NeoForge, worldgen hooks, exploration-time generation, + settlement roads, monuments or existing-world migration. + +## Manual acceptance checklist (still required) + +1. Start the matching client, record the exact JAR hash, world seed and site. + Check startup/logs without shader packs first. +2. Preview, inspect and confirm on superflat. Walk the approach and gate into + the court. Visit every listed main room using its intended staircase, with + flight disabled. Check landings, headroom, stairs and floor openings. +3. Inspect both exterior directions, the gate, hall, residence, keep, windows, + roof valleys/joins and interiors using Vanilla textures. Look for missing + support, disconnected rooms, blocked windows and awkward repeated details. +4. Inspect light attachment and neighboring stair shapes after updates/reload. + Record darkness/light distribution rather than assuming the geometry proves it. +5. In another disposable build, cancel mid-placement and undo. After a complete + build, edit a few blocks and add a container deliberately, then undo and + verify those conflicts survive. Test unload/pause and reconnect separately. +6. Start a dedicated test server with an already accepted, applicable EULA; + verify server-only startup and the command path. This session does not accept + an EULA or claim a dedicated-server run. +7. Only then test shallow natural ground, site-change rejection between preview + and confirmation, and protected blocks. Record actual timings from inspect + and logs. Do not infer FPS from a core benchmark. + +## Reproducing geometry evidence + +Compile with the normal build (or the dependency-free verification script), then +export the actual generated canonical block data: + +```sh +java -Xmx512m -cp core/build/classes/java/main:core/build/classes/java/test \ + dev.castleforge.core.ReferenceExport build/reference 20261020 +python scripts/render-reference.py build/reference/blocks.tsv build/reference/southeast.png +python scripts/render-reference.py build/reference/blocks.tsv build/reference/northwest.png --turn 2 +python scripts/render-reference.py build/reference/blocks.tsv build/reference/ground-plan.png --top --cut-y 3 +python scripts/render-reference.py build/reference/blocks.tsv build/reference/hall-section.png --crop -19 -30 16 -18 --cut-y 13 +python scripts/render-reference.py build/reference/blocks.tsv build/reference/stair-section.png --crop -38 -29 -28 -14 --cut-y 24 +python scripts/render-reference.py build/reference/blocks.tsv build/reference/gate.png --crop -12 27 12 41 --elevation 15 +``` + +On Windows use `;` instead of `:` in the Java classpath. The standalone renderer +requires Python 3.10+ and Pillow. It draws only the generated block primitives; +it imports no Minecraft textures and is not an in-game screenshot. CI exports +the TSV/model and verifies the JAR metadata/hash separately. The evidence record +contains the actual tested commands/results and known visual findings. + +These cuts deliberately remove intersected walls/floors to expose the inside; +cropped beam ends are section boundaries, not floating beams in the full plan. diff --git a/docs/REFERENCE_V2_STUDY.md b/docs/REFERENCE_V2_STUDY.md new file mode 100644 index 0000000..da9b852 --- /dev/null +++ b/docs/REFERENCE_V2_STUDY.md @@ -0,0 +1,137 @@ +# Falkenwacht v2: detail study, not accepted architecture + +Runtime version: **0.3.0-alpha.2**. Branch: +`feat/castleforge-0.3-architecture-core`, continuing PR #7 from `e94e13f`. +PR base remains `feat/reference-castle-0.3`; main is unchanged. + +The owner's v1 Minecraft screenshots were reviewed and the visual rejection +is accepted. This iteration fixes selected architectural weaknesses, **not +the complete gap to month-long player builds**. Read +[ADR 0002](ADR_0002_VISUAL_REJECTION_AND_DETAIL_STUDY.md) and the +[product direction](PRODUCT_DIRECTION.md) for what remains mandatory. + +## Actual changes + +| Area | V1 | V2 study | +|---|---|---| +| Residential rooms | One logical room per entire storey | Separate stair lobby plus two chambers per storey; nine physical partitions and protected portals | +| Hall / east residence windows | Single-block slit glazing | 22 declared wide facade bays with projecting surrounds; interior/exterior clearance verified | +| Roof detail | Uninterrupted roof planes and blank gables | Two owned roof lights, timber/plaster gable framing, a hearth chimney | +| Hall | One oversized-height table; high lamps | Two lower banquet tables, sideboard/tapestry, lower wall brackets, processional floor band, relocated hearth | +| Court | Fully reserved empty pavement | Covered decorative well, herb garden, seating arbor; explicit free approach and paving hierarchy | +| Rejection diagnostics | Unknown/protected ground | Actual BlockState and separate block-entity reason; conservative policy retained | + +There are 15 primary modules, 23 declared reachable rooms, 14 three-wide +stair flights and 72 declared wall windows. Wider windows and roof lights +do not imply more distinct layouts. There is still one authored composition. + +## Generated geometry views + +These are **technical renderings of actual emitted blocks**, not Minecraft +screenshots, concepts, textures or a lighting simulation. Cropped sections +remove walls/ceilings to expose furnishings; apparent floating brackets in a +section attach to the omitted walls in the full build. New top slabs are +rendered as top halves, unlike ordinary bottom slabs. Colors are schematic. + +### Exterior comparison, same seed/site and camera + +V1 (rejected): + +![V1 actual geometry](evidence/reference-v1/southeast.png) + +V2 study: + +![V2 southeast](evidence/reference-v2/southeast.png) + +![V2 northwest](evidence/reference-v2/northwest.png) + +### Close views and floor plans + +![Residential facade](evidence/reference-v2/residence-facade.png) + +![Ground plan](evidence/reference-v2/ground-plan.png) + +![Upper residential chambers](evidence/reference-v2/residence-plan.png) + +![Hall section](evidence/reference-v2/hall-section.png) + +![Hall furniture](evidence/reference-v2/hall-furniture.png) + +![Keep staircase](evidence/reference-v2/stair-section.png) + +![Gate approach](evidence/reference-v2/gate.png) + +## Assessment: gate remains open + +The residential elevation now has depth, recognizable upper infill and +roof articulation. Separate chambers make the floor plan more purposeful; +table height no longer dwarfs the benches. These are concrete improvements. + +The enclosing rectangle and overall massing are mostly unchanged. The keep, +gatehouse, curtains and service elevations are still simple; the court is +too broad to feel densely inhabited. The north stair lobbies are generous. +Only selected elevations use the new bay vocabulary. There is no complete +wall-walk circuit. No claim of production-worthy aesthetics or owner approval. + +## Verification status + +- Baseline was rerun before changes: all four suites passed, including v1's + 30 accepted sites and 24 deliberate invalid cases. +- Unchanged classic: 50 seeds / 5,727,712 assertions. Terraced: 160 accepted + sites / 24,757,466 assertions; old digest + `6fd20d8855fdc190a7e81e9772cef9d4aad3974a3a405ca25f31161b643f7828` retained. +- Identity: 100 seeds x eight cultures / 23,210 assertions. +- V2 reference: 30 accepted sites, 29 deliberate invalid cases, one + interruption case / 1,634 assertions. Determinism, all four rotations, + negative/world-edge coordinates, terrain bounds, routes, stairs, supports, + room/partition separation, glazing, removed partitions/jambs/dormer cap + and blocked chamber portals are covered. Java 21, 512 MiB heap. +- The exported model records the exact final block digest and one cold + planning duration in [model.txt](evidence/reference-v2/model.txt). Duration + is not an FPS measurement or a benchmark. +- All nine final geometry views inspected. **No new Minecraft launch, + player traversal, runtime lighting, slab/neighbor-update or undo test.** +- V1's supplied screenshots establish that the owner ran the previous build; + they cannot establish runtime correctness of alpha.2. +- Full Java 25 / pinned Gradle 9.4.0 / Fabric build passed on implementation + commit `1a1f9665880587bf2c27b01263c398801f76ce0f` in + [Actions 39472126739](https://github.com/badmon61/castleforge/actions/runs/39472126739). + All four suites passed; runtime metadata/classes and archive boundaries + passed. Linux/Java 25 and local Windows/Java 21 produced the same final + block export digest: + `b386fb67d8792062e7584e9d235cf0e7df985fe7a5969917d2b8a998eeae8252`. + +## Built runtime artifact + +[Download the build ZIP](https://github.com/badmon61/castleforge/actions/runs/39472126739/artifacts/12287682707). +It contains runtime and sources JARs; install only +`castleforge-fabric-0.3.0-alpha.2.jar`. + +Runtime JAR SHA-256: +`8cc64de9ef0510ead4e02f05c3f47a386f6274c016f66f2622b27112ed180eda`. +This is the JAR digest, not the download ZIP digest. +The subsequent commit records build evidence only; it changes no runtime code. + +## Reproduce / narrowly test + +```powershell +./scripts/verify-core.ps1 -ExportReference +python scripts/render-reference-set.py build/reference docs/evidence/reference-v2 --label "Falkenwacht v2" +``` + +Linux/CI: build with the pinned JDK 25 / Gradle 9.4.0; run ReferenceExport +using the main and test classpaths as shown in REFERENCE_ARCHITECTURE.md. +Evidence uses seed `20261020`, origin `(0,0)`, constant surface `64` and +rotation `3`. Model coordinates in the TSV/views are canonical. + +First compare the facade/chamber/hall images above; another full-world +playtest is not required merely because the build is green. If testing the +increment in a separate disposable superflat instance, install only alpha.2 +runtime, then `/castleforge preview reference`, wait for `PREVIEW READY`, +inspect and confirm. Compare wide windows, residential doorways and the new +table/slab height with flight disabled. Check night lighting without shaders +and actual lantern attachment, then cancellation/conflict-preserving undo. + +No existing Prism instance, downloaded example world or long-term save was +modified. Relief remains <=3 blocks; no automatic world generation. V1 +remains available at its prior commit/artifact and in the retained evidence. diff --git a/docs/REFERENCE_V3_WALLWALK.md b/docs/REFERENCE_V3_WALLWALK.md new file mode 100644 index 0000000..a8fbf55 --- /dev/null +++ b/docs/REFERENCE_V3_WALLWALK.md @@ -0,0 +1,163 @@ +# Falkenwacht v3: connected defensive circuit + +Version **0.3.0-alpha.3**, 2026-10-21. Continues +`feat/castleforge-0.3-architecture-core@0a51fc716e1d6fc87be5288212a820fe57526ccc`. +PR #7 remains a draft based on `feat/reference-castle-0.3@d2224b0`, not main. +The checkout was clean before this work. V2 already contained the chambers, +facade bays and courtyard ensembles; those were not reimplemented. + +## Decision and actual changes + +The v2 block views show a stronger residence but an enclosing rectangle with +disconnected curtain tops. Complete a meaningful exploration route before +adding another layout family. This is a focused increment, not visual acceptance +of the whole castle or completion of issue #4's multi-family generator. + +- Immutable, typed `WallWalk` sections extend the existing architecture model. + Five curtain sections, four tower platforms, an upper gate crossing and a + court stair declare their deck, guard ownership and protected circulation. +- Three-block-wide walks run on floor Y=6, through all four corner towers. + Two three-wide, two-rise flights meet the gatehouse's existing floor Y=8. + The gate's internal stair supplies another access to the circuit. +- A three-wide six-rise court stair has broad upper/lower landings. Tower + floor Y=6 is a real ceiling over the lower guardroom. Portal chamfers are + narrowed from two blocks to one, preserving the original ground-room bounds. +- Inner parapets and outer crenels follow the planned paths. The court stair + shares the west curtain's guard column explicitly in the model; the emitter + still rejects cross-owner writes. Projecting tower-corner guards have floor + corbels tied into the surrounding tower floor. +- Guards, floors, route clearance, three-block headroom and final connectivity + are checked after furnishing. The upper gate gets fitted seating clear of + its widened crossing; furnishing requirements were not weakened. +- Architecture signature/version become `falkenwacht-v3-wallwalk` / 3. No culture + geography, 7x scaling, save settings, classic/terraced code or Fabric placement, + conflict, cancellation and undo policy changed. No worldgen was added. + +The new module is an open court stair. Curtain bounds on the south reserve the +raised transition and its headroom; the ordinary curtain masonry stays six +blocks high. Extended inner decks are tied into the curtain masonry rather than +standing on arbitrary tall site foundations. The site relief limit remains 3. + +## Geometry and local verification + +Baseline alpha.2 passed all four suites before edits. Final local verification: +Windows, Temurin 21.0.5, `javac --release 21`, `java -Xmx512m`. + +| Suite | Actual result | +|---|---| +| Classic | PASS: 50 seeds, 5,727,712 assertions | +| Terraced | PASS: 160 sites, 24,757,466 assertions; unchanged golden digest | +| Identity | PASS: 100 seeds x eight cultures, 23,210 assertions | +| Reference v3 | PASS: 30 accepted sites, 36 invalid scenarios, one interruption scenario, 1,905 assertions | + +The reference suite includes all four rotations, negative/world-edge coordinates, +shallow terrain, deterministic replays and final furnished geometry. An independent +340-block closed elevated centreline crosses all four towers and the upper gate; +it cannot substitute a ground-level shortcut for a missing connection. Every lane +of the three new flights is sampled as actual straight-stair half-block surfaces +between full-width landings. Removing deck/guard cells, blocking tower/gate routes, +or reversing any new flight is rejected. These tests model the supported primitive +subset, not Minecraft's complete collision or neighboring-block behavior. + +Terraced digest retained: +`6fd20d8855fdc190a7e81e9772cef9d4aad3974a3a405ca25f31161b643f7828`. + +Reference suite digest (seed 42): +`aa1aa7c28847d98c8cd86ebe3d89c9c236b16b87717c22003fecd09c6b1b7a87`. + +Evidence TSV digest (seed 20261020, origin 0,0, flat ground 64, rotation 3): +`95a8968c6a41b3bc2dabb673af8ce01c8ea3bdaddacbc31a4f3675e8b2983e4d`. + +16 modules, 23 declared reachable rooms, 17 stair flights, 72 windows; +94,024 planned cells, including 40,792 non-air cells and 53,232 explicit air +cells; 18,299 reserved clearance cells. Tower upper platforms are circulation, +not four new furnished rooms. Extent remains 101 x 95 x 44 blocks. One cold +export planning invocation was 351 ms locally; this is not an FPS measurement, +server-tick benchmark or measured peak-memory result. + +## Actual emitted block views + +All thirteen views were inspected. These are **technical renderings of the +actual exported block plan**, without Minecraft assets, textures, lighting or +physics. Cuts omit roofs/walls intentionally; the low circuit cut omits the +raised gate crossing, which is shown separately. Compare v2's retained evidence. + +![Southeast](evidence/reference-v3/southeast.png) +![Northwest](evidence/reference-v3/northwest.png) +![Court stair](evidence/reference-v3/court-stair.png) +![Elevated circuit cut](evidence/reference-v3/wallwalk-plan.png) +![Raised gate crossing](evidence/reference-v3/gate-link.png) +![Northeast tower cut](evidence/reference-v3/tower-crossing.png) +![Ground plan](evidence/reference-v3/ground-plan.png) +![Gate approach](evidence/reference-v3/gate.png) +![Great hall](evidence/reference-v3/hall-section.png) +![Hall furniture](evidence/reference-v3/hall-furniture.png) +![Keep stair](evidence/reference-v3/stair-section.png) +![Residence chambers](evidence/reference-v3/residence-plan.png) +![Residence facade](evidence/reference-v3/residence-facade.png) + +First visual iteration had two-course continuous guards: these concealed views +and made the walls too closed. The final version uses low inner parapets and +outer crenels. The stair/circuit now have readable entrances. The main massing, +large gridded court paving, simple gate/keep and undecorated upper tower platforms +remain weak. This is progress in spatial exploration, not a claim that the castle +has reached the requested hand-built visual standard. + +## Build and runtime gates + +Full pinned Java 25 / Gradle 9.4.0 / Fabric build **passed in 37 seconds** on +implementation commit `30304ce362b194609bf733caddf096bb7ed32b21`: +[Actions 39654766926](https://github.com/badmon61/castleforge/actions/runs/39654766926). +All four suites passed; reference took 11.03 s on that runner. Linux/Java 25 +and Windows/Java 21 block TSV exports match byte for byte (digest above). + +[Build ZIP artifact 12369699086](https://github.com/badmon61/castleforge/actions/runs/39654766926/artifacts/12369699086) +contains runtime and sources. Install only `castleforge-fabric-0.3.0-alpha.3.jar`. +The artifact was downloaded and independently inspected: mod version/target, +new `WallWalk`/library classes and old culture/planner classes, Java 21 core +and Java 25 adapter bytecode, no bundled Minecraft binaries or test suites. +Both downloaded ZIP digests match GitHub's artifact metadata. + +Runtime JAR SHA-256: +`590ccbb3a684b2cab609775913de84fb16df93dd75210d09b9341afa10aa6efa`. + +[Verification artifact 12369808895](https://github.com/badmon61/castleforge/actions/runs/39654766926/artifacts/12369808895) +contains the build log, actual exported blocks/model and JAR hash. A subsequent +documentation commit records this result and changes no runtime code. + +No Minecraft client/server was launched in this round. Actual player movement, +stairs after neighbor updates, lighting, reload, cancellation/undo and performance +remain unconfirmed. No Prism instance, long-term world or global setting changed. + +## Focused disposable-world test + +Use an isolated Prism instance named `CastleForge-alpha3-abnahme` with a new +Creative superflat world, seed `20261020`, cheats and Vanilla textures. Verify +the actually active Minecraft 26.1.2, Loader >=0.19.5, Fabric API +0.155.3+26.1.2 and Java 25. Install the runtime alpha.3 JAR only, not sources. +No existing instance has been created or altered by this development round. + +1. Keep the entire 109 x 109 survey loaded. Run `/castleforge preview reference`, + wait for `PREVIEW READY`, then `/castleforge inspect`, `/castleforge build confirm`. +2. Enter the court and disable flight. Use the new stair beside the herb garden. + Walk a full circuit in both directions, including every corner tower and + both steps into/out of the upper gate. Also descend via the gate's old stair. + The court stair is west in canonical geometry; rotation changes compass sides. +3. Check all three lanes and overhead clearance, actual automatic stair shapes, + the lower guardrooms' new ceilings, upper-gate seating and window clearance. +4. Compare dusk/night lighting without shaders. The new platforms have no added + lamps; core reachability does not prove adequate nighttime illumination. +5. In disposable builds, test cancel mid-placement and session undo; then edit + blocks/add a container and verify those conflicts survive undo. Record logs. + +For an agent-run local playtest, separate authorization is required to create +and launch exactly this isolated instance/world, install only the pinned test +dependencies and alpha.3 runtime, and exercise the commands above. This follows +the user's handoff boundary; no EULA or unrelated installation is authorized. + +Reproduce core/evidence: + +```powershell +./scripts/verify-core.ps1 -ExportReference +python scripts/render-reference-set.py build/reference docs/evidence/reference-v3 +``` diff --git a/docs/REFERENCE_VALIDATION.md b/docs/REFERENCE_VALIDATION.md new file mode 100644 index 0000000..0f6e6a0 --- /dev/null +++ b/docs/REFERENCE_VALIDATION.md @@ -0,0 +1,140 @@ +# Reference validation / 2026-10-20 + +Branch: `feat/castleforge-0.3-architecture-core`, based on +`feat/reference-castle-0.3@d2224b09c2b6ca34f13fb6ce7fb64ca4611a0378`. +Version: `0.3.0-alpha.1`. No merge, release, installed-instance changes or +existing-world changes. + +## Actually executed locally + +Windows, Temurin JDK 21.0.5, dependency-free `javac --release 21` and +`java -Xmx512m`. Baseline's three suites passed before implementation and were +rerun with the complete new source through `scripts/verify-core.ps1 -ExportReference`. + +| Suite | Result | +|---|---| +| Classic | PASS: 50 seeds; 5,727,712 invariant assertions | +| Terraced | PASS: 160 sites, no unexpected rejection; 100 bridge / 96 stair sites; 4.23 s locally | +| Identity/diagnostics | PASS: 100 seeds x eight cultures; 23,210 assertions | +| Reference | PASS: 30 accepted sites, 24 deliberate invalid scenarios, one interrupted-planner test; 1,319 assertions; 6.57 s locally | + +Per-voxel assertions are not millions of distinct scenarios. Reference covers +16 seeds/all four orientations, all eight culture metadata values, negative and +world-edge positions, two shallow terrains in every orientation, deterministic +replays, model/room/module validity, final route clearance, stairs, supports, +window exteriors, roof presence/anchoring and attachment ordering. Mutations +must fail. An independent half-block surface walk tests all five approach lanes +from natural ground to the gate; the runtime planner also rejects an unsafe approach. + +Classic/terraced generation, culture map, save settings and legacy palette source +files were not changed. Terraced digest remains: + +```text +6fd20d8855fdc190a7e81e9772cef9d4aad3974a3a405ca25f31161b643f7828 +``` + +New suite's block digest, seed 42 / origin 0,0 / surface 64: + +```text +9bb35ccdbf83bf34e1c5d051b2528361ce364995816003de8a82337047597682 +``` + +## Actual generated-block visual evidence + +Exporter: `ReferenceExport`; renderer: `scripts/render-reference.py`, Python +3.10.11 / Pillow 12.0.0. **These are technical geometry views, not Minecraft +screenshots, generated concept pictures, Minecraft textures or game-physics tests.** + +Fixed view input: seed `20261020`, world origin `0,0`, flat surface `64`, selected +rotation `3` (270 degrees). The images show canonical local coordinates so that +the same modules and sections remain comparable regardless of world rotation. + +- 15 modules, 17 declared reachable rooms, 14 three-block-wide stair flights, + 72 windows and 16,817 reserved route cells. +- 89,196 planned cells: 36,225 non-air cells and 52,971 explicit clearance cells. +- Plan extent including overhangs/approach: 101 x 95 x 44 blocks + (local x -50..50, z -41..53, y 0..43). +- One cold export planning call: 302 ms locally; this is not a benchmark, server + tick timing, peak-memory measurement or FPS claim. Heap limit was 512 MiB. +- 85 hanging lanterns; no glowstone, ladders, block entities, doors, beds or fire. + +TSV SHA-256 (the differently formatted suite digest above is intentionally distinct): + +```text +2e6567c1476f1bc35938f1b44a9edec993c6d83619b78eb5317b6bc0b305c6c1 +``` + +[Exact generated model](evidence/reference-v1/model.txt) + +![Southeast composition](evidence/reference-v1/southeast.png) +![Northwest composition](evidence/reference-v1/northwest.png) +![Actual ground-floor cut](evidence/reference-v1/ground-plan.png) +![Gatehouse and outside approach](evidence/reference-v1/gate.png) +![Great hall section: table, seating, hearth and timber](evidence/reference-v1/hall-section.png) +![Keep circulation section](evidence/reference-v1/stair-section.png) + +The sections intentionally cut walls/floors and beams. Exposed cut faces are not +claims that those elements float in the full plan. The renderer handles straight +stairs, bottom slabs and simplified lantern geometry; neighbor-computed stair +corners and light are not simulated. + +## Iteration performed + +1. Collision checks caught overlapping roof overhangs at a wing junction. Added + an explicit dominant-mass roof abutment/cropping rule; did not disable ownership. +2. Independent approach tests caught a full-block jump at the raised gate and + another at the outside edge on rotated shallow terrain. Corrected tread + heights and per-lane taper; invalid rough approaches are rejected. +3. Viewed both complete generated block perspectives. Added windows to exposed + keep and courtyard-facing wings; checked them against actual exterior cells. +4. Inspected hall/stair cuts and floor plan. Fixed skipped bedroom, kitchen and + guardroom ensembles, required functional furniture per room, replaced floating + lamp supports, and filled the staircase's central gap with a supporting spine. +5. Re-exported the fixed seed and regenerated/reviewed the final views above. + +## Build and runtime status + +The local offline cache lacks pinned Gradle 9.4.0 and Fabric/Mojang dependencies. +Microsoft JDK 25.0.1 is available, but a full local offline Fabric build was not +claimed. The pinned complete build succeeded in +[GitHub Actions run 39462643241](https://github.com/badmon61/castleforge/actions/runs/39462643241) +for implementation commit `32c267506f5b4dc4f4f6ca6f19a86d1abd166a6e`: + +- Java 25 / Gradle 9.4.0; `gradle --no-daemon build --stacktrace`: + **BUILD SUCCESSFUL in 35s**. All four suites passed; reference took 10.54 s on CI. +- Archive metadata, included old/new runtime classes and absence of bundled + Minecraft classes/test suites passed `verify-artifact.py`. +- Actual-block export on Linux/Java 25 matched the local Windows/Java 21 TSV + digest exactly. Its cold planning invocation took 614 ms on that runner. +- [JAR artifact 12283402667](https://github.com/badmon61/castleforge/actions/runs/39462643241/artifacts/12283402667) + contains the runtime and sources JAR. Install only the runtime JAR below. +- `verification-reports` artifact `12282773379` contains the build log, + actual block TSV, model and JAR digest. The ZIP artifact digest is distinct + from the runtime JAR's SHA-256. + +Runtime artifact: `castleforge-fabric-0.3.0-alpha.1.jar`: + +```text +a253ce625e9b6baeaa3a57218b4c4e2c05c7313abf1ffc24dcfa79f5f5eac7d1 +``` + +[Draft PR #7](https://github.com/badmon61/castleforge/pull/7) targets +`feat/reference-castle-0.3`, not `main`. This evidence update changes documentation +only after the tested implementation commit. + +**Not performed:** Minecraft client launch, actual player traversal/collision, +GameTests, dedicated-server start, runtime neighbor updates, block-entity conflict +undo, runtime cancellation/reconnect, shader/Vanilla-texture acceptance, real +snapshot/preflight/placement tick timing or peak-memory profiling. No EULA was +accepted for a new server. These are separate gates in the manual test guide. + +## Still weak / intentionally deferred + +The court remains sparse and the residential storeys need finer subdivisions. +Curtain tops do not yet have a complete accessible wall-walk circuit. Roof +verification is conservative voxel connection/anchoring plus module ownership, +not structural engineering or proof that every visual join is attractive. +Furniture is decorative, and there is one fixed layout with four rotations. +Survey relief is capped at three blocks; a rough approach may still be rejected. +Final `build confirm` conflict checks remain synchronous. The design stays a +draft until real-game checks and the user's visual decision. diff --git a/docs/evidence/reference-v1/gate.png b/docs/evidence/reference-v1/gate.png new file mode 100644 index 0000000..ecb3868 Binary files /dev/null and b/docs/evidence/reference-v1/gate.png differ diff --git a/docs/evidence/reference-v1/ground-plan.png b/docs/evidence/reference-v1/ground-plan.png new file mode 100644 index 0000000..9b2e7b3 Binary files /dev/null and b/docs/evidence/reference-v1/ground-plan.png differ diff --git a/docs/evidence/reference-v1/hall-section.png b/docs/evidence/reference-v1/hall-section.png new file mode 100644 index 0000000..9a8ff3c Binary files /dev/null and b/docs/evidence/reference-v1/hall-section.png differ diff --git a/docs/evidence/reference-v1/model.txt b/docs/evidence/reference-v1/model.txt new file mode 100644 index 0000000..9a87869 --- /dev/null +++ b/docs/evidence/reference-v1/model.txt @@ -0,0 +1,73 @@ +Actual generated architecture, canonical local coordinates +variant=falkenwacht-v1 +seed=20261020 origin=0,0 ground=64 rotation=3 +planMillis=302 (one cold invocation; not a benchmark) +blocks.tsv.sha256=2e6567c1476f1bc35938f1b44a9edec993c6d83619b78eb5317b6bc0b305c6c1 +15 modules, 17 rooms (17 reachable), 14 stair flights, 72 windows; 89196 planned cells, 16817 protected route cells + +Modules +Module[id=keep, type=KEEP, bounds=Box[minX=-39, minY=0, minZ=-30, maxX=-21, maxY=32, maxZ=-12], floors=[0, 8, 16, 24], roof=HIP, chamfer=3] +Module[id=hall, type=GREAT_HALL, bounds=Box[minX=-20, minY=0, minZ=-30, maxX=17, maxY=14, maxZ=-11], floors=[0], roof=GABLE_X, chamfer=0] +Module[id=residence, type=RESIDENCE, bounds=Box[minX=18, minY=0, minZ=-30, maxX=36, maxY=22, maxZ=3], floors=[0, 8, 16], roof=GABLE_Z, chamfer=0] +Module[id=kitchen, type=SERVICE_WING, bounds=Box[minX=18, minY=0, minZ=4, maxX=36, maxY=10, maxZ=19], floors=[0], roof=HIP, chamfer=0] +Module[id=service, type=SERVICE_WING, bounds=Box[minX=-39, minY=0, minZ=-11, maxX=-21, maxY=16, maxZ=12], floors=[0, 8], roof=GABLE_Z, chamfer=0] +Module[id=gate, type=GATEHOUSE, bounds=Box[minX=-11, minY=0, minZ=28, maxX=11, maxY=19, maxZ=40], floors=[0, 8], roof=HIP, chamfer=0] +Module[id=northwest, type=CORNER_TOWER, bounds=Box[minX=-49, minY=0, minZ=-40, maxX=-40, maxY=13, maxZ=-31], floors=[0], roof=HIP, chamfer=2] +Module[id=northeast, type=CORNER_TOWER, bounds=Box[minX=40, minY=0, minZ=-40, maxX=49, maxY=17, maxZ=-31], floors=[0], roof=HIP, chamfer=2] +Module[id=southwest, type=CORNER_TOWER, bounds=Box[minX=-49, minY=0, minZ=30, maxX=-40, maxY=10, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=2] +Module[id=southeast, type=CORNER_TOWER, bounds=Box[minX=40, minY=0, minZ=30, maxX=49, maxY=14, maxZ=40], floors=[0], roof=HIP, chamfer=2] +Module[id=northwall, type=CURTAIN, bounds=Box[minX=-39, minY=0, minZ=-40, maxX=39, maxY=6, maxZ=-38], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=westwall, type=CURTAIN, bounds=Box[minX=-49, minY=0, minZ=-30, maxX=-47, maxY=6, maxZ=29], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=eastwall, type=CURTAIN, bounds=Box[minX=47, minY=0, minZ=-30, maxX=49, maxY=6, maxZ=29], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=southwall-west, type=CURTAIN, bounds=Box[minX=-39, minY=0, minZ=38, maxX=-12, maxY=6, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=southwall-east, type=CURTAIN, bounds=Box[minX=12, minY=0, minZ=38, maxX=39, maxY=6, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=0] + +Rooms +Room[id=keep-0, moduleId=keep, type=STAIR_HALL, interior=Box[minX=-37, minY=1, minZ=-28, maxX=-23, maxY=6, maxZ=-14], floorY=0, target=Pos[x=-24, y=1, z=-15]] +Room[id=keep-8, moduleId=keep, type=LIBRARY, interior=Box[minX=-37, minY=9, minZ=-28, maxX=-23, maxY=14, maxZ=-14], floorY=8, target=Pos[x=-24, y=9, z=-15]] +Room[id=keep-16, moduleId=keep, type=BEDCHAMBER, interior=Box[minX=-37, minY=17, minZ=-28, maxX=-23, maxY=22, maxZ=-14], floorY=16, target=Pos[x=-24, y=17, z=-15]] +Room[id=keep-24, moduleId=keep, type=SOLAR, interior=Box[minX=-37, minY=25, minZ=-28, maxX=-23, maxY=30, maxZ=-14], floorY=24, target=Pos[x=-24, y=25, z=-15]] +Room[id=great-hall, moduleId=hall, type=GREAT_HALL, interior=Box[minX=-19, minY=1, minZ=-29, maxX=16, maxY=6, maxZ=-12], floorY=0, target=Pos[x=0, y=1, z=-15]] +Room[id=residence-0, moduleId=residence, type=GUARDROOM, interior=Box[minX=19, minY=1, minZ=-29, maxX=35, maxY=6, maxZ=2], floorY=0, target=Pos[x=22, y=1, z=-15]] +Room[id=residence-8, moduleId=residence, type=BEDCHAMBER, interior=Box[minX=19, minY=9, minZ=-29, maxX=35, maxY=14, maxZ=2], floorY=8, target=Pos[x=22, y=9, z=-15]] +Room[id=residence-16, moduleId=residence, type=LIBRARY, interior=Box[minX=19, minY=17, minZ=-29, maxX=35, maxY=21, maxZ=2], floorY=16, target=Pos[x=22, y=17, z=-15]] +Room[id=kitchen-room, moduleId=kitchen, type=KITCHEN, interior=Box[minX=19, minY=1, minZ=5, maxX=35, maxY=6, maxZ=18], floorY=0, target=Pos[x=22, y=1, z=10]] +Room[id=service-0, moduleId=service, type=STORE, interior=Box[minX=-38, minY=1, minZ=-10, maxX=-22, maxY=6, maxZ=11], floorY=0, target=Pos[x=-25, y=1, z=8]] +Room[id=service-8, moduleId=service, type=LIBRARY, interior=Box[minX=-38, minY=9, minZ=-10, maxX=-22, maxY=14, maxZ=11], floorY=8, target=Pos[x=-25, y=9, z=8]] +Room[id=gate-guard, moduleId=gate, type=GUARDROOM, interior=Box[minX=-10, minY=1, minZ=29, maxX=10, maxY=6, maxZ=39], floorY=0, target=Pos[x=5, y=1, z=38]] +Room[id=gate-watch, moduleId=gate, type=GUARDROOM, interior=Box[minX=-10, minY=9, minZ=29, maxX=10, maxY=14, maxZ=39], floorY=8, target=Pos[x=5, y=9, z=38]] +Room[id=northwest-guard, moduleId=northwest, type=GUARDROOM, interior=Box[minX=-47, minY=1, minZ=-38, maxX=-42, maxY=6, maxZ=-33], floorY=0, target=Pos[x=-44, y=1, z=-35]] +Room[id=northeast-guard, moduleId=northeast, type=GUARDROOM, interior=Box[minX=42, minY=1, minZ=-38, maxX=47, maxY=6, maxZ=-33], floorY=0, target=Pos[x=44, y=1, z=-35]] +Room[id=southwest-guard, moduleId=southwest, type=GUARDROOM, interior=Box[minX=-47, minY=1, minZ=32, maxX=-42, maxY=6, maxZ=38], floorY=0, target=Pos[x=-44, y=1, z=35]] +Room[id=southeast-guard, moduleId=southeast, type=GUARDROOM, interior=Box[minX=42, minY=1, minZ=32, maxX=47, maxY=6, maxZ=38], floorY=0, target=Pos[x=44, y=1, z=35]] + +Connections +Connection[id=court-hall, from=courtyard, to=hall, aperture=Box[minX=-1, minY=1, minZ=-11, maxX=1, maxY=3, maxZ=-11]] +Connection[id=hall-keep, from=hall, to=keep, aperture=Box[minX=-21, minY=1, minZ=-17, maxX=-20, maxY=3, maxZ=-15]] +Connection[id=hall-residence, from=hall, to=residence, aperture=Box[minX=17, minY=1, minZ=-17, maxX=18, maxY=3, maxZ=-15]] +Connection[id=keep-service, from=keep, to=service, aperture=Box[minX=-26, minY=1, minZ=-12, maxX=-24, maxY=3, maxZ=-11]] +Connection[id=court-service, from=courtyard, to=service, aperture=Box[minX=-21, minY=1, minZ=7, maxX=-21, maxY=3, maxZ=9]] +Connection[id=residence-kitchen, from=residence, to=kitchen, aperture=Box[minX=21, minY=1, minZ=3, maxX=23, maxY=3, maxZ=4]] +Connection[id=court-kitchen, from=courtyard, to=kitchen, aperture=Box[minX=18, minY=1, minZ=9, maxX=18, maxY=3, maxZ=11]] +Connection[id=court-gate, from=courtyard, to=gate, aperture=Box[minX=-2, minY=1, minZ=28, maxX=2, maxY=5, maxZ=28]] +Connection[id=gate-outside, from=gate, to=outside, aperture=Box[minX=-2, minY=1, minZ=40, maxX=2, maxY=5, maxZ=40]] +Connection[id=court-northwest, from=courtyard, to=northwest, aperture=Box[minX=-45, minY=1, minZ=-31, maxX=-43, maxY=3, maxZ=-31]] +Connection[id=court-northeast, from=courtyard, to=northeast, aperture=Box[minX=43, minY=1, minZ=-31, maxX=45, maxY=3, maxZ=-31]] +Connection[id=court-southwest, from=courtyard, to=southwest, aperture=Box[minX=-45, minY=1, minZ=30, maxX=-43, maxY=3, maxZ=30]] +Connection[id=court-southeast, from=courtyard, to=southeast, aperture=Box[minX=43, minY=1, minZ=30, maxX=45, maxY=3, maxZ=30]] + +Stair flights +StairFlight[id=keep-0-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=1, z=-20], Pos[x=-35, y=1, z=-20], Pos[x=-34, y=1, z=-20]], [Pos[x=-36, y=2, z=-21], Pos[x=-35, y=2, z=-21], Pos[x=-34, y=2, z=-21]], [Pos[x=-36, y=3, z=-22], Pos[x=-35, y=3, z=-22], Pos[x=-34, y=3, z=-22]], [Pos[x=-36, y=4, z=-23], Pos[x=-35, y=4, z=-23], Pos[x=-34, y=4, z=-23]]]] +StairFlight[id=keep-0-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=5, z=-23], Pos[x=-30, y=5, z=-23], Pos[x=-29, y=5, z=-23]], [Pos[x=-31, y=6, z=-22], Pos[x=-30, y=6, z=-22], Pos[x=-29, y=6, z=-22]], [Pos[x=-31, y=7, z=-21], Pos[x=-30, y=7, z=-21], Pos[x=-29, y=7, z=-21]], [Pos[x=-31, y=8, z=-20], Pos[x=-30, y=8, z=-20], Pos[x=-29, y=8, z=-20]]]] +StairFlight[id=keep-8-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=9, z=-20], Pos[x=-35, y=9, z=-20], Pos[x=-34, y=9, z=-20]], [Pos[x=-36, y=10, z=-21], Pos[x=-35, y=10, z=-21], Pos[x=-34, y=10, z=-21]], [Pos[x=-36, y=11, z=-22], Pos[x=-35, y=11, z=-22], Pos[x=-34, y=11, z=-22]], [Pos[x=-36, y=12, z=-23], Pos[x=-35, y=12, z=-23], Pos[x=-34, y=12, z=-23]]]] +StairFlight[id=keep-8-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=13, z=-23], Pos[x=-30, y=13, z=-23], Pos[x=-29, y=13, z=-23]], [Pos[x=-31, y=14, z=-22], Pos[x=-30, y=14, z=-22], Pos[x=-29, y=14, z=-22]], [Pos[x=-31, y=15, z=-21], Pos[x=-30, y=15, z=-21], Pos[x=-29, y=15, z=-21]], [Pos[x=-31, y=16, z=-20], Pos[x=-30, y=16, z=-20], Pos[x=-29, y=16, z=-20]]]] +StairFlight[id=keep-16-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=17, z=-20], Pos[x=-35, y=17, z=-20], Pos[x=-34, y=17, z=-20]], [Pos[x=-36, y=18, z=-21], Pos[x=-35, y=18, z=-21], Pos[x=-34, y=18, z=-21]], [Pos[x=-36, y=19, z=-22], Pos[x=-35, y=19, z=-22], Pos[x=-34, y=19, z=-22]], [Pos[x=-36, y=20, z=-23], Pos[x=-35, y=20, z=-23], Pos[x=-34, y=20, z=-23]]]] +StairFlight[id=keep-16-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=21, z=-23], Pos[x=-30, y=21, z=-23], Pos[x=-29, y=21, z=-23]], [Pos[x=-31, y=22, z=-22], Pos[x=-30, y=22, z=-22], Pos[x=-29, y=22, z=-22]], [Pos[x=-31, y=23, z=-21], Pos[x=-30, y=23, z=-21], Pos[x=-29, y=23, z=-21]], [Pos[x=-31, y=24, z=-20], Pos[x=-30, y=24, z=-20], Pos[x=-29, y=24, z=-20]]]] +StairFlight[id=residence-0-out, moduleId=residence, facing=NORTH, treads=[[Pos[x=26, y=1, z=-20], Pos[x=27, y=1, z=-20], Pos[x=28, y=1, z=-20]], [Pos[x=26, y=2, z=-21], Pos[x=27, y=2, z=-21], Pos[x=28, y=2, z=-21]], [Pos[x=26, y=3, z=-22], Pos[x=27, y=3, z=-22], Pos[x=28, y=3, z=-22]], [Pos[x=26, y=4, z=-23], Pos[x=27, y=4, z=-23], Pos[x=28, y=4, z=-23]]]] +StairFlight[id=residence-0-back, moduleId=residence, facing=SOUTH, treads=[[Pos[x=31, y=5, z=-23], Pos[x=32, y=5, z=-23], Pos[x=33, y=5, z=-23]], [Pos[x=31, y=6, z=-22], Pos[x=32, y=6, z=-22], Pos[x=33, y=6, z=-22]], [Pos[x=31, y=7, z=-21], Pos[x=32, y=7, z=-21], Pos[x=33, y=7, z=-21]], [Pos[x=31, y=8, z=-20], Pos[x=32, y=8, z=-20], Pos[x=33, y=8, z=-20]]]] +StairFlight[id=residence-8-out, moduleId=residence, facing=NORTH, treads=[[Pos[x=26, y=9, z=-20], Pos[x=27, y=9, z=-20], Pos[x=28, y=9, z=-20]], [Pos[x=26, y=10, z=-21], Pos[x=27, y=10, z=-21], Pos[x=28, y=10, z=-21]], [Pos[x=26, y=11, z=-22], Pos[x=27, y=11, z=-22], Pos[x=28, y=11, z=-22]], [Pos[x=26, y=12, z=-23], Pos[x=27, y=12, z=-23], Pos[x=28, y=12, z=-23]]]] +StairFlight[id=residence-8-back, moduleId=residence, facing=SOUTH, treads=[[Pos[x=31, y=13, z=-23], Pos[x=32, y=13, z=-23], Pos[x=33, y=13, z=-23]], [Pos[x=31, y=14, z=-22], Pos[x=32, y=14, z=-22], Pos[x=33, y=14, z=-22]], [Pos[x=31, y=15, z=-21], Pos[x=32, y=15, z=-21], Pos[x=33, y=15, z=-21]], [Pos[x=31, y=16, z=-20], Pos[x=32, y=16, z=-20], Pos[x=33, y=16, z=-20]]]] +StairFlight[id=service-0-out, moduleId=service, facing=NORTH, treads=[[Pos[x=-36, y=1, z=4], Pos[x=-35, y=1, z=4], Pos[x=-34, y=1, z=4]], [Pos[x=-36, y=2, z=3], Pos[x=-35, y=2, z=3], Pos[x=-34, y=2, z=3]], [Pos[x=-36, y=3, z=2], Pos[x=-35, y=3, z=2], Pos[x=-34, y=3, z=2]], [Pos[x=-36, y=4, z=1], Pos[x=-35, y=4, z=1], Pos[x=-34, y=4, z=1]]]] +StairFlight[id=service-0-back, moduleId=service, facing=SOUTH, treads=[[Pos[x=-31, y=5, z=1], Pos[x=-30, y=5, z=1], Pos[x=-29, y=5, z=1]], [Pos[x=-31, y=6, z=2], Pos[x=-30, y=6, z=2], Pos[x=-29, y=6, z=2]], [Pos[x=-31, y=7, z=3], Pos[x=-30, y=7, z=3], Pos[x=-29, y=7, z=3]], [Pos[x=-31, y=8, z=4], Pos[x=-30, y=8, z=4], Pos[x=-29, y=8, z=4]]]] +StairFlight[id=gate-0-out, moduleId=gate, facing=NORTH, treads=[[Pos[x=-10, y=1, z=36], Pos[x=-9, y=1, z=36], Pos[x=-8, y=1, z=36]], [Pos[x=-10, y=2, z=35], Pos[x=-9, y=2, z=35], Pos[x=-8, y=2, z=35]], [Pos[x=-10, y=3, z=34], Pos[x=-9, y=3, z=34], Pos[x=-8, y=3, z=34]], [Pos[x=-10, y=4, z=33], Pos[x=-9, y=4, z=33], Pos[x=-8, y=4, z=33]]]] +StairFlight[id=gate-0-back, moduleId=gate, facing=SOUTH, treads=[[Pos[x=-5, y=5, z=33], Pos[x=-4, y=5, z=33], Pos[x=-3, y=5, z=33]], [Pos[x=-5, y=6, z=34], Pos[x=-4, y=6, z=34], Pos[x=-3, y=6, z=34]], [Pos[x=-5, y=7, z=35], Pos[x=-4, y=7, z=35], Pos[x=-3, y=7, z=35]], [Pos[x=-5, y=8, z=36], Pos[x=-4, y=8, z=36], Pos[x=-3, y=8, z=36]]]] diff --git a/docs/evidence/reference-v1/northwest.png b/docs/evidence/reference-v1/northwest.png new file mode 100644 index 0000000..b9658cd Binary files /dev/null and b/docs/evidence/reference-v1/northwest.png differ diff --git a/docs/evidence/reference-v1/southeast.png b/docs/evidence/reference-v1/southeast.png new file mode 100644 index 0000000..c0822a5 Binary files /dev/null and b/docs/evidence/reference-v1/southeast.png differ diff --git a/docs/evidence/reference-v1/stair-section.png b/docs/evidence/reference-v1/stair-section.png new file mode 100644 index 0000000..b2fe27e Binary files /dev/null and b/docs/evidence/reference-v1/stair-section.png differ diff --git a/docs/evidence/reference-v2/gate.png b/docs/evidence/reference-v2/gate.png new file mode 100644 index 0000000..3346a6e Binary files /dev/null and b/docs/evidence/reference-v2/gate.png differ diff --git a/docs/evidence/reference-v2/ground-plan.png b/docs/evidence/reference-v2/ground-plan.png new file mode 100644 index 0000000..eb4669c Binary files /dev/null and b/docs/evidence/reference-v2/ground-plan.png differ diff --git a/docs/evidence/reference-v2/hall-furniture.png b/docs/evidence/reference-v2/hall-furniture.png new file mode 100644 index 0000000..ec5b6eb Binary files /dev/null and b/docs/evidence/reference-v2/hall-furniture.png differ diff --git a/docs/evidence/reference-v2/hall-section.png b/docs/evidence/reference-v2/hall-section.png new file mode 100644 index 0000000..de4f572 Binary files /dev/null and b/docs/evidence/reference-v2/hall-section.png differ diff --git a/docs/evidence/reference-v2/model.txt b/docs/evidence/reference-v2/model.txt new file mode 100644 index 0000000..c2da7e6 --- /dev/null +++ b/docs/evidence/reference-v2/model.txt @@ -0,0 +1,123 @@ +Actual generated architecture, canonical local coordinates +variant=falkenwacht-v2-study +seed=20261020 origin=0,0 ground=64 rotation=3 +planMillis=321 (one cold invocation; not a benchmark) +blocks.tsv.sha256=b386fb67d8792062e7584e9d235cf0e7df985fe7a5969917d2b8a998eeae8252 +15 modules, 23 rooms (23 reachable), 14 stair flights, 72 windows; 89387 planned cells, 15371 protected route cells + +Modules +Module[id=keep, type=KEEP, bounds=Box[minX=-39, minY=0, minZ=-30, maxX=-21, maxY=32, maxZ=-12], floors=[0, 8, 16, 24], roof=HIP, chamfer=3] +Module[id=hall, type=GREAT_HALL, bounds=Box[minX=-20, minY=0, minZ=-30, maxX=17, maxY=14, maxZ=-11], floors=[0], roof=GABLE_X, chamfer=0] +Module[id=residence, type=RESIDENCE, bounds=Box[minX=18, minY=0, minZ=-30, maxX=36, maxY=22, maxZ=3], floors=[0, 8, 16], roof=GABLE_Z, chamfer=0] +Module[id=kitchen, type=SERVICE_WING, bounds=Box[minX=18, minY=0, minZ=4, maxX=36, maxY=10, maxZ=19], floors=[0], roof=HIP, chamfer=0] +Module[id=service, type=SERVICE_WING, bounds=Box[minX=-39, minY=0, minZ=-11, maxX=-21, maxY=16, maxZ=12], floors=[0, 8], roof=GABLE_Z, chamfer=0] +Module[id=gate, type=GATEHOUSE, bounds=Box[minX=-11, minY=0, minZ=28, maxX=11, maxY=19, maxZ=40], floors=[0, 8], roof=HIP, chamfer=0] +Module[id=northwest, type=CORNER_TOWER, bounds=Box[minX=-49, minY=0, minZ=-40, maxX=-40, maxY=13, maxZ=-31], floors=[0], roof=HIP, chamfer=2] +Module[id=northeast, type=CORNER_TOWER, bounds=Box[minX=40, minY=0, minZ=-40, maxX=49, maxY=17, maxZ=-31], floors=[0], roof=HIP, chamfer=2] +Module[id=southwest, type=CORNER_TOWER, bounds=Box[minX=-49, minY=0, minZ=30, maxX=-40, maxY=10, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=2] +Module[id=southeast, type=CORNER_TOWER, bounds=Box[minX=40, minY=0, minZ=30, maxX=49, maxY=14, maxZ=40], floors=[0], roof=HIP, chamfer=2] +Module[id=northwall, type=CURTAIN, bounds=Box[minX=-39, minY=0, minZ=-40, maxX=39, maxY=6, maxZ=-38], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=westwall, type=CURTAIN, bounds=Box[minX=-49, minY=0, minZ=-30, maxX=-47, maxY=6, maxZ=29], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=eastwall, type=CURTAIN, bounds=Box[minX=47, minY=0, minZ=-30, maxX=49, maxY=6, maxZ=29], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=southwall-west, type=CURTAIN, bounds=Box[minX=-39, minY=0, minZ=38, maxX=-12, maxY=6, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=southwall-east, type=CURTAIN, bounds=Box[minX=12, minY=0, minZ=38, maxX=39, maxY=6, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=0] + +Rooms +Room[id=keep-0, moduleId=keep, type=STAIR_HALL, interior=Box[minX=-37, minY=1, minZ=-28, maxX=-23, maxY=6, maxZ=-14], floorY=0, target=Pos[x=-24, y=1, z=-15]] +Room[id=keep-8, moduleId=keep, type=LIBRARY, interior=Box[minX=-37, minY=9, minZ=-28, maxX=-23, maxY=14, maxZ=-14], floorY=8, target=Pos[x=-24, y=9, z=-15]] +Room[id=keep-16, moduleId=keep, type=BEDCHAMBER, interior=Box[minX=-37, minY=17, minZ=-28, maxX=-23, maxY=22, maxZ=-14], floorY=16, target=Pos[x=-24, y=17, z=-15]] +Room[id=keep-24, moduleId=keep, type=SOLAR, interior=Box[minX=-37, minY=25, minZ=-28, maxX=-23, maxY=30, maxZ=-14], floorY=24, target=Pos[x=-24, y=25, z=-15]] +Room[id=great-hall, moduleId=hall, type=GREAT_HALL, interior=Box[minX=-19, minY=1, minZ=-29, maxX=16, maxY=6, maxZ=-12], floorY=0, target=Pos[x=0, y=1, z=-15]] +Room[id=residence-0, moduleId=residence, type=STAIR_HALL, interior=Box[minX=19, minY=1, minZ=-29, maxX=35, maxY=6, maxZ=-14], floorY=0, target=Pos[x=22, y=1, z=-15]] +Room[id=chamber-0, moduleId=residence, type=GUARDROOM, interior=Box[minX=26, minY=1, minZ=-12, maxX=35, maxY=6, maxZ=-5], floorY=0, target=Pos[x=28, y=1, z=-8]] +Room[id=study-0, moduleId=residence, type=STORE, interior=Box[minX=26, minY=1, minZ=-3, maxX=35, maxY=6, maxZ=2], floorY=0, target=Pos[x=28, y=1, z=0]] +Room[id=residence-8, moduleId=residence, type=STAIR_HALL, interior=Box[minX=19, minY=9, minZ=-29, maxX=35, maxY=14, maxZ=-14], floorY=8, target=Pos[x=22, y=9, z=-15]] +Room[id=chamber-8, moduleId=residence, type=BEDCHAMBER, interior=Box[minX=26, minY=9, minZ=-12, maxX=35, maxY=14, maxZ=-5], floorY=8, target=Pos[x=28, y=9, z=-8]] +Room[id=study-8, moduleId=residence, type=SOLAR, interior=Box[minX=26, minY=9, minZ=-3, maxX=35, maxY=14, maxZ=2], floorY=8, target=Pos[x=28, y=9, z=0]] +Room[id=residence-16, moduleId=residence, type=STAIR_HALL, interior=Box[minX=19, minY=17, minZ=-29, maxX=35, maxY=21, maxZ=-14], floorY=16, target=Pos[x=22, y=17, z=-15]] +Room[id=chamber-16, moduleId=residence, type=LIBRARY, interior=Box[minX=26, minY=17, minZ=-12, maxX=35, maxY=21, maxZ=-5], floorY=16, target=Pos[x=28, y=17, z=-8]] +Room[id=study-16, moduleId=residence, type=SOLAR, interior=Box[minX=26, minY=17, minZ=-3, maxX=35, maxY=21, maxZ=2], floorY=16, target=Pos[x=28, y=17, z=0]] +Room[id=kitchen-room, moduleId=kitchen, type=KITCHEN, interior=Box[minX=19, minY=1, minZ=5, maxX=35, maxY=6, maxZ=18], floorY=0, target=Pos[x=22, y=1, z=10]] +Room[id=service-0, moduleId=service, type=STORE, interior=Box[minX=-38, minY=1, minZ=-10, maxX=-22, maxY=6, maxZ=11], floorY=0, target=Pos[x=-25, y=1, z=8]] +Room[id=service-8, moduleId=service, type=LIBRARY, interior=Box[minX=-38, minY=9, minZ=-10, maxX=-22, maxY=14, maxZ=11], floorY=8, target=Pos[x=-25, y=9, z=8]] +Room[id=gate-guard, moduleId=gate, type=GUARDROOM, interior=Box[minX=-10, minY=1, minZ=29, maxX=10, maxY=6, maxZ=39], floorY=0, target=Pos[x=5, y=1, z=38]] +Room[id=gate-watch, moduleId=gate, type=GUARDROOM, interior=Box[minX=-10, minY=9, minZ=29, maxX=10, maxY=14, maxZ=39], floorY=8, target=Pos[x=5, y=9, z=38]] +Room[id=northwest-guard, moduleId=northwest, type=GUARDROOM, interior=Box[minX=-47, minY=1, minZ=-38, maxX=-42, maxY=6, maxZ=-33], floorY=0, target=Pos[x=-44, y=1, z=-35]] +Room[id=northeast-guard, moduleId=northeast, type=GUARDROOM, interior=Box[minX=42, minY=1, minZ=-38, maxX=47, maxY=6, maxZ=-33], floorY=0, target=Pos[x=44, y=1, z=-35]] +Room[id=southwest-guard, moduleId=southwest, type=GUARDROOM, interior=Box[minX=-47, minY=1, minZ=32, maxX=-42, maxY=6, maxZ=38], floorY=0, target=Pos[x=-44, y=1, z=35]] +Room[id=southeast-guard, moduleId=southeast, type=GUARDROOM, interior=Box[minX=42, minY=1, minZ=32, maxX=47, maxY=6, maxZ=38], floorY=0, target=Pos[x=44, y=1, z=35]] + +Connections +Connection[id=court-hall, from=courtyard, to=hall, aperture=Box[minX=-1, minY=1, minZ=-11, maxX=1, maxY=3, maxZ=-11]] +Connection[id=hall-keep, from=hall, to=keep, aperture=Box[minX=-21, minY=1, minZ=-17, maxX=-20, maxY=3, maxZ=-15]] +Connection[id=hall-residence, from=hall, to=residence, aperture=Box[minX=17, minY=1, minZ=-17, maxX=18, maxY=3, maxZ=-15]] +Connection[id=keep-service, from=keep, to=service, aperture=Box[minX=-26, minY=1, minZ=-12, maxX=-24, maxY=3, maxZ=-11]] +Connection[id=court-service, from=courtyard, to=service, aperture=Box[minX=-21, minY=1, minZ=7, maxX=-21, maxY=3, maxZ=9]] +Connection[id=residence-kitchen, from=residence, to=kitchen, aperture=Box[minX=21, minY=1, minZ=3, maxX=23, maxY=3, maxZ=4]] +Connection[id=court-kitchen, from=courtyard, to=kitchen, aperture=Box[minX=18, minY=1, minZ=9, maxX=18, maxY=3, maxZ=11]] +Connection[id=court-gate, from=courtyard, to=gate, aperture=Box[minX=-2, minY=1, minZ=28, maxX=2, maxY=5, maxZ=28]] +Connection[id=gate-outside, from=gate, to=outside, aperture=Box[minX=-2, minY=1, minZ=40, maxX=2, maxY=5, maxZ=40]] +Connection[id=court-northwest, from=courtyard, to=northwest, aperture=Box[minX=-45, minY=1, minZ=-31, maxX=-43, maxY=3, maxZ=-31]] +Connection[id=court-northeast, from=courtyard, to=northeast, aperture=Box[minX=43, minY=1, minZ=-31, maxX=45, maxY=3, maxZ=-31]] +Connection[id=court-southwest, from=courtyard, to=southwest, aperture=Box[minX=-45, minY=1, minZ=30, maxX=-43, maxY=3, maxZ=30]] +Connection[id=court-southeast, from=courtyard, to=southeast, aperture=Box[minX=43, minY=1, minZ=30, maxX=45, maxY=3, maxZ=30]] + +Stair flights +StairFlight[id=keep-0-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=1, z=-20], Pos[x=-35, y=1, z=-20], Pos[x=-34, y=1, z=-20]], [Pos[x=-36, y=2, z=-21], Pos[x=-35, y=2, z=-21], Pos[x=-34, y=2, z=-21]], [Pos[x=-36, y=3, z=-22], Pos[x=-35, y=3, z=-22], Pos[x=-34, y=3, z=-22]], [Pos[x=-36, y=4, z=-23], Pos[x=-35, y=4, z=-23], Pos[x=-34, y=4, z=-23]]]] +StairFlight[id=keep-0-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=5, z=-23], Pos[x=-30, y=5, z=-23], Pos[x=-29, y=5, z=-23]], [Pos[x=-31, y=6, z=-22], Pos[x=-30, y=6, z=-22], Pos[x=-29, y=6, z=-22]], [Pos[x=-31, y=7, z=-21], Pos[x=-30, y=7, z=-21], Pos[x=-29, y=7, z=-21]], [Pos[x=-31, y=8, z=-20], Pos[x=-30, y=8, z=-20], Pos[x=-29, y=8, z=-20]]]] +StairFlight[id=keep-8-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=9, z=-20], Pos[x=-35, y=9, z=-20], Pos[x=-34, y=9, z=-20]], [Pos[x=-36, y=10, z=-21], Pos[x=-35, y=10, z=-21], Pos[x=-34, y=10, z=-21]], [Pos[x=-36, y=11, z=-22], Pos[x=-35, y=11, z=-22], Pos[x=-34, y=11, z=-22]], [Pos[x=-36, y=12, z=-23], Pos[x=-35, y=12, z=-23], Pos[x=-34, y=12, z=-23]]]] +StairFlight[id=keep-8-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=13, z=-23], Pos[x=-30, y=13, z=-23], Pos[x=-29, y=13, z=-23]], [Pos[x=-31, y=14, z=-22], Pos[x=-30, y=14, z=-22], Pos[x=-29, y=14, z=-22]], [Pos[x=-31, y=15, z=-21], Pos[x=-30, y=15, z=-21], Pos[x=-29, y=15, z=-21]], [Pos[x=-31, y=16, z=-20], Pos[x=-30, y=16, z=-20], Pos[x=-29, y=16, z=-20]]]] +StairFlight[id=keep-16-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=17, z=-20], Pos[x=-35, y=17, z=-20], Pos[x=-34, y=17, z=-20]], [Pos[x=-36, y=18, z=-21], Pos[x=-35, y=18, z=-21], Pos[x=-34, y=18, z=-21]], [Pos[x=-36, y=19, z=-22], Pos[x=-35, y=19, z=-22], Pos[x=-34, y=19, z=-22]], [Pos[x=-36, y=20, z=-23], Pos[x=-35, y=20, z=-23], Pos[x=-34, y=20, z=-23]]]] +StairFlight[id=keep-16-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=21, z=-23], Pos[x=-30, y=21, z=-23], Pos[x=-29, y=21, z=-23]], [Pos[x=-31, y=22, z=-22], Pos[x=-30, y=22, z=-22], Pos[x=-29, y=22, z=-22]], [Pos[x=-31, y=23, z=-21], Pos[x=-30, y=23, z=-21], Pos[x=-29, y=23, z=-21]], [Pos[x=-31, y=24, z=-20], Pos[x=-30, y=24, z=-20], Pos[x=-29, y=24, z=-20]]]] +StairFlight[id=residence-0-out, moduleId=residence, facing=NORTH, treads=[[Pos[x=26, y=1, z=-20], Pos[x=27, y=1, z=-20], Pos[x=28, y=1, z=-20]], [Pos[x=26, y=2, z=-21], Pos[x=27, y=2, z=-21], Pos[x=28, y=2, z=-21]], [Pos[x=26, y=3, z=-22], Pos[x=27, y=3, z=-22], Pos[x=28, y=3, z=-22]], [Pos[x=26, y=4, z=-23], Pos[x=27, y=4, z=-23], Pos[x=28, y=4, z=-23]]]] +StairFlight[id=residence-0-back, moduleId=residence, facing=SOUTH, treads=[[Pos[x=31, y=5, z=-23], Pos[x=32, y=5, z=-23], Pos[x=33, y=5, z=-23]], [Pos[x=31, y=6, z=-22], Pos[x=32, y=6, z=-22], Pos[x=33, y=6, z=-22]], [Pos[x=31, y=7, z=-21], Pos[x=32, y=7, z=-21], Pos[x=33, y=7, z=-21]], [Pos[x=31, y=8, z=-20], Pos[x=32, y=8, z=-20], Pos[x=33, y=8, z=-20]]]] +StairFlight[id=residence-8-out, moduleId=residence, facing=NORTH, treads=[[Pos[x=26, y=9, z=-20], Pos[x=27, y=9, z=-20], Pos[x=28, y=9, z=-20]], [Pos[x=26, y=10, z=-21], Pos[x=27, y=10, z=-21], Pos[x=28, y=10, z=-21]], [Pos[x=26, y=11, z=-22], Pos[x=27, y=11, z=-22], Pos[x=28, y=11, z=-22]], [Pos[x=26, y=12, z=-23], Pos[x=27, y=12, z=-23], Pos[x=28, y=12, z=-23]]]] +StairFlight[id=residence-8-back, moduleId=residence, facing=SOUTH, treads=[[Pos[x=31, y=13, z=-23], Pos[x=32, y=13, z=-23], Pos[x=33, y=13, z=-23]], [Pos[x=31, y=14, z=-22], Pos[x=32, y=14, z=-22], Pos[x=33, y=14, z=-22]], [Pos[x=31, y=15, z=-21], Pos[x=32, y=15, z=-21], Pos[x=33, y=15, z=-21]], [Pos[x=31, y=16, z=-20], Pos[x=32, y=16, z=-20], Pos[x=33, y=16, z=-20]]]] +StairFlight[id=service-0-out, moduleId=service, facing=NORTH, treads=[[Pos[x=-36, y=1, z=4], Pos[x=-35, y=1, z=4], Pos[x=-34, y=1, z=4]], [Pos[x=-36, y=2, z=3], Pos[x=-35, y=2, z=3], Pos[x=-34, y=2, z=3]], [Pos[x=-36, y=3, z=2], Pos[x=-35, y=3, z=2], Pos[x=-34, y=3, z=2]], [Pos[x=-36, y=4, z=1], Pos[x=-35, y=4, z=1], Pos[x=-34, y=4, z=1]]]] +StairFlight[id=service-0-back, moduleId=service, facing=SOUTH, treads=[[Pos[x=-31, y=5, z=1], Pos[x=-30, y=5, z=1], Pos[x=-29, y=5, z=1]], [Pos[x=-31, y=6, z=2], Pos[x=-30, y=6, z=2], Pos[x=-29, y=6, z=2]], [Pos[x=-31, y=7, z=3], Pos[x=-30, y=7, z=3], Pos[x=-29, y=7, z=3]], [Pos[x=-31, y=8, z=4], Pos[x=-30, y=8, z=4], Pos[x=-29, y=8, z=4]]]] +StairFlight[id=gate-0-out, moduleId=gate, facing=NORTH, treads=[[Pos[x=-10, y=1, z=36], Pos[x=-9, y=1, z=36], Pos[x=-8, y=1, z=36]], [Pos[x=-10, y=2, z=35], Pos[x=-9, y=2, z=35], Pos[x=-8, y=2, z=35]], [Pos[x=-10, y=3, z=34], Pos[x=-9, y=3, z=34], Pos[x=-8, y=3, z=34]], [Pos[x=-10, y=4, z=33], Pos[x=-9, y=4, z=33], Pos[x=-8, y=4, z=33]]]] +StairFlight[id=gate-0-back, moduleId=gate, facing=SOUTH, treads=[[Pos[x=-5, y=5, z=33], Pos[x=-4, y=5, z=33], Pos[x=-3, y=5, z=33]], [Pos[x=-5, y=6, z=34], Pos[x=-4, y=6, z=34], Pos[x=-3, y=6, z=34]], [Pos[x=-5, y=7, z=35], Pos[x=-4, y=7, z=35], Pos[x=-3, y=7, z=35]], [Pos[x=-5, y=8, z=36], Pos[x=-4, y=8, z=36], Pos[x=-3, y=8, z=36]]]] + +Partitions +Partition[id=residence-cross-0, moduleId=residence, wall=Box[minX=19, minY=1, minZ=-13, maxX=35, maxY=7, maxZ=-13], portals=[Box[minX=21, minY=1, minZ=-13, maxX=23, maxY=3, maxZ=-13]]] +Partition[id=residence-spine-0, moduleId=residence, wall=Box[minX=25, minY=1, minZ=-12, maxX=25, maxY=7, maxZ=2], portals=[Box[minX=25, minY=1, minZ=-9, maxX=25, maxY=3, maxZ=-7], Box[minX=25, minY=1, minZ=-1, maxX=25, maxY=3, maxZ=1]]] +Partition[id=residence-divider-0, moduleId=residence, wall=Box[minX=26, minY=1, minZ=-4, maxX=35, maxY=7, maxZ=-4], portals=[]] +Partition[id=residence-cross-8, moduleId=residence, wall=Box[minX=19, minY=9, minZ=-13, maxX=35, maxY=15, maxZ=-13], portals=[Box[minX=21, minY=9, minZ=-13, maxX=23, maxY=11, maxZ=-13]]] +Partition[id=residence-spine-8, moduleId=residence, wall=Box[minX=25, minY=9, minZ=-12, maxX=25, maxY=15, maxZ=2], portals=[Box[minX=25, minY=9, minZ=-9, maxX=25, maxY=11, maxZ=-7], Box[minX=25, minY=9, minZ=-1, maxX=25, maxY=11, maxZ=1]]] +Partition[id=residence-divider-8, moduleId=residence, wall=Box[minX=26, minY=9, minZ=-4, maxX=35, maxY=15, maxZ=-4], portals=[]] +Partition[id=residence-cross-16, moduleId=residence, wall=Box[minX=19, minY=17, minZ=-13, maxX=35, maxY=21, maxZ=-13], portals=[Box[minX=21, minY=17, minZ=-13, maxX=23, maxY=19, maxZ=-13]]] +Partition[id=residence-spine-16, moduleId=residence, wall=Box[minX=25, minY=17, minZ=-12, maxX=25, maxY=21, maxZ=2], portals=[Box[minX=25, minY=17, minZ=-9, maxX=25, maxY=19, maxZ=-7], Box[minX=25, minY=17, minZ=-1, maxX=25, maxY=19, maxZ=1]]] +Partition[id=residence-divider-16, moduleId=residence, wall=Box[minX=26, minY=17, minZ=-4, maxX=35, maxY=21, maxZ=-4], portals=[]] + +Facade bays +FacadeBay[id=hall-bay-0, window=Window[moduleId=hall, opening=Box[minX=-16, minY=4, minZ=-30, maxX=-14, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=-17, minY=3, minZ=-31, maxX=-13, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-1, window=Window[moduleId=hall, opening=Box[minX=-10, minY=4, minZ=-30, maxX=-8, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=-11, minY=3, minZ=-31, maxX=-7, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-2, window=Window[moduleId=hall, opening=Box[minX=-4, minY=4, minZ=-30, maxX=-2, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=-5, minY=3, minZ=-31, maxX=-1, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-3, window=Window[moduleId=hall, opening=Box[minX=2, minY=4, minZ=-30, maxX=4, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=1, minY=3, minZ=-31, maxX=5, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-4, window=Window[moduleId=hall, opening=Box[minX=8, minY=4, minZ=-30, maxX=10, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=7, minY=3, minZ=-31, maxX=11, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-5, window=Window[moduleId=hall, opening=Box[minX=14, minY=4, minZ=-30, maxX=16, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=13, minY=3, minZ=-31, maxX=17, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-6, window=Window[moduleId=hall, opening=Box[minX=-16, minY=4, minZ=-11, maxX=-14, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=-17, minY=3, minZ=-11, maxX=-13, maxY=10, maxZ=-10]] +FacadeBay[id=hall-bay-7, window=Window[moduleId=hall, opening=Box[minX=-10, minY=4, minZ=-11, maxX=-8, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=-11, minY=3, minZ=-11, maxX=-7, maxY=10, maxZ=-10]] +FacadeBay[id=hall-bay-8, window=Window[moduleId=hall, opening=Box[minX=8, minY=4, minZ=-11, maxX=10, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=7, minY=3, minZ=-11, maxX=11, maxY=10, maxZ=-10]] +FacadeBay[id=hall-bay-9, window=Window[moduleId=hall, opening=Box[minX=14, minY=4, minZ=-11, maxX=16, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=13, minY=3, minZ=-11, maxX=17, maxY=10, maxZ=-10]] +FacadeBay[id=residence-bay-10, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-26, maxX=36, maxY=5, maxZ=-24], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-27, maxX=37, maxY=7, maxZ=-23]] +FacadeBay[id=residence-bay-11, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-20, maxX=36, maxY=5, maxZ=-18], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-21, maxX=37, maxY=7, maxZ=-17]] +FacadeBay[id=residence-bay-12, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-9, maxX=36, maxY=5, maxZ=-7], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-10, maxX=37, maxY=7, maxZ=-6]] +FacadeBay[id=residence-bay-13, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-1, maxX=36, maxY=5, maxZ=1], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-2, maxX=37, maxY=7, maxZ=2]] +FacadeBay[id=residence-bay-14, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-26, maxX=36, maxY=13, maxZ=-24], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-27, maxX=37, maxY=15, maxZ=-23]] +FacadeBay[id=residence-bay-15, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-20, maxX=36, maxY=13, maxZ=-18], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-21, maxX=37, maxY=15, maxZ=-17]] +FacadeBay[id=residence-bay-16, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-9, maxX=36, maxY=13, maxZ=-7], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-10, maxX=37, maxY=15, maxZ=-6]] +FacadeBay[id=residence-bay-17, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-1, maxX=36, maxY=13, maxZ=1], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-2, maxX=37, maxY=15, maxZ=2]] +FacadeBay[id=residence-bay-18, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-26, maxX=36, maxY=21, maxZ=-24], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-27, maxX=37, maxY=23, maxZ=-23]] +FacadeBay[id=residence-bay-19, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-20, maxX=36, maxY=21, maxZ=-18], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-21, maxX=37, maxY=23, maxZ=-17]] +FacadeBay[id=residence-bay-20, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-9, maxX=36, maxY=21, maxZ=-7], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-10, maxX=37, maxY=23, maxZ=-6]] +FacadeBay[id=residence-bay-21, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-1, maxX=36, maxY=21, maxZ=1], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-2, maxX=37, maxY=23, maxZ=2]] + +Court uses +CourtFeature[id=well, use=COVERED_WELL, bounds=Box[minX=-10, minY=0, minZ=3, maxX=-4, maxY=7, maxZ=9]] +CourtFeature[id=herbs, use=HERB_GARDEN, bounds=Box[minX=-35, minY=0, minZ=20, maxX=-25, maxY=2, maxZ=28]] +CourtFeature[id=arbor, use=SEATING_ARBOR, bounds=Box[minX=25, minY=0, minZ=23, maxX=35, maxY=6, maxZ=28]] + +Roof lights +Dormer[id=residence-roof-north, moduleId=residence, frontX=36, centerZ=-23, baseY=25] +Dormer[id=residence-roof-south, moduleId=residence, frontX=36, centerZ=-5, baseY=25] diff --git a/docs/evidence/reference-v2/northwest.png b/docs/evidence/reference-v2/northwest.png new file mode 100644 index 0000000..827cb82 Binary files /dev/null and b/docs/evidence/reference-v2/northwest.png differ diff --git a/docs/evidence/reference-v2/residence-facade.png b/docs/evidence/reference-v2/residence-facade.png new file mode 100644 index 0000000..b18a99f Binary files /dev/null and b/docs/evidence/reference-v2/residence-facade.png differ diff --git a/docs/evidence/reference-v2/residence-plan.png b/docs/evidence/reference-v2/residence-plan.png new file mode 100644 index 0000000..9392e50 Binary files /dev/null and b/docs/evidence/reference-v2/residence-plan.png differ diff --git a/docs/evidence/reference-v2/southeast.png b/docs/evidence/reference-v2/southeast.png new file mode 100644 index 0000000..817f938 Binary files /dev/null and b/docs/evidence/reference-v2/southeast.png differ diff --git a/docs/evidence/reference-v2/stair-section.png b/docs/evidence/reference-v2/stair-section.png new file mode 100644 index 0000000..341e340 Binary files /dev/null and b/docs/evidence/reference-v2/stair-section.png differ diff --git a/docs/evidence/reference-v3/court-stair.png b/docs/evidence/reference-v3/court-stair.png new file mode 100644 index 0000000..d2e378c Binary files /dev/null and b/docs/evidence/reference-v3/court-stair.png differ diff --git a/docs/evidence/reference-v3/gate-link.png b/docs/evidence/reference-v3/gate-link.png new file mode 100644 index 0000000..c027bd1 Binary files /dev/null and b/docs/evidence/reference-v3/gate-link.png differ diff --git a/docs/evidence/reference-v3/gate.png b/docs/evidence/reference-v3/gate.png new file mode 100644 index 0000000..57aac12 Binary files /dev/null and b/docs/evidence/reference-v3/gate.png differ diff --git a/docs/evidence/reference-v3/ground-plan.png b/docs/evidence/reference-v3/ground-plan.png new file mode 100644 index 0000000..80457c0 Binary files /dev/null and b/docs/evidence/reference-v3/ground-plan.png differ diff --git a/docs/evidence/reference-v3/hall-furniture.png b/docs/evidence/reference-v3/hall-furniture.png new file mode 100644 index 0000000..41011a7 Binary files /dev/null and b/docs/evidence/reference-v3/hall-furniture.png differ diff --git a/docs/evidence/reference-v3/hall-section.png b/docs/evidence/reference-v3/hall-section.png new file mode 100644 index 0000000..1dc3a0b Binary files /dev/null and b/docs/evidence/reference-v3/hall-section.png differ diff --git a/docs/evidence/reference-v3/model.txt b/docs/evidence/reference-v3/model.txt new file mode 100644 index 0000000..8908774 --- /dev/null +++ b/docs/evidence/reference-v3/model.txt @@ -0,0 +1,140 @@ +Actual generated architecture, canonical local coordinates +variant=falkenwacht-v3-wallwalk +seed=20261020 origin=0,0 ground=64 rotation=3 +planMillis=351 (one cold invocation; not a benchmark) +blocks.tsv.sha256=95a8968c6a41b3bc2dabb673af8ce01c8ea3bdaddacbc31a4f3675e8b2983e4d +16 modules, 23 rooms (23 reachable), 17 stair flights, 72 windows; 94024 planned cells, 18299 protected route cells + +Modules +Module[id=keep, type=KEEP, bounds=Box[minX=-39, minY=0, minZ=-30, maxX=-21, maxY=32, maxZ=-12], floors=[0, 8, 16, 24], roof=HIP, chamfer=3] +Module[id=hall, type=GREAT_HALL, bounds=Box[minX=-20, minY=0, minZ=-30, maxX=17, maxY=14, maxZ=-11], floors=[0], roof=GABLE_X, chamfer=0] +Module[id=residence, type=RESIDENCE, bounds=Box[minX=18, minY=0, minZ=-30, maxX=36, maxY=22, maxZ=3], floors=[0, 8, 16], roof=GABLE_Z, chamfer=0] +Module[id=kitchen, type=SERVICE_WING, bounds=Box[minX=18, minY=0, minZ=4, maxX=36, maxY=10, maxZ=19], floors=[0], roof=HIP, chamfer=0] +Module[id=service, type=SERVICE_WING, bounds=Box[minX=-39, minY=0, minZ=-11, maxX=-21, maxY=16, maxZ=12], floors=[0, 8], roof=GABLE_Z, chamfer=0] +Module[id=gate, type=GATEHOUSE, bounds=Box[minX=-11, minY=0, minZ=28, maxX=11, maxY=19, maxZ=40], floors=[0, 8], roof=HIP, chamfer=0] +Module[id=northwest, type=CORNER_TOWER, bounds=Box[minX=-49, minY=0, minZ=-40, maxX=-40, maxY=13, maxZ=-31], floors=[0, 6], roof=HIP, chamfer=1] +Module[id=northeast, type=CORNER_TOWER, bounds=Box[minX=40, minY=0, minZ=-40, maxX=49, maxY=17, maxZ=-31], floors=[0, 6], roof=HIP, chamfer=1] +Module[id=southwest, type=CORNER_TOWER, bounds=Box[minX=-49, minY=0, minZ=30, maxX=-40, maxY=10, maxZ=40], floors=[0, 6], roof=BATTLEMENT, chamfer=1] +Module[id=southeast, type=CORNER_TOWER, bounds=Box[minX=40, minY=0, minZ=30, maxX=49, maxY=14, maxZ=40], floors=[0, 6], roof=HIP, chamfer=1] +Module[id=northwall, type=CURTAIN, bounds=Box[minX=-39, minY=0, minZ=-40, maxX=39, maxY=6, maxZ=-38], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=westwall, type=CURTAIN, bounds=Box[minX=-49, minY=0, minZ=-30, maxX=-47, maxY=6, maxZ=29], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=eastwall, type=CURTAIN, bounds=Box[minX=47, minY=0, minZ=-30, maxX=49, maxY=6, maxZ=29], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=southwall-west, type=CURTAIN, bounds=Box[minX=-39, minY=0, minZ=37, maxX=-12, maxY=12, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=southwall-east, type=CURTAIN, bounds=Box[minX=12, minY=0, minZ=37, maxX=39, maxY=12, maxZ=40], floors=[0], roof=BATTLEMENT, chamfer=0] +Module[id=wall-stair, type=WALL_STAIR, bounds=Box[minX=-45, minY=0, minZ=14, maxX=-41, maxY=10, maxZ=26], floors=[0, 6], roof=BATTLEMENT, chamfer=0] + +Rooms +Room[id=keep-0, moduleId=keep, type=STAIR_HALL, interior=Box[minX=-37, minY=1, minZ=-28, maxX=-23, maxY=6, maxZ=-14], floorY=0, target=Pos[x=-24, y=1, z=-15]] +Room[id=keep-8, moduleId=keep, type=LIBRARY, interior=Box[minX=-37, minY=9, minZ=-28, maxX=-23, maxY=14, maxZ=-14], floorY=8, target=Pos[x=-24, y=9, z=-15]] +Room[id=keep-16, moduleId=keep, type=BEDCHAMBER, interior=Box[minX=-37, minY=17, minZ=-28, maxX=-23, maxY=22, maxZ=-14], floorY=16, target=Pos[x=-24, y=17, z=-15]] +Room[id=keep-24, moduleId=keep, type=SOLAR, interior=Box[minX=-37, minY=25, minZ=-28, maxX=-23, maxY=30, maxZ=-14], floorY=24, target=Pos[x=-24, y=25, z=-15]] +Room[id=great-hall, moduleId=hall, type=GREAT_HALL, interior=Box[minX=-19, minY=1, minZ=-29, maxX=16, maxY=6, maxZ=-12], floorY=0, target=Pos[x=0, y=1, z=-15]] +Room[id=residence-0, moduleId=residence, type=STAIR_HALL, interior=Box[minX=19, minY=1, minZ=-29, maxX=35, maxY=6, maxZ=-14], floorY=0, target=Pos[x=22, y=1, z=-15]] +Room[id=chamber-0, moduleId=residence, type=GUARDROOM, interior=Box[minX=26, minY=1, minZ=-12, maxX=35, maxY=6, maxZ=-5], floorY=0, target=Pos[x=28, y=1, z=-8]] +Room[id=study-0, moduleId=residence, type=STORE, interior=Box[minX=26, minY=1, minZ=-3, maxX=35, maxY=6, maxZ=2], floorY=0, target=Pos[x=28, y=1, z=0]] +Room[id=residence-8, moduleId=residence, type=STAIR_HALL, interior=Box[minX=19, minY=9, minZ=-29, maxX=35, maxY=14, maxZ=-14], floorY=8, target=Pos[x=22, y=9, z=-15]] +Room[id=chamber-8, moduleId=residence, type=BEDCHAMBER, interior=Box[minX=26, minY=9, minZ=-12, maxX=35, maxY=14, maxZ=-5], floorY=8, target=Pos[x=28, y=9, z=-8]] +Room[id=study-8, moduleId=residence, type=SOLAR, interior=Box[minX=26, minY=9, minZ=-3, maxX=35, maxY=14, maxZ=2], floorY=8, target=Pos[x=28, y=9, z=0]] +Room[id=residence-16, moduleId=residence, type=STAIR_HALL, interior=Box[minX=19, minY=17, minZ=-29, maxX=35, maxY=21, maxZ=-14], floorY=16, target=Pos[x=22, y=17, z=-15]] +Room[id=chamber-16, moduleId=residence, type=LIBRARY, interior=Box[minX=26, minY=17, minZ=-12, maxX=35, maxY=21, maxZ=-5], floorY=16, target=Pos[x=28, y=17, z=-8]] +Room[id=study-16, moduleId=residence, type=SOLAR, interior=Box[minX=26, minY=17, minZ=-3, maxX=35, maxY=21, maxZ=2], floorY=16, target=Pos[x=28, y=17, z=0]] +Room[id=kitchen-room, moduleId=kitchen, type=KITCHEN, interior=Box[minX=19, minY=1, minZ=5, maxX=35, maxY=6, maxZ=18], floorY=0, target=Pos[x=22, y=1, z=10]] +Room[id=service-0, moduleId=service, type=STORE, interior=Box[minX=-38, minY=1, minZ=-10, maxX=-22, maxY=6, maxZ=11], floorY=0, target=Pos[x=-25, y=1, z=8]] +Room[id=service-8, moduleId=service, type=LIBRARY, interior=Box[minX=-38, minY=9, minZ=-10, maxX=-22, maxY=14, maxZ=11], floorY=8, target=Pos[x=-25, y=9, z=8]] +Room[id=gate-guard, moduleId=gate, type=GUARDROOM, interior=Box[minX=-10, minY=1, minZ=29, maxX=10, maxY=6, maxZ=39], floorY=0, target=Pos[x=5, y=1, z=38]] +Room[id=gate-watch, moduleId=gate, type=GUARDROOM, interior=Box[minX=-10, minY=9, minZ=29, maxX=10, maxY=14, maxZ=39], floorY=8, target=Pos[x=5, y=9, z=38]] +Room[id=northwest-guard, moduleId=northwest, type=GUARDROOM, interior=Box[minX=-47, minY=1, minZ=-38, maxX=-42, maxY=5, maxZ=-33], floorY=0, target=Pos[x=-44, y=1, z=-35]] +Room[id=northeast-guard, moduleId=northeast, type=GUARDROOM, interior=Box[minX=42, minY=1, minZ=-38, maxX=47, maxY=5, maxZ=-33], floorY=0, target=Pos[x=44, y=1, z=-35]] +Room[id=southwest-guard, moduleId=southwest, type=GUARDROOM, interior=Box[minX=-47, minY=1, minZ=32, maxX=-42, maxY=5, maxZ=38], floorY=0, target=Pos[x=-44, y=1, z=35]] +Room[id=southeast-guard, moduleId=southeast, type=GUARDROOM, interior=Box[minX=42, minY=1, minZ=32, maxX=47, maxY=5, maxZ=38], floorY=0, target=Pos[x=44, y=1, z=35]] + +Connections +Connection[id=court-hall, from=courtyard, to=hall, aperture=Box[minX=-1, minY=1, minZ=-11, maxX=1, maxY=3, maxZ=-11]] +Connection[id=hall-keep, from=hall, to=keep, aperture=Box[minX=-21, minY=1, minZ=-17, maxX=-20, maxY=3, maxZ=-15]] +Connection[id=hall-residence, from=hall, to=residence, aperture=Box[minX=17, minY=1, minZ=-17, maxX=18, maxY=3, maxZ=-15]] +Connection[id=keep-service, from=keep, to=service, aperture=Box[minX=-26, minY=1, minZ=-12, maxX=-24, maxY=3, maxZ=-11]] +Connection[id=court-service, from=courtyard, to=service, aperture=Box[minX=-21, minY=1, minZ=7, maxX=-21, maxY=3, maxZ=9]] +Connection[id=residence-kitchen, from=residence, to=kitchen, aperture=Box[minX=21, minY=1, minZ=3, maxX=23, maxY=3, maxZ=4]] +Connection[id=court-kitchen, from=courtyard, to=kitchen, aperture=Box[minX=18, minY=1, minZ=9, maxX=18, maxY=3, maxZ=11]] +Connection[id=court-gate, from=courtyard, to=gate, aperture=Box[minX=-2, minY=1, minZ=28, maxX=2, maxY=5, maxZ=28]] +Connection[id=gate-outside, from=gate, to=outside, aperture=Box[minX=-2, minY=1, minZ=40, maxX=2, maxY=5, maxZ=40]] +Connection[id=court-northwest, from=courtyard, to=northwest, aperture=Box[minX=-45, minY=1, minZ=-31, maxX=-43, maxY=3, maxZ=-31]] +Connection[id=court-northeast, from=courtyard, to=northeast, aperture=Box[minX=43, minY=1, minZ=-31, maxX=45, maxY=3, maxZ=-31]] +Connection[id=court-southwest, from=courtyard, to=southwest, aperture=Box[minX=-45, minY=1, minZ=30, maxX=-43, maxY=3, maxZ=30]] +Connection[id=court-southeast, from=courtyard, to=southeast, aperture=Box[minX=43, minY=1, minZ=30, maxX=45, maxY=3, maxZ=30]] + +Stair flights +StairFlight[id=keep-0-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=1, z=-20], Pos[x=-35, y=1, z=-20], Pos[x=-34, y=1, z=-20]], [Pos[x=-36, y=2, z=-21], Pos[x=-35, y=2, z=-21], Pos[x=-34, y=2, z=-21]], [Pos[x=-36, y=3, z=-22], Pos[x=-35, y=3, z=-22], Pos[x=-34, y=3, z=-22]], [Pos[x=-36, y=4, z=-23], Pos[x=-35, y=4, z=-23], Pos[x=-34, y=4, z=-23]]]] +StairFlight[id=keep-0-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=5, z=-23], Pos[x=-30, y=5, z=-23], Pos[x=-29, y=5, z=-23]], [Pos[x=-31, y=6, z=-22], Pos[x=-30, y=6, z=-22], Pos[x=-29, y=6, z=-22]], [Pos[x=-31, y=7, z=-21], Pos[x=-30, y=7, z=-21], Pos[x=-29, y=7, z=-21]], [Pos[x=-31, y=8, z=-20], Pos[x=-30, y=8, z=-20], Pos[x=-29, y=8, z=-20]]]] +StairFlight[id=keep-8-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=9, z=-20], Pos[x=-35, y=9, z=-20], Pos[x=-34, y=9, z=-20]], [Pos[x=-36, y=10, z=-21], Pos[x=-35, y=10, z=-21], Pos[x=-34, y=10, z=-21]], [Pos[x=-36, y=11, z=-22], Pos[x=-35, y=11, z=-22], Pos[x=-34, y=11, z=-22]], [Pos[x=-36, y=12, z=-23], Pos[x=-35, y=12, z=-23], Pos[x=-34, y=12, z=-23]]]] +StairFlight[id=keep-8-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=13, z=-23], Pos[x=-30, y=13, z=-23], Pos[x=-29, y=13, z=-23]], [Pos[x=-31, y=14, z=-22], Pos[x=-30, y=14, z=-22], Pos[x=-29, y=14, z=-22]], [Pos[x=-31, y=15, z=-21], Pos[x=-30, y=15, z=-21], Pos[x=-29, y=15, z=-21]], [Pos[x=-31, y=16, z=-20], Pos[x=-30, y=16, z=-20], Pos[x=-29, y=16, z=-20]]]] +StairFlight[id=keep-16-out, moduleId=keep, facing=NORTH, treads=[[Pos[x=-36, y=17, z=-20], Pos[x=-35, y=17, z=-20], Pos[x=-34, y=17, z=-20]], [Pos[x=-36, y=18, z=-21], Pos[x=-35, y=18, z=-21], Pos[x=-34, y=18, z=-21]], [Pos[x=-36, y=19, z=-22], Pos[x=-35, y=19, z=-22], Pos[x=-34, y=19, z=-22]], [Pos[x=-36, y=20, z=-23], Pos[x=-35, y=20, z=-23], Pos[x=-34, y=20, z=-23]]]] +StairFlight[id=keep-16-back, moduleId=keep, facing=SOUTH, treads=[[Pos[x=-31, y=21, z=-23], Pos[x=-30, y=21, z=-23], Pos[x=-29, y=21, z=-23]], [Pos[x=-31, y=22, z=-22], Pos[x=-30, y=22, z=-22], Pos[x=-29, y=22, z=-22]], [Pos[x=-31, y=23, z=-21], Pos[x=-30, y=23, z=-21], Pos[x=-29, y=23, z=-21]], [Pos[x=-31, y=24, z=-20], Pos[x=-30, y=24, z=-20], Pos[x=-29, y=24, z=-20]]]] +StairFlight[id=residence-0-out, moduleId=residence, facing=NORTH, treads=[[Pos[x=26, y=1, z=-20], Pos[x=27, y=1, z=-20], Pos[x=28, y=1, z=-20]], [Pos[x=26, y=2, z=-21], Pos[x=27, y=2, z=-21], Pos[x=28, y=2, z=-21]], [Pos[x=26, y=3, z=-22], Pos[x=27, y=3, z=-22], Pos[x=28, y=3, z=-22]], [Pos[x=26, y=4, z=-23], Pos[x=27, y=4, z=-23], Pos[x=28, y=4, z=-23]]]] +StairFlight[id=residence-0-back, moduleId=residence, facing=SOUTH, treads=[[Pos[x=31, y=5, z=-23], Pos[x=32, y=5, z=-23], Pos[x=33, y=5, z=-23]], [Pos[x=31, y=6, z=-22], Pos[x=32, y=6, z=-22], Pos[x=33, y=6, z=-22]], [Pos[x=31, y=7, z=-21], Pos[x=32, y=7, z=-21], Pos[x=33, y=7, z=-21]], [Pos[x=31, y=8, z=-20], Pos[x=32, y=8, z=-20], Pos[x=33, y=8, z=-20]]]] +StairFlight[id=residence-8-out, moduleId=residence, facing=NORTH, treads=[[Pos[x=26, y=9, z=-20], Pos[x=27, y=9, z=-20], Pos[x=28, y=9, z=-20]], [Pos[x=26, y=10, z=-21], Pos[x=27, y=10, z=-21], Pos[x=28, y=10, z=-21]], [Pos[x=26, y=11, z=-22], Pos[x=27, y=11, z=-22], Pos[x=28, y=11, z=-22]], [Pos[x=26, y=12, z=-23], Pos[x=27, y=12, z=-23], Pos[x=28, y=12, z=-23]]]] +StairFlight[id=residence-8-back, moduleId=residence, facing=SOUTH, treads=[[Pos[x=31, y=13, z=-23], Pos[x=32, y=13, z=-23], Pos[x=33, y=13, z=-23]], [Pos[x=31, y=14, z=-22], Pos[x=32, y=14, z=-22], Pos[x=33, y=14, z=-22]], [Pos[x=31, y=15, z=-21], Pos[x=32, y=15, z=-21], Pos[x=33, y=15, z=-21]], [Pos[x=31, y=16, z=-20], Pos[x=32, y=16, z=-20], Pos[x=33, y=16, z=-20]]]] +StairFlight[id=service-0-out, moduleId=service, facing=NORTH, treads=[[Pos[x=-36, y=1, z=4], Pos[x=-35, y=1, z=4], Pos[x=-34, y=1, z=4]], [Pos[x=-36, y=2, z=3], Pos[x=-35, y=2, z=3], Pos[x=-34, y=2, z=3]], [Pos[x=-36, y=3, z=2], Pos[x=-35, y=3, z=2], Pos[x=-34, y=3, z=2]], [Pos[x=-36, y=4, z=1], Pos[x=-35, y=4, z=1], Pos[x=-34, y=4, z=1]]]] +StairFlight[id=service-0-back, moduleId=service, facing=SOUTH, treads=[[Pos[x=-31, y=5, z=1], Pos[x=-30, y=5, z=1], Pos[x=-29, y=5, z=1]], [Pos[x=-31, y=6, z=2], Pos[x=-30, y=6, z=2], Pos[x=-29, y=6, z=2]], [Pos[x=-31, y=7, z=3], Pos[x=-30, y=7, z=3], Pos[x=-29, y=7, z=3]], [Pos[x=-31, y=8, z=4], Pos[x=-30, y=8, z=4], Pos[x=-29, y=8, z=4]]]] +StairFlight[id=gate-0-out, moduleId=gate, facing=NORTH, treads=[[Pos[x=-10, y=1, z=36], Pos[x=-9, y=1, z=36], Pos[x=-8, y=1, z=36]], [Pos[x=-10, y=2, z=35], Pos[x=-9, y=2, z=35], Pos[x=-8, y=2, z=35]], [Pos[x=-10, y=3, z=34], Pos[x=-9, y=3, z=34], Pos[x=-8, y=3, z=34]], [Pos[x=-10, y=4, z=33], Pos[x=-9, y=4, z=33], Pos[x=-8, y=4, z=33]]]] +StairFlight[id=gate-0-back, moduleId=gate, facing=SOUTH, treads=[[Pos[x=-5, y=5, z=33], Pos[x=-4, y=5, z=33], Pos[x=-3, y=5, z=33]], [Pos[x=-5, y=6, z=34], Pos[x=-4, y=6, z=34], Pos[x=-3, y=6, z=34]], [Pos[x=-5, y=7, z=35], Pos[x=-4, y=7, z=35], Pos[x=-3, y=7, z=35]], [Pos[x=-5, y=8, z=36], Pos[x=-4, y=8, z=36], Pos[x=-3, y=8, z=36]]]] +StairFlight[id=court-wall-stair, moduleId=wall-stair, facing=NORTH, treads=[[Pos[x=-44, y=1, z=23], Pos[x=-43, y=1, z=23], Pos[x=-42, y=1, z=23]], [Pos[x=-44, y=2, z=22], Pos[x=-43, y=2, z=22], Pos[x=-42, y=2, z=22]], [Pos[x=-44, y=3, z=21], Pos[x=-43, y=3, z=21], Pos[x=-42, y=3, z=21]], [Pos[x=-44, y=4, z=20], Pos[x=-43, y=4, z=20], Pos[x=-42, y=4, z=20]], [Pos[x=-44, y=5, z=19], Pos[x=-43, y=5, z=19], Pos[x=-42, y=5, z=19]], [Pos[x=-44, y=6, z=18], Pos[x=-43, y=6, z=18], Pos[x=-42, y=6, z=18]]]] +StairFlight[id=west-gate-rise, moduleId=southwall-west, facing=EAST, treads=[[Pos[x=-13, y=7, z=39], Pos[x=-13, y=7, z=38], Pos[x=-13, y=7, z=37]], [Pos[x=-12, y=8, z=39], Pos[x=-12, y=8, z=38], Pos[x=-12, y=8, z=37]]]] +StairFlight[id=east-gate-rise, moduleId=southwall-east, facing=WEST, treads=[[Pos[x=13, y=7, z=37], Pos[x=13, y=7, z=38], Pos[x=13, y=7, z=39]], [Pos[x=12, y=8, z=37], Pos[x=12, y=8, z=38], Pos[x=12, y=8, z=39]]]] + +Partitions +Partition[id=residence-cross-0, moduleId=residence, wall=Box[minX=19, minY=1, minZ=-13, maxX=35, maxY=7, maxZ=-13], portals=[Box[minX=21, minY=1, minZ=-13, maxX=23, maxY=3, maxZ=-13]]] +Partition[id=residence-spine-0, moduleId=residence, wall=Box[minX=25, minY=1, minZ=-12, maxX=25, maxY=7, maxZ=2], portals=[Box[minX=25, minY=1, minZ=-9, maxX=25, maxY=3, maxZ=-7], Box[minX=25, minY=1, minZ=-1, maxX=25, maxY=3, maxZ=1]]] +Partition[id=residence-divider-0, moduleId=residence, wall=Box[minX=26, minY=1, minZ=-4, maxX=35, maxY=7, maxZ=-4], portals=[]] +Partition[id=residence-cross-8, moduleId=residence, wall=Box[minX=19, minY=9, minZ=-13, maxX=35, maxY=15, maxZ=-13], portals=[Box[minX=21, minY=9, minZ=-13, maxX=23, maxY=11, maxZ=-13]]] +Partition[id=residence-spine-8, moduleId=residence, wall=Box[minX=25, minY=9, minZ=-12, maxX=25, maxY=15, maxZ=2], portals=[Box[minX=25, minY=9, minZ=-9, maxX=25, maxY=11, maxZ=-7], Box[minX=25, minY=9, minZ=-1, maxX=25, maxY=11, maxZ=1]]] +Partition[id=residence-divider-8, moduleId=residence, wall=Box[minX=26, minY=9, minZ=-4, maxX=35, maxY=15, maxZ=-4], portals=[]] +Partition[id=residence-cross-16, moduleId=residence, wall=Box[minX=19, minY=17, minZ=-13, maxX=35, maxY=21, maxZ=-13], portals=[Box[minX=21, minY=17, minZ=-13, maxX=23, maxY=19, maxZ=-13]]] +Partition[id=residence-spine-16, moduleId=residence, wall=Box[minX=25, minY=17, minZ=-12, maxX=25, maxY=21, maxZ=2], portals=[Box[minX=25, minY=17, minZ=-9, maxX=25, maxY=19, maxZ=-7], Box[minX=25, minY=17, minZ=-1, maxX=25, maxY=19, maxZ=1]]] +Partition[id=residence-divider-16, moduleId=residence, wall=Box[minX=26, minY=17, minZ=-4, maxX=35, maxY=21, maxZ=-4], portals=[]] + +Facade bays +FacadeBay[id=hall-bay-0, window=Window[moduleId=hall, opening=Box[minX=-16, minY=4, minZ=-30, maxX=-14, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=-17, minY=3, minZ=-31, maxX=-13, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-1, window=Window[moduleId=hall, opening=Box[minX=-10, minY=4, minZ=-30, maxX=-8, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=-11, minY=3, minZ=-31, maxX=-7, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-2, window=Window[moduleId=hall, opening=Box[minX=-4, minY=4, minZ=-30, maxX=-2, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=-5, minY=3, minZ=-31, maxX=-1, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-3, window=Window[moduleId=hall, opening=Box[minX=2, minY=4, minZ=-30, maxX=4, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=1, minY=3, minZ=-31, maxX=5, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-4, window=Window[moduleId=hall, opening=Box[minX=8, minY=4, minZ=-30, maxX=10, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=7, minY=3, minZ=-31, maxX=11, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-5, window=Window[moduleId=hall, opening=Box[minX=14, minY=4, minZ=-30, maxX=16, maxY=8, maxZ=-30], outward=NORTH], style=HALL_LANCET, envelope=Box[minX=13, minY=3, minZ=-31, maxX=17, maxY=10, maxZ=-30]] +FacadeBay[id=hall-bay-6, window=Window[moduleId=hall, opening=Box[minX=-16, minY=4, minZ=-11, maxX=-14, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=-17, minY=3, minZ=-11, maxX=-13, maxY=10, maxZ=-10]] +FacadeBay[id=hall-bay-7, window=Window[moduleId=hall, opening=Box[minX=-10, minY=4, minZ=-11, maxX=-8, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=-11, minY=3, minZ=-11, maxX=-7, maxY=10, maxZ=-10]] +FacadeBay[id=hall-bay-8, window=Window[moduleId=hall, opening=Box[minX=8, minY=4, minZ=-11, maxX=10, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=7, minY=3, minZ=-11, maxX=11, maxY=10, maxZ=-10]] +FacadeBay[id=hall-bay-9, window=Window[moduleId=hall, opening=Box[minX=14, minY=4, minZ=-11, maxX=16, maxY=8, maxZ=-11], outward=SOUTH], style=HALL_LANCET, envelope=Box[minX=13, minY=3, minZ=-11, maxX=17, maxY=10, maxZ=-10]] +FacadeBay[id=residence-bay-10, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-26, maxX=36, maxY=5, maxZ=-24], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-27, maxX=37, maxY=7, maxZ=-23]] +FacadeBay[id=residence-bay-11, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-20, maxX=36, maxY=5, maxZ=-18], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-21, maxX=37, maxY=7, maxZ=-17]] +FacadeBay[id=residence-bay-12, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-9, maxX=36, maxY=5, maxZ=-7], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-10, maxX=37, maxY=7, maxZ=-6]] +FacadeBay[id=residence-bay-13, window=Window[moduleId=residence, opening=Box[minX=36, minY=3, minZ=-1, maxX=36, maxY=5, maxZ=1], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=2, minZ=-2, maxX=37, maxY=7, maxZ=2]] +FacadeBay[id=residence-bay-14, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-26, maxX=36, maxY=13, maxZ=-24], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-27, maxX=37, maxY=15, maxZ=-23]] +FacadeBay[id=residence-bay-15, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-20, maxX=36, maxY=13, maxZ=-18], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-21, maxX=37, maxY=15, maxZ=-17]] +FacadeBay[id=residence-bay-16, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-9, maxX=36, maxY=13, maxZ=-7], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-10, maxX=37, maxY=15, maxZ=-6]] +FacadeBay[id=residence-bay-17, window=Window[moduleId=residence, opening=Box[minX=36, minY=11, minZ=-1, maxX=36, maxY=13, maxZ=1], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=10, minZ=-2, maxX=37, maxY=15, maxZ=2]] +FacadeBay[id=residence-bay-18, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-26, maxX=36, maxY=21, maxZ=-24], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-27, maxX=37, maxY=23, maxZ=-23]] +FacadeBay[id=residence-bay-19, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-20, maxX=36, maxY=21, maxZ=-18], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-21, maxX=37, maxY=23, maxZ=-17]] +FacadeBay[id=residence-bay-20, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-9, maxX=36, maxY=21, maxZ=-7], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-10, maxX=37, maxY=23, maxZ=-6]] +FacadeBay[id=residence-bay-21, window=Window[moduleId=residence, opening=Box[minX=36, minY=19, minZ=-1, maxX=36, maxY=21, maxZ=1], outward=EAST], style=CHAMBER_CASEMENT, envelope=Box[minX=36, minY=18, minZ=-2, maxX=37, maxY=23, maxZ=2]] + +Court uses +CourtFeature[id=well, use=COVERED_WELL, bounds=Box[minX=-10, minY=0, minZ=3, maxX=-4, maxY=7, maxZ=9]] +CourtFeature[id=herbs, use=HERB_GARDEN, bounds=Box[minX=-35, minY=0, minZ=20, maxX=-25, maxY=2, maxZ=28]] +CourtFeature[id=arbor, use=SEATING_ARBOR, bounds=Box[minX=25, minY=0, minZ=23, maxX=35, maxY=6, maxZ=28]] + +Roof lights +Dormer[id=residence-roof-north, moduleId=residence, frontX=36, centerZ=-23, baseY=25] +Dormer[id=residence-roof-south, moduleId=residence, frontX=36, centerZ=-5, baseY=25] + +Wall-walk sections (support-block coordinates, not feet) +northwall-walk owner=northwall deckCells=237 guardCells=197 +westwall-walk owner=westwall deckCells=180 guardCells=147 +eastwall-walk owner=eastwall deckCells=180 guardCells=150 +southwall-west-walk owner=southwall-west deckCells=84 guardCells=70 +southwall-east-walk owner=southwall-east deckCells=84 guardCells=70 +gate-walk owner=gate deckCells=69 guardCells=51 +northwest-walk owner=northwest deckCells=70 guardCells=38 +northeast-walk owner=northeast deckCells=70 guardCells=37 +southwest-walk owner=southwest deckCells=78 guardCells=40 +southeast-walk owner=southeast deckCells=78 guardCells=40 +wall-stair-walk owner=wall-stair deckCells=30 guardCells=12 diff --git a/docs/evidence/reference-v3/northwest.png b/docs/evidence/reference-v3/northwest.png new file mode 100644 index 0000000..6e8b0b0 Binary files /dev/null and b/docs/evidence/reference-v3/northwest.png differ diff --git a/docs/evidence/reference-v3/residence-facade.png b/docs/evidence/reference-v3/residence-facade.png new file mode 100644 index 0000000..91aa1d4 Binary files /dev/null and b/docs/evidence/reference-v3/residence-facade.png differ diff --git a/docs/evidence/reference-v3/residence-plan.png b/docs/evidence/reference-v3/residence-plan.png new file mode 100644 index 0000000..c8747a4 Binary files /dev/null and b/docs/evidence/reference-v3/residence-plan.png differ diff --git a/docs/evidence/reference-v3/southeast.png b/docs/evidence/reference-v3/southeast.png new file mode 100644 index 0000000..47a6912 Binary files /dev/null and b/docs/evidence/reference-v3/southeast.png differ diff --git a/docs/evidence/reference-v3/stair-section.png b/docs/evidence/reference-v3/stair-section.png new file mode 100644 index 0000000..5bb5092 Binary files /dev/null and b/docs/evidence/reference-v3/stair-section.png differ diff --git a/docs/evidence/reference-v3/tower-crossing.png b/docs/evidence/reference-v3/tower-crossing.png new file mode 100644 index 0000000..c116466 Binary files /dev/null and b/docs/evidence/reference-v3/tower-crossing.png differ diff --git a/docs/evidence/reference-v3/wallwalk-plan.png b/docs/evidence/reference-v3/wallwalk-plan.png new file mode 100644 index 0000000..505e5c9 Binary files /dev/null and b/docs/evidence/reference-v3/wallwalk-plan.png differ diff --git a/fabric/src/main/java/dev/castleforge/fabric/CastleForge.java b/fabric/src/main/java/dev/castleforge/fabric/CastleForge.java index 4f40008..b28231f 100644 --- a/fabric/src/main/java/dev/castleforge/fabric/CastleForge.java +++ b/fabric/src/main/java/dev/castleforge/fabric/CastleForge.java @@ -5,6 +5,7 @@ import dev.castleforge.core.TerracedCastlePlanner; import dev.castleforge.core.CastleIdentity; import dev.castleforge.core.PlanDiagnostics; +import dev.castleforge.core.architecture.ReferenceCastlePlanner; import com.mojang.brigadier.arguments.IntegerArgumentType; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; @@ -28,6 +29,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.*; +import java.util.concurrent.*; /** Explicit, operator-only test placement. No chunk-load/worldgen hooks and no client rendering mixins. */ public final class CastleForge implements ModInitializer { @@ -41,7 +43,7 @@ public final class CastleForge implements ModInitializer { CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> dispatcher.register( Commands.literal("castleforge") .requires(s -> s.permissions().hasPermission(Permissions.COMMANDS_MODERATOR)) - .executes(c -> say(c.getSource(), "CastleForge alpha: /castleforge region | preview [terraced] [x z] | build confirm | inspect | status | cancel | undo. TEST WORLDS ONLY.")) + .executes(c -> say(c.getSource(), "CastleForge alpha: /castleforge region | preview [terraced|reference] [x z] | build confirm | inspect | status | cancel | undo. TEST WORLDS ONLY.")) .then(Commands.literal("region").executes(c -> safely(c.getSource(), () -> region(c.getSource())))) .then(Commands.literal("preview") .executes(c -> safely(c.getSource(), () -> preview(c.getSource(), null, null, false))) @@ -54,7 +56,13 @@ public final class CastleForge implements ModInitializer { .then(Commands.argument("x", IntegerArgumentType.integer(-29_999_800, 29_999_800)) .then(Commands.argument("z", IntegerArgumentType.integer(-29_999_800, 29_999_800)) .executes(c -> safely(c.getSource(), () -> preview(c.getSource(), - IntegerArgumentType.getInteger(c,"x"), IntegerArgumentType.getInteger(c,"z"), true))))))) + IntegerArgumentType.getInteger(c,"x"), IntegerArgumentType.getInteger(c,"z"), true)))))) + .then(Commands.literal("reference") + .executes(c -> safely(c.getSource(), () -> previewReference(c.getSource(), null, null))) + .then(Commands.argument("x", IntegerArgumentType.integer(-29_999_800, 29_999_800)) + .then(Commands.argument("z", IntegerArgumentType.integer(-29_999_800, 29_999_800)) + .executes(c -> safely(c.getSource(), () -> previewReference(c.getSource(), + IntegerArgumentType.getInteger(c,"x"), IntegerArgumentType.getInteger(c,"z")))))))) .then(Commands.literal("build").then(Commands.literal("confirm") .executes(c -> safely(c.getSource(), () -> build(c.getSource()))))) .then(Commands.literal("inspect").executes(c -> safely(c.getSource(), () -> inspect(c.getSource())))) @@ -64,10 +72,17 @@ public final class CastleForge implements ModInitializer { )); ServerTickEvents.END_SERVER_TICK.register(server -> { Session s = sessions.get(server); + if (s != null) s.previews.entrySet().removeIf(e -> e.getValue().reference && + (System.nanoTime()-e.getValue().created > PREVIEW_LIFETIME_NS || !referenceOwnerPresent(e.getValue()))); + if (s != null && s.reference != null) tickReference(s); if (s != null && s.job != null && !s.job.finished) s.job.tick(); }); ServerLifecycleEvents.SERVER_STOPPED.register(server -> { Session s = sessions.remove(server); + if (s != null) { + invalidateReference(s); + if (s.planner != null) s.planner.shutdownNow(); + } if (s != null && s.job != null && !s.job.finished) LOGGER.warn("CastleForge interrupted: partial test build remains; in-memory undo is lost on shutdown."); }); LOGGER.info("CastleForge alpha initialized; automatic world generation is DISABLED."); @@ -99,6 +114,7 @@ private int preview(CommandSourceStack source, Integer x, Integer z, boolean ter Session s = session(source); if (s.job != null && !s.job.finished) throw new IllegalArgumentException("A placement or undo is already running."); UUID user = owner(source); + if (s.reference != null && s.reference.user.equals(user)) invalidateReference(s); s.previews.remove(user); s.previews.entrySet().removeIf(e -> System.nanoTime() - e.getValue().created > PREVIEW_LIFETIME_NS); if (s.previews.size() >= 8) throw new IllegalArgumentException("Too many previews; try after another preview expires."); @@ -164,11 +180,163 @@ private int preview(CommandSourceStack source, Integer x, Integer z, boolean ter checks.add(new Check(pos,before)); if (!before.equals(after)) edits.add(new Edit(pos,before,after)); } - s.previews.put(user,new Preview(level,List.copyOf(edits),List.copyOf(checks),System.nanoTime(),details)); + s.previews.put(user,new Preview(level,List.copyOf(edits),List.copyOf(checks),System.nanoTime(),details,false,null)); LOGGER.info("CastleForge preview {} at {},{}: {} edits; {}",user,ox,oz,edits.size(),summary); return say(source,"PREVIEW only: " + region.style() + " at " + ox + "," + oz + "; " + summary + "; " + edits.size() + " edits. /castleforge build confirm within 120s. Disposable test world only; back up first."); } + /** Reference preview has three bounded phases: server snapshot, pure worker, server preflight. + * No Minecraft world/chunk/block object is read by the worker. Publication happens only while + * the exact request is still the active session request; cancellation never publishes late work. + */ + private int previewReference(CommandSourceStack source, Integer x, Integer z) throws IOException { + ServerLevel level = source.getLevel(); overworld(level); + Session s = session(source); + if (s.job != null && !s.job.finished) throw new IllegalArgumentException("A placement or undo is already running."); + UUID user = owner(source); + if (s.reference != null) { + if (!s.reference.user.equals(user)) throw new IllegalArgumentException("A reference preview is already being prepared by another operator."); + invalidateReference(s); + } + s.previews.remove(user); + s.previews.entrySet().removeIf(e -> System.nanoTime() - e.getValue().created > PREVIEW_LIFETIME_NS); + if (s.previews.size() >= 8) throw new IllegalArgumentException("Too many previews; try after another preview expires."); + BlockPos p = BlockPos.containing(source.getPosition()); + int radius = ReferenceCastlePlanner.RADIUS; + int ox = x == null ? p.getX() : x; + int oz = z == null ? p.getZ() - radius - 4 : z; + if (Math.abs((long)ox) > 29_999_800 || Math.abs((long)oz) > 29_999_800) + throw new IllegalArgumentException("Site too near world coordinate limit."); + for (int cx = (ox-radius)>>4; cx <= (ox+radius)>>4; cx++) + for (int cz = (oz-radius)>>4; cz <= (oz+radius)>>4; cz++) + if (!level.getChunkSource().hasChunk(cx,cz)) + throw new IllegalArgumentException("Entire reference site must already be loaded. No chunks are force-generated."); + s.reference = new ReferencePreview(source, user, ox, oz, level.getSeed(), s.settings.map(level.getSeed()).at(ox,oz)); + return say(source,"Preparing REFERENCE preview at " + ox + "," + oz + + ". Snapshot and checks run over several ticks; planning runs on a worker. Wait for PREVIEW READY before confirming; /castleforge status or cancel."); + } + + private static void invalidateReference(Session s) { + ReferencePreview p = s.reference; + s.reference = null; + if (p != null && p.future != null) p.future.cancel(true); + if (s.planner != null) s.planner.purge(); + } + + private void tickReference(Session s) { + ReferencePreview p = s.reference; + if (p == null) return; + if ((s.job != null && !s.job.finished) + || (p.source.getEntity() != null && (p.source.getEntity().isRemoved() || p.source.getEntity().level() != p.level))) { + invalidateReference(s); return; + } + long tickStart = System.nanoTime(); + try { + if (tickStart - p.created > PREVIEW_LIFETIME_NS) + throw new IllegalArgumentException("Reference preparation timed out after 120 seconds. Nothing was changed."); + if (p.snapshotIndex < p.heights.length) { + int work = 0; + while (p.snapshotIndex < p.heights.length && work < EDITS_PER_TICK && System.nanoTime()-tickStart < TICK_BUDGET_NS) { + int px = p.ox - p.radius + p.snapshotIndex % p.width; + int pz = p.oz - p.radius + p.snapshotIndex / p.width; + if (!p.level.getChunkSource().hasChunk(px>>4,pz>>4)) + throw new IllegalArgumentException("Reference terrain unloaded at " + px + "," + pz + ". Stay nearby and preview again."); + int y = p.level.getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES,px,pz); + BlockPos pos = new BlockPos(px,y-1,pz); + if (p.level.isOutsideBuildHeight(pos) || !p.level.getWorldBorder().isWithinBounds(pos)) + throw new IllegalArgumentException("Reference terrain exceeds world bounds at " + pos.toShortString()); + BlockState state = p.level.getBlockState(pos); + if (!state.getFluidState().isEmpty()) + throw new IllegalArgumentException("Reference site contains water/fluid at " + pos.toShortString()); + if (p.level.getBlockEntity(pos) != null) + throw new IllegalArgumentException("Reference site contains a block entity at " + pos.toShortString() + ": " + state); + if (!naturalGround(state)) + throw new IllegalArgumentException("Reference ground block is not in the supported terrain list at " + pos.toShortString() + + ": " + state + ". Choose an open flat site"); + p.checks.add(new Check(pos,state)); + p.heights[p.snapshotIndex++] = y; + work++; + } + p.snapshotNs += System.nanoTime()-tickStart; + return; + } + if (p.future == null) { + if (s.planner == null) s.planner = new ThreadPoolExecutor(1,1,0,TimeUnit.MILLISECONDS, + new ArrayBlockingQueue<>(1), task -> { + Thread worker = new Thread(task,"CastleForge-reference-planner"); + worker.setDaemon(true); return worker; + },new ThreadPoolExecutor.AbortPolicy()); + // These immutable values and the copied primitive array are the entire world input. + int[] heights = p.heights.clone(); + int ox = p.ox, oz = p.oz, radius = p.radius, width = p.width; + long seed = p.seed; + CultureMap.Region region = p.region; + CastlePlanner.Ground ground = (px,pz) -> { + int dx=px-ox+radius, dz=pz-oz+radius; + if (dx<0 || dx>=width || dz<0 || dz>=width) + throw new IllegalArgumentException("Reference planner sampled outside its terrain snapshot"); + return heights[dz*width+dx]; + }; + p.future = s.planner.submit(() -> { + long start = System.nanoTime(); + try { p.result = ReferenceCastlePlanner.plan(seed,ox,oz,ground,region); } + catch (RuntimeException e) { p.failure = e; } + finally { p.planningNs = System.nanoTime()-start; p.completed = true; } + }); + return; + } + if (!p.completed) return; + if (p.failure != null) throw p.failure; + var plan = p.result; + if (plan == null) throw new IllegalStateException("Reference planner returned no result"); + if (plan.blocks().size() > ReferenceCastlePlanner.MAX_BLOCKS) + throw new IllegalArgumentException("Reference exceeds its block budget"); + int work = 0; + while (p.preflightIndex < plan.blocks().size() && work < EDITS_PER_TICK && System.nanoTime()-tickStart < TICK_BUDGET_NS) { + var block = plan.blocks().get(p.preflightIndex); + var v = block.pos(); + BlockPos pos = new BlockPos(v.x(),v.y(),v.z()); + if (p.level.isOutsideBuildHeight(pos) || !p.level.getWorldBorder().isWithinBounds(pos)) + throw new IllegalArgumentException("Reference plan exceeds build height or world border at " + pos.toShortString()); + if (!loaded(p.level,pos)) + throw new IllegalArgumentException("Reference plan unloaded at " + pos.toShortString() + ". Nothing was changed."); + BlockState before = p.level.getBlockState(pos), after = ReferencePalette.resolve(block); + if (p.level.getBlockEntity(pos) != null || !before.getFluidState().isEmpty() || !replaceable(before)) + throw new IllegalArgumentException("Protected or non-natural block at " + pos.toShortString() + ". Nothing was changed."); + // Air and unchanged cells remain part of confirmation's conflict contract. + p.checks.add(new Check(pos,before)); + if (!before.equals(after)) p.edits.add(new Edit(pos,before,after)); + p.minX=Math.min(p.minX,v.x()); p.maxX=Math.max(p.maxX,v.x()); + p.minY=Math.min(p.minY,v.y()); p.maxY=Math.max(p.maxY,v.y()); + p.minZ=Math.min(p.minZ,v.z()); p.maxZ=Math.max(p.maxZ,v.z()); + p.preflightIndex++; work++; + } + p.preflightNs += System.nanoTime()-tickStart; + if (p.preflightIndex != plan.blocks().size()) return; + if (s.reference != p) return; + var identity = CastleIdentity.generate(p.seed,p.ox,p.oz,p.region,CastlePlanner.Condition.RESTORED); + String timing = "snapshot " + TimeUnit.NANOSECONDS.toMillis(p.snapshotNs) + " ms, plan " + + TimeUnit.NANOSECONDS.toMillis(p.planningNs) + " ms, preflight " + TimeUnit.NANOSECONDS.toMillis(p.preflightNs) + " ms"; + String details = identity.oneLine() + "; " + plan.architecture().variant() + " (Central European material study); " + + plan.report().compact() + "; bounds " + (p.maxX-p.minX+1) + " x " + (p.maxY-p.minY+1) + " x " + (p.maxZ-p.minZ+1) + + "; terrain relief " + plan.relief() + "; rotation " + plan.quarterTurns()*90 + + " degrees; " + p.edits.size() + " edits; " + timing + + "; geometry checks are not Minecraft collision/visual acceptance."; + // Retain at most one large reference preview per session, alongside legacy previews. + s.previews.entrySet().removeIf(e -> e.getValue().reference || System.nanoTime()-e.getValue().created > PREVIEW_LIFETIME_NS); + if (s.previews.size() >= 8) throw new IllegalArgumentException("Preview slots filled while planning; try again later."); + s.previews.put(p.user,new Preview(p.level,List.copyOf(p.edits),List.copyOf(p.checks),System.nanoTime(),details,true,p.source)); + s.reference = null; + LOGGER.info("CastleForge reference preview {} at {},{}: {}; {}",p.user,p.ox,p.oz,plan.report().compact(),timing); + say(p.source,"PREVIEW READY: Falkenwacht reference at " + p.ox + "," + p.oz + "; " + plan.report().compact() + + "; " + p.edits.size() + " edits. /castleforge inspect; /castleforge build confirm within 120s. Disposable test world only."); + } catch (RuntimeException e) { + invalidateReference(s); + if (!(e instanceof IllegalArgumentException)) LOGGER.error("CastleForge reference preview failed",e); + p.source.sendFailure(Component.literal("CastleForge reference: " + e.getMessage() + ". Nothing was placed.")); + } + } + private int inspect(CommandSourceStack source) throws IOException { Preview p = session(source).previews.get(owner(source)); if (p == null || System.nanoTime() - p.created > PREVIEW_LIFETIME_NS @@ -180,24 +348,43 @@ private int inspect(CommandSourceStack source) throws IOException { private int build(CommandSourceStack source) throws IOException { Session s = session(source); if (s.job != null && !s.job.finished) throw new IllegalArgumentException("Another job is running."); + if (s.reference != null && s.reference.user.equals(owner(source))) + throw new IllegalArgumentException("Reference preview is still being prepared. Wait for PREVIEW READY."); Preview p = s.previews.remove(owner(source)); if (p == null || System.nanoTime() - p.created > PREVIEW_LIFETIME_NS || p.level != source.getLevel()) throw new IllegalArgumentException("Run a fresh preview in this dimension first."); + if (p.reference && (!referenceOwnerPresent(p) || p.creator.getEntity() != source.getEntity())) + throw new IllegalArgumentException("Reference preview belongs to an earlier player session. Preview again."); for (Check check : p.checks) { if (!loaded(p.level,check.pos) || !p.level.getBlockState(check.pos).equals(check.expected) || p.level.getBlockEntity(check.pos)!=null) throw new IllegalArgumentException("Site changed since preview; nothing was placed. Preview again."); } + invalidateReference(s); s.job = new Job(owner(source), source, p.level, p.edits, false); s.lastBuild = s.job; s.previews.clear(); return say(source,"Test build started (budget: 256 edits / 2 ms per tick). /castleforge cancel stops; /castleforge undo reverts this session's last build."); } private int status(CommandSourceStack source) throws IOException { - Job j = session(source).job; + Session s = session(source); + if (s.reference != null) return say(source,"Reference preview: " + s.reference.progress()); + Job j = s.job; return say(source,j == null ? "No job." : (j.undo ? "Undo " : "Build ") + j.index + "/" + j.edits.size() + "; " + j.message); } private int cancel(CommandSourceStack source) throws IOException { - Job j = session(source).job; + Session s = session(source); + if (s.reference != null) { + if (!s.reference.user.equals(owner(source))) + throw new IllegalArgumentException("Only the initiating operator can cancel this reference preview."); + invalidateReference(s); + return say(source,"Reference preview cancelled. Nothing was placed."); + } + Job j = s.job; + Preview p = s.previews.get(owner(source)); + if ((j == null || j.finished) && p != null && p.reference) { + s.previews.remove(owner(source)); + return say(source,"Reference preview discarded. Nothing was placed."); + } if (j == null || j.finished) throw new IllegalArgumentException("No active job."); if (!j.owner.equals(owner(source))) throw new IllegalArgumentException("Only the initiating operator can cancel this job."); if (j.undo) throw new IllegalArgumentException("Let the bounded undo finish; it cannot be cancelled."); @@ -211,6 +398,7 @@ private int undo(CommandSourceStack source) throws IOException { if (previous == null || !previous.owner.equals(owner(source))) throw new IllegalArgumentException("No undo for this operator in this server session."); List reversed = new ArrayList<>(previous.applied); Collections.reverse(reversed); + invalidateReference(s); s.job = new Job(owner(source),source,previous.level,List.copyOf(reversed),true); s.lastBuild = null; return say(source,"Undo started. Blocks modified after placement are left untouched. This is not a world-backup replacement."); @@ -235,7 +423,12 @@ private static int safely(CommandSourceStack source, Action action) { private record Desired(BlockPos pos, BlockState state) {} private record Check(BlockPos pos, BlockState expected) {} private record Edit(BlockPos pos, BlockState before, BlockState after) {} - private record Preview(ServerLevel level, List edits, List checks, long created, String details) {} + private record Preview(ServerLevel level, List edits, List checks, long created, String details, + boolean reference, CommandSourceStack creator) {} + private static boolean referenceOwnerPresent(Preview p) { + return p.creator != null && (p.creator.getEntity() == null + || (!p.creator.getEntity().isRemoved() && p.creator.getEntity().level() == p.level)); + } private static boolean matchesUndo(BlockState actual, BlockState expected) { // Neighbor updates recompute stair shape; never ignore facing, half, material or waterlogging changes. if (expected.getBlock() instanceof StairBlock && actual.is(expected.getBlock())) @@ -245,8 +438,39 @@ private static boolean matchesUndo(BlockState actual, BlockState expected) { private static final class Session { final WorldSettings settings; final Map previews = new HashMap<>(); Job job, lastBuild; + ReferencePreview reference; + ThreadPoolExecutor planner; Session(WorldSettings settings) { this.settings=settings; } } + private static final class ReferencePreview { + final CommandSourceStack source; + final ServerLevel level; + final UUID user; + final int ox, oz, radius = ReferenceCastlePlanner.RADIUS, width = radius*2+1; + final int[] heights = new int[width*width]; + final long seed, created = System.nanoTime(); + final CultureMap.Region region; + final List checks = new ArrayList<>(); + final List edits = new ArrayList<>(); + int snapshotIndex, preflightIndex; + int minX=Integer.MAX_VALUE,minY=Integer.MAX_VALUE,minZ=Integer.MAX_VALUE; + int maxX=Integer.MIN_VALUE,maxY=Integer.MIN_VALUE,maxZ=Integer.MIN_VALUE; + long snapshotNs, preflightNs; + Future future; + volatile ReferenceCastlePlanner.Plan result; + volatile RuntimeException failure; + volatile boolean completed; + volatile long planningNs; + ReferencePreview(CommandSourceStack source, UUID user, int ox, int oz, long seed, CultureMap.Region region) { + this.source=source; this.level=source.getLevel(); this.user=user; this.ox=ox; this.oz=oz; + this.seed=seed; this.region=region; + } + String progress() { + if (snapshotIndex < heights.length) return "terrain snapshot " + snapshotIndex + "/" + heights.length; + if (!completed) return "architecture planning"; + return "block preflight " + preflightIndex + "/" + (result == null ? 0 : result.blocks().size()); + } + } private static final class Job { final UUID owner; final CommandSourceStack source; final ServerLevel level; final List edits; final List applied = new ArrayList<>(); final boolean undo; @@ -294,3 +518,4 @@ void tick() { } } } + diff --git a/fabric/src/main/java/dev/castleforge/fabric/ReferencePalette.java b/fabric/src/main/java/dev/castleforge/fabric/ReferencePalette.java new file mode 100644 index 0000000..780754d --- /dev/null +++ b/fabric/src/main/java/dev/castleforge/fabric/ReferencePalette.java @@ -0,0 +1,56 @@ +package dev.castleforge.fabric; + +import dev.castleforge.core.architecture.ReferenceBlock; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LanternBlock; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.SlabType; + +/** One authored Central European material study; culture geography is deliberately independent. */ +final class ReferencePalette { + static BlockState resolve(ReferenceBlock block) { + return switch (block.kind()) { + case AIR -> Blocks.AIR.defaultBlockState(); + case FOUNDATION -> Blocks.COBBLESTONE.defaultBlockState(); + case STONE -> Blocks.STONE_BRICKS.defaultBlockState(); + case TRIM -> Blocks.POLISHED_ANDESITE.defaultBlockState(); + case TIMBER -> Blocks.STRIPPED_DARK_OAK_LOG.defaultBlockState().setValue(RotatedPillarBlock.AXIS, + switch (block.facing()) { + case EAST, WEST -> Direction.Axis.X; + case NORTH, SOUTH -> Direction.Axis.Z; + case NONE -> Direction.Axis.Y; + }); + case PLANKS -> Blocks.SPRUCE_PLANKS.defaultBlockState(); + case ROOF -> Blocks.DEEPSLATE_TILES.defaultBlockState(); + case GLASS -> Blocks.GLASS.defaultBlockState(); + case BOOKSHELF -> Blocks.BOOKSHELF.defaultBlockState(); + case WOOL -> Blocks.RED_WOOL.defaultBlockState(); + case PLASTER -> Blocks.CALCITE.defaultBlockState(); + case PAVING -> Blocks.ANDESITE.defaultBlockState(); + case GARDEN -> Blocks.MOSS_BLOCK.defaultBlockState(); + case TABLE_TOP -> Blocks.SPRUCE_SLAB.defaultBlockState().setValue(SlabBlock.TYPE, SlabType.TOP); + case STONE_SLAB -> Blocks.STONE_BRICK_SLAB.defaultBlockState().setValue(SlabBlock.TYPE, SlabType.BOTTOM); + case STONE_STAIRS -> Blocks.STONE_BRICK_STAIRS.defaultBlockState() + .setValue(StairBlock.FACING, facing(block)); + case WOOD_STAIRS -> Blocks.SPRUCE_STAIRS.defaultBlockState() + .setValue(StairBlock.FACING, facing(block)); + case ROOF_STAIRS -> Blocks.DEEPSLATE_TILE_STAIRS.defaultBlockState() + .setValue(StairBlock.FACING, facing(block)); + case SLAB -> Blocks.SPRUCE_SLAB.defaultBlockState().setValue(SlabBlock.TYPE, SlabType.BOTTOM); + case ROOF_SLAB -> Blocks.DEEPSLATE_TILE_SLAB.defaultBlockState().setValue(SlabBlock.TYPE, SlabType.BOTTOM); + case LANTERN -> Blocks.LANTERN.defaultBlockState().setValue(LanternBlock.HANGING, true); + }; + } + + private static Direction facing(ReferenceBlock block) { + if (block.facing() == ReferenceBlock.Facing.NONE) + throw new IllegalArgumentException("Directional reference block has no facing: " + block); + return Direction.valueOf(block.facing().name()); + } + + private ReferencePalette() {} +} diff --git a/scripts/render-reference-set.py b/scripts/render-reference-set.py new file mode 100644 index 0000000..b550dbb --- /dev/null +++ b/scripts/render-reference-set.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +"""Reproduce reference geometry views, including the elevated defensive circuit.""" +import argparse +import importlib.util +import shutil +from pathlib import Path +from types import SimpleNamespace + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument('source', type=Path) +parser.add_argument('destination', type=Path) +parser.add_argument('--label', default='Falkenwacht v3') +args = parser.parse_args() +spec = importlib.util.spec_from_file_location('geometry_renderer', Path(__file__).with_name('render-reference.py')) +renderer = importlib.util.module_from_spec(spec) +spec.loader.exec_module(renderer) +args.destination.mkdir(parents=True, exist_ok=True) +views = [ + ('southeast', 'Falkenwacht v2 / Southeast', {}), + ('northwest', 'Falkenwacht v2 / Northwest', {'turn': 2}), + ('ground-plan', 'Falkenwacht v2 / Ground floor', {'top': True, 'cut_y': 3}), + ('gate', 'Falkenwacht v2 / Gate approach', {'crop': [-12,27,12,41], 'elevation': 15}), + ('hall-section', 'Falkenwacht v2 / Hall section', {'crop': [-19,-29,16,-12], 'cut_y': 13}), + ('hall-furniture', 'Falkenwacht v2 / Hall furniture', {'crop': [-19,-29,16,-12], 'cut_y': 3}), + ('residence-plan', 'Falkenwacht v2 / First-floor chambers', {'crop': [18,-30,36,3], 'cut_y': 11, 'top': True}), + ('residence-facade', 'Falkenwacht v2 / Residential facade', {'crop': [18,-30,38,3], 'elevation': 15}), + ('stair-section', 'Falkenwacht v2 / Keep staircase section', {'crop': [-38,-29,-28,-14], 'cut_y': 24}), + ('wallwalk-plan', 'Falkenwacht v2 / Elevated circuit, cut at Y=7', {'top': True, 'cut_y': 7}), + ('court-stair', 'Falkenwacht v2 / Court stair and parapets', {'crop': [-49,12,-37,29], 'cut_y': 12}), + ('gate-link', 'Falkenwacht v2 / Raised gatehouse crossing', {'crop': [-17,27,17,41], 'cut_y': 11, 'top': True}), + ('tower-crossing', 'Falkenwacht v2 / Northeast tower crossing', {'crop': [39,-40,49,-29], 'cut_y': 10}), +] +for name,title,options in views: + title=title.replace('Falkenwacht v2', args.label) + parameters = dict(input=args.source/'blocks.tsv', output=args.destination/f'{name}.png', + title=title, top=False, turn=0, elevation=30, cut_y=10000, crop=None) + parameters.update(options) + renderer.render(SimpleNamespace(**parameters)) +shutil.copyfile(args.source/'model.txt', args.destination/'model.txt') diff --git a/scripts/render-reference.py b/scripts/render-reference.py new file mode 100644 index 0000000..5efc75b --- /dev/null +++ b/scripts/render-reference.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +"""Orthographic technical views of ReferenceExport TSV. No Minecraft assets. + +Requires Python 3.10+ and Pillow. Shapes are the explicitly supported primitive +subset (cubes, straight stairs, bottom slabs, hanging lanterns), not Minecraft's +renderer. This checks composition and clearances, NOT lighting/physics/textures. +""" +import argparse +import csv +import math +from pathlib import Path +from PIL import Image, ImageDraw, ImageFont + +COLORS = { + 'FOUNDATION': '#6b6962', 'STONE': '#a8a28f', 'TRIM': '#cec7b3', + 'TIMBER': '#614733', 'PLANKS': '#a08055', 'ROOF': '#424f58', + 'GLASS': '#86b3c0', 'BOOKSHELF': '#796340', 'WOOL': '#8d3d37', + 'STONE_STAIRS': '#b3aa94', 'WOOD_STAIRS': '#a08055', + 'ROOF_STAIRS': '#424f58', 'SLAB': '#a08055', + 'ROOF_SLAB': '#424f58', 'LANTERN': '#ffd68c', + 'PLASTER': '#e2dac2', 'PAVING': '#8d8a81', 'GARDEN': '#607d43', + 'TABLE_TOP': '#a08055', 'STONE_SLAB': '#b3aa94', +} + + +def boxes(kind, facing): + if kind.endswith('_STAIRS'): + upper = {'NORTH': (0, .5, 0, 1, 1, .5), + 'SOUTH': (0, .5, .5, 1, 1, 1), + 'EAST': (.5, .5, 0, 1, 1, 1), + 'WEST': (0, .5, 0, .5, 1, 1)}[facing] + return [(0, 0, 0, 1, .5, 1), upper] + if kind in ('SLAB', 'ROOF_SLAB', 'STONE_SLAB'): + return [(0, 0, 0, 1, .5, 1)] + if kind == 'TABLE_TOP': + return [(0, .5, 0, 1, 1, 1)] + if kind == 'LANTERN': + return [(.3, .15, .3, .7, .65, .7), (.45, .65, .45, .55, 1, .55)] + return [(0, 0, 0, 1, 1, 1)] + + +def rgb(hexcolor, light=1): + return tuple(min(255, int(int(hexcolor[i:i+2], 16)*light)) for i in (1, 3, 5)) + + +def font(size): + for name in ('DejaVuSans.ttf', 'C:/Windows/Fonts/arial.ttf'): + try: + return ImageFont.truetype(name, size) + except OSError: + pass + return ImageFont.load_default() + + +def render(args): + cells = [] + with open(args.input, encoding='utf-8') as source: + for row in csv.DictReader(source, delimiter='\t'): + x, y, z = (int(row[k]) for k in ('x', 'y', 'z')) + if row['kind'] == 'AIR' or y > args.cut_y: + continue + if args.crop and not (args.crop[0] <= x <= args.crop[2] and args.crop[1] <= z <= args.crop[3]): + continue + cells.append((x, y, z, row['kind'], row['facing'])) + if not cells: + raise ValueError('No blocks in selected view') + occupied = {(x, y, z): kind for x, y, z, kind, _ in cells} + sx, sz = (1, 1) if args.turn == 0 else (-1, -1) + angle = math.radians(args.elevation) + + def project(p): + x, y, z = p + if args.top: + return x, z + return (sx*x-sz*z)*.7071, (sx*x+sz*z)*.7071*math.sin(angle)-y*math.cos(angle) + + faces = [] + for x, y, z, kind, facing in cells: + color = COLORS[kind] + for x1, y1, z1, x2, y2, z2 in boxes(kind, facing): + x1 += x; x2 += x; y1 += y; y2 += y; z1 += z; z2 += z + candidates = [([(x1,y2,z1),(x2,y2,z1),(x2,y2,z2),(x1,y2,z2)], 1.10, (0,1,0))] + if not args.top: + xx = x2 if sx == 1 else x1 + zz = z2 if sz == 1 else z1 + candidates += [([(xx,y1,z1),(xx,y1,z2),(xx,y2,z2),(xx,y2,z1)], .72, (sx,0,0)), + ([(x1,y1,zz),(x2,y1,zz),(x2,y2,zz),(x1,y2,zz)], .9, (0,0,sz))] + for vertices, light, normal in candidates: + neighbor = occupied.get((x+normal[0], y+normal[1], z+normal[2])) + # Cull only complete outside cube faces. Partial stair/slab faces stay. + if kind not in ('SLAB','ROOF_SLAB','LANTERN','TABLE_TOP','STONE_SLAB') and not kind.endswith('_STAIRS'): + if neighbor and neighbor not in ('SLAB','ROOF_SLAB','LANTERN','TABLE_TOP','STONE_SLAB') and not neighbor.endswith('_STAIRS'): + continue + depth = sum((sx*v[0]+sz*v[2])*math.cos(angle)+v[1]*math.sin(angle)*1.4142 for v in vertices)/4 + if args.top: + depth = y2 + faces.append((depth, [project(v) for v in vertices], rgb(color, light))) + allpoints = [p for _, polygon, _ in faces for p in polygon] + minx = min(p[0] for p in allpoints); maxx = max(p[0] for p in allpoints) + miny = min(p[1] for p in allpoints); maxy = max(p[1] for p in allpoints) + width, height, margin, header = 1800, 1260, 80, 130 + scale = min((width-margin*2)/(maxx-minx), (height-header-margin*2)/(maxy-miny)) + offx = (width-(maxx-minx)*scale)/2 + offy = header+(height-header-(maxy-miny)*scale)/2 + image = Image.new('RGB', (width,height), '#eeeae2') + draw = ImageDraw.Draw(image) + for depth, polygon, color in sorted(faces, key=lambda f:f[0]): + points = [(offx+(p[0]-minx)*scale,offy+(p[1]-miny)*scale) for p in polygon] + if args.top and depth > 1: + color = tuple(int(c*.84) for c in color) + draw.polygon(points, fill=color) + if args.top: + draw.line(points+[points[0]], fill=tuple(int(c*.88) for c in color), width=1) + draw.text((55,30), args.title, font=font(34), fill='#242d31') + draw.text((55,82), 'CastleForge 0.3 | Generated block geometry | No Minecraft textures, lighting or physics', font=font(20), fill='#555d60') + draw.text((55,height-40), f'{len(cells):,} visible-plan cells | straight stair/slab primitives | seed/position: see adjacent evidence record', font=font(18), fill='#555d60') + Path(args.output).parent.mkdir(parents=True, exist_ok=True) + image.save(args.output) + print(f'{args.output}: {len(cells)} cells, {len(faces)} faces') + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('input'); parser.add_argument('output') + parser.add_argument('--title', default='Falkenwacht / reference geometry') + parser.add_argument('--turn', type=int, choices=(0,2), default=0) + parser.add_argument('--elevation', type=float, default=30) + parser.add_argument('--top', action='store_true') + parser.add_argument('--cut-y', type=int, default=10000) + parser.add_argument('--crop', nargs=4, type=int) + render(parser.parse_args()) diff --git a/scripts/verify-artifact.py b/scripts/verify-artifact.py new file mode 100644 index 0000000..da18bd5 --- /dev/null +++ b/scripts/verify-artifact.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +"""Validate the produced mod archive and record its actual SHA-256 (no game launch).""" +import hashlib +import json +import sys +import zipfile +from pathlib import Path + +artifact = Path(sys.argv[1]) +with zipfile.ZipFile(artifact) as archive: + names = set(archive.namelist()) + metadata = json.loads(archive.read('fabric.mod.json')) + assert metadata['id'] == 'castleforge', metadata + assert metadata['version'] == '0.3.0-alpha.3', metadata + assert metadata['environment'] == '*', metadata + assert '26.1.2' in str(metadata['depends']['minecraft']), metadata + for name in ('dev/castleforge/core/CastlePlanner.class', + 'dev/castleforge/core/TerracedCastlePlanner.class', + 'dev/castleforge/core/architecture/ReferenceCastlePlanner.class', + 'dev/castleforge/core/architecture/QualityChecks.class', + 'dev/castleforge/fabric/ReferencePalette.class'): + assert name in names, f'Missing runtime class: {name}' + assert not any(n.startswith('net/minecraft/') for n in names), 'Minecraft binaries must not be bundled' + assert not any(n.endswith('Verification.class') for n in names), 'Tests must not be bundled' +digest = hashlib.sha256(artifact.read_bytes()).hexdigest() +record = f'{digest} {artifact.name}\n' +Path('build').mkdir(exist_ok=True) +Path('build/JAR_SHA256.txt').write_text(record, encoding='utf-8') +print('PASS artifact metadata, runtime classes, asset boundaries') +print(record, end='') diff --git a/scripts/verify-core.ps1 b/scripts/verify-core.ps1 new file mode 100644 index 0000000..a8aabe3 --- /dev/null +++ b/scripts/verify-core.ps1 @@ -0,0 +1,18 @@ +param([string]$JdkBin = '', [switch]$ExportReference) +$ErrorActionPreference = 'Stop' +$projectRoot = Split-Path -Parent $PSScriptRoot +$outputRoot = Join-Path $projectRoot 'build/core-verification' +$compiler = if ($JdkBin) { Join-Path $JdkBin 'javac.exe' } else { 'javac' } +$runtime = if ($JdkBin) { Join-Path $JdkBin 'java.exe' } else { 'java' } +New-Item -ItemType Directory -Path $outputRoot -Force | Out-Null +$sourceFiles = Get-ChildItem -LiteralPath (Join-Path $projectRoot 'core/src/main/java'),(Join-Path $projectRoot 'core/src/test/java') -Filter '*.java' -Recurse | Select-Object -ExpandProperty FullName +& $compiler --release 21 -d $outputRoot $sourceFiles +if ($LASTEXITCODE -ne 0) { throw 'Core compilation failed.' } +foreach ($suite in 'CoreVerification','TerracedVerification','IdentityVerification','ReferenceVerification') { + & $runtime -Xmx512m -cp $outputRoot "dev.castleforge.core.$suite" + if ($LASTEXITCODE -ne 0) { throw "Verification failed: $suite" } +} +if ($ExportReference) { + & $runtime -Xmx512m -cp $outputRoot dev.castleforge.core.ReferenceExport (Join-Path $projectRoot 'build/reference') 20261020 + if ($LASTEXITCODE -ne 0) { throw 'Reference export failed.' } +} diff --git a/scripts/verify-core.sh b/scripts/verify-core.sh index e2bf004..ab6bd43 100755 --- a/scripts/verify-core.sh +++ b/scripts/verify-core.sh @@ -8,3 +8,5 @@ javac --release 21 -d "$output" @"$output/sources.txt" java -Xmx512m -cp "$output" dev.castleforge.core.CoreVerification java -Xmx512m -cp "$output" dev.castleforge.core.TerracedVerification java -Xmx512m -cp "$output" dev.castleforge.core.IdentityVerification +java -Xmx512m -cp "$output" dev.castleforge.core.ReferenceVerification +