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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 39 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,84 @@
Terrain-aware procedural castles and independent culture regions for Minecraft.
Original idea: Emre's brother. Concept and project direction: Emre (`badmon61`).

## Status: 0.1.0-alpha.1 — manual prototype
## Status: 0.2.0-alpha.1 — opt-in terraced architecture

**Use disposable test worlds only. This is not the finished world-generation mod.**
The first milestone provides real generator code and a Fabric adapter, not the final visual quality, mountain planning, population system or giant fantasy monuments.
**Disposable test worlds only. No automatic world generation and no completed in-game acceptance test.**

### Implemented
The original small castle remains available. A new, separate planner adds an asymmetric reference complex with three individually elevated courtyards, eight building modules, terrain-oriented placement, stairs and short supported bridges. This is an engineering alpha, not the final visual quality or an unrestricted mountain/monument generator.

- Deterministic, jittered Voronoi culture regions with eight stable culture IDs.
- Default culture scale: **7 × a configured linear biome reference**. The fallback reference is 1,024 blocks, giving 7,168-block nominal site spacing. These are design defaults, **not measured vanilla biome dimensions**, fixed region diameters or seven-biome counts.
- Generation version and scale captured per save; subsequent changes to global defaults do not rescale an existing save.
- One procedural prototype castle family with dimension/height variations, four towers, curtain walls, wall walks, a raised keep, interior floors, windows, ladders and an entrance ramp.
- Restored, weathered and ruined states; cultural vanilla-block palettes and a basic sandy-ground adaptation. Eight palettes do **not** yet mean eight different architectural grammars.
- Dry, already-loaded terrain sampling; limited foundations on gentle slopes; unsuitable sites rejected rather than carved through mountains.
- Operator-only textual preview, explicit placement confirmation, bounded build work, cancel and conflict-aware in-memory undo.
- Independent Java core verification across 50 castle seeds.
### New in this branch

### Not implemented yet
- Three offset, chamfered enclosures: outer bailey, residential court and upper keep; foundations are calculated per terrace rather than flattening the entire site to one height.
- Eight modules: service hall, outer tower, great hall, gallery/workshop, keep, two upper towers and gatehouse. Layout dimensions, offsets, heights, orientation, roofs and condition vary deterministically.
- Four roof forms: gable, hip, spire and battlement. Some choices depend on culture; these are **not eight complete independent architectural grammars**.
- Ground-aware stair connections and short beam/pier bridge sections. Unsuitable slopes, obstacles and excessive support depths are rejected before any block placement.
- Room/storey targets, four wall-walk targets per courtyard and a protected entrance corridor. A conservative navigation check rejects inaccessible plans.
- Ordered structural placement before rotated ladders. Preview confirmation now rechecks unchanged air/doorway cells and sampled ground as well as the write set. Undo tolerates automatic stair-shape updates, but not changed stair material, facing, half or waterlogging.
- Module construction-phase metadata and coherent weathering patches. This is the foundation for construction history, **not a simulation of centuries or structural collapse**.

Automatic generation during exploration; automatic biome-scale detection; full terrain terraces and bridges; huge castles and monuments; inhabitants and loot; cultural architecture blending; roads and settlements; Bedrock, consoles and NeoForge. No modpack compatibility or FPS guarantees.
### Retained

## First test
Deterministic culture geography, eight stable culture IDs, and **7 × the configured linear biome reference**. The default reference is 1,024 blocks, resulting in 7,168-block nominal region-site spacing. It is not a measured vanilla biome size or a fixed region diameter. Per-save generation settings and the classic planner are unchanged.

Runtime target: **Minecraft Java 26.1.2**, **Java 25**, **Fabric Loader 0.19.5+**, **Fabric API 0.155.3+26.1.2**.
### Still outside this milestone

1. Create a separate Prism/Fabric test instance. Do not install this first alpha into a valuable survival world.
2. Get the `castleforge-fabric-26.1.2` artifact from a successful GitHub Actions run. Install `castleforge-fabric-0.1.0-alpha.1.jar` and Fabric API; **do not install the `-sources.jar`**.
3. Create a new Creative superflat world with commands enabled. Remain near the site while building or undoing.
4. Run these separately:
Automatic exploration-time generation; automatically measured biome scaling; arbitrary contour-following castle grammars; giant monuments; inhabitants, loot and furnishing; roads/settlements; Bedrock, consoles and NeoForge. No general modpack compatibility, FPS or runtime-physics guarantee.

## Test installation

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.0-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.
4. Execute separately:

```mcfunction
/castleforge region
/castleforge preview
/castleforge preview terraced
/castleforge build confirm
/castleforge status
```

Without coordinates, preview selects a site 28 blocks north of you. It only prints a report; it is not a ghost-block visual preview. Confirmation expires after 120 seconds. Explicit coordinates are supported with `/castleforge preview <x> <z>`.
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 <x> <z>`. Preview is a **text report**, not a visual ghost building. Confirmation expires after 120 seconds. Stay near the entire build area.

The original generator is still selected by `/castleforge preview` or `/castleforge preview <x> <z>`; its default centre remains 28 blocks north of you.

```mcfunction
/castleforge cancel
/castleforge undo
```

Cancel stops future edits; **it does not immediately remove the partial building**. Undo operates on the last build by that operator, in the current server session, skipping blocks subsequently changed by someone else. Starting another build replaces the old undo history. Closing the world, stopping or crashing the server loses undo. Physics side effects are not comprehensively journaled. **Undo is not a backup.**
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 Minecraft moderator permission / enabled cheats. No chunks are force-loaded. There is no automatic placement on world load.
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.

## Configuration
## Generation settings

Optionally copy `config/castleforge.example.properties` to the instance's `config/castleforge.properties` **before first use in a new save**. The chosen generation values are stored in `<world>/castleforge/generation-v1.properties`. Do not edit or delete that file on a world you intend to preserve. Unknown algorithm versions fail closed.
Optionally copy `config/castleforge.example.properties` to the instance's `config/castleforge.properties` before first use in a new save. Settings are captured in `<world>/castleforge/generation-v1.properties`. Do not alter/delete this file on a world you intend to preserve. This architecture change does not rescale or reshuffle culture regions.

## Build
## Build and verification

Install JDK 25 and Gradle **9.4.0**, then:
Use JDK 25 and Gradle 9.4.0:

```sh
gradle --no-daemon build
gradle :fabric:runClient
```

A Gradle wrapper is not yet checked in; the CI explicitly installs the pinned Gradle release. The core itself targets Java 21 and has no Minecraft dependency. Its offline verification can run with JDK 21+:
The CI uses pinned Gradle; a Gradle wrapper is not yet checked in. Pure generator tests also run with JDK 21+:

```sh
bash scripts/verify-core.sh
```

See [architecture](docs/ARCHITECTURE.md), [test checklist](docs/TESTING.md), [validation record](docs/VALIDATION.md), and [roadmap](docs/ROADMAP.md).
The classic suite checks 50 seeds. 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).

## Licensing

A redistribution license has not been selected. Do not assume that public visibility grants open-source redistribution rights. No Mojang binaries, third-party schematics or texture assets are included.
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.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}
allprojects {
group = 'dev.castleforge'
version = '0.1.0-alpha.1'
version = '0.2.0-alpha.1'
repositories { mavenCentral() }
}
tasks.named('build') { dependsOn ':core:build', ':fabric:build' }
11 changes: 9 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
plugins { id 'java-library' }
java { toolchain { languageVersion = JavaLanguageVersion.of(25) } }
tasks.withType(JavaCompile).configureEach { options.release = 21 }
// Tests deliberately use no external framework: also runnable offline with javac/java 21.
// Dependency-free suites also run offline with javac/java 21.
tasks.named('test') { enabled = false }
tasks.register('verifyCore', JavaExec) {
dependsOn testClasses
classpath = sourceSets.test.runtimeClasspath
mainClass = 'dev.castleforge.core.CoreVerification'
maxHeapSize = '512m'
}
tasks.named('check') { dependsOn verifyCore }
tasks.register('verifyTerraces', JavaExec) {
dependsOn testClasses
classpath = sourceSets.test.runtimeClasspath
mainClass = 'dev.castleforge.core.TerracedVerification'
maxHeapSize = '512m'
mustRunAfter verifyCore
}
tasks.named('check') { dependsOn verifyCore, verifyTerraces }
71 changes: 71 additions & 0 deletions core/src/main/java/dev/castleforge/core/PlanNavigation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package dev.castleforge.core;

import java.util.*;
import static dev.castleforge.core.CastlePlanner.Pos;
import static dev.castleforge.core.TerracedCastlePlanner.*;

/** Conservative full-cube walking model, NOT Minecraft physics/entity pathfinding. */
public final class PlanNavigation {
private static final int MAX_VISITED=100_000;
public record Result(int reached,int targets) {}
public static Result verify(Plan plan,Ground ground) {
Map<Pos,Block> blocks=new HashMap<>();
for(Block block:plan.blocks()) {
if(blocks.put(block.pos(),block)!=null) throw new IllegalArgumentException("Duplicate planned position");
if(block.pos().y()<ground.surfaceY(block.pos().x(),block.pos().z()))
throw new IllegalArgumentException("Planned excavation");
}
Space space=new Space(plan,ground,blocks);
for(Block block:plan.blocks()) if(block.kind()==Kind.LADDER) {
Pos p=block.pos(); Facing d=block.facing();
if(space.clear(new Pos(p.x()-d.dx,p.y(),p.z()-d.dz)))
throw new IllegalArgumentException("Unsupported ladder at "+p);
}
if(!space.stand(plan.entrance())) throw new IllegalArgumentException("Entrance is not walkable");
Set<Pos> remaining=new HashSet<>();
for(Target target:plan.targets()) {
if(!space.stand(target.feet())) throw new IllegalArgumentException("Blocked room target: "+target.id()+" at "+target.feet());
remaining.add(target.feet());
}
ArrayDeque<Pos> todo=new ArrayDeque<>(); Set<Pos> seen=new HashSet<>();
todo.add(plan.entrance()); seen.add(plan.entrance()); remaining.remove(plan.entrance());
while(!todo.isEmpty() && !remaining.isEmpty()) {
Pos p=todo.removeFirst();
for(Facing d:Facing.values()) for(int dy=-1;dy<=1;dy++) {
Pos next=new Pos(p.x()+d.dx,p.y()+dy,p.z()+d.dz);
if(dy>0 && !space.clear(new Pos(p.x(),p.y()+2,p.z()))) continue;
if(dy<0 && !space.clear(new Pos(next.x(),next.y()+2,next.z()))) continue;
visit(space,next,todo,seen,remaining);
}
if(space.ladder(p) || space.ladder(new Pos(p.x(),p.y()-1,p.z())))
for(int dy:new int[]{-1,1}) visit(space,new Pos(p.x(),p.y()+dy,p.z()),todo,seen,remaining);
if(seen.size()>MAX_VISITED) throw new IllegalArgumentException("Navigation budget exceeded");
}
if(!remaining.isEmpty()) {
String names=plan.targets().stream().filter(t->remaining.contains(t.feet())).map(Target::id).toList().toString();
throw new IllegalArgumentException("Unreachable architecture targets: "+names);
}
return new Result(seen.size(),plan.targets().size());
}
private static void visit(Space s,Pos p,ArrayDeque<Pos> todo,Set<Pos> seen,Set<Pos> remaining) {
if(s.inBounds(p) && !seen.contains(p) && s.stand(p)) { seen.add(p); todo.add(p); remaining.remove(p); }
}
private record Space(Plan plan,Ground ground,Map<Pos,Block> blocks) {
boolean inBounds(Pos p) {
return Math.abs((long)p.x()-plan.originX())<=RADIUS && Math.abs((long)p.z()-plan.originZ())<=RADIUS
&& p.y()>=-1024 && p.y()<=4200;
}
Kind kind(Pos p) {
Block block=blocks.get(p); if(block!=null) return block.kind();
int h=ground.surfaceY(p.x(),p.z());
return h==UNUSABLE || p.y()<h?Kind.FOUNDATION:Kind.AIR;
}
boolean clear(Pos p) { Kind k=kind(p); return k==Kind.AIR || k==Kind.LADDER; }
boolean ladder(Pos p) { return kind(p)==Kind.LADDER; }
boolean stand(Pos p) {
Pos below=new Pos(p.x(),p.y()-1,p.z());
return clear(p) && clear(new Pos(p.x(),p.y()+1,p.z())) && (!clear(below)||ladder(p)||ladder(below));
}
}
private PlanNavigation() {}
}
Loading
Loading