Repository navigation
Feature/world composer - #149
Merged
Merged
Conversation
src/caffeine/world: WorldComposition parses and validates the graph text of a .generator.world recipe (seed, terrain, water, material, classes with biome terms and adapt, override edit layer); build() resolves every reference through a resolver, runs the scatter core over the baked terrain and applies the overrides, all-or-nothing. Class salts hash the class id, so reordering classes moves nothing. Scatter::Instance now carries its grid cell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WorldWater builds rivers from a follow mask (optional bed carving on a copy of the heightfield), lakes from a priority-flood basin fill under a level, and the water_distance mask from an integer chamfer transform. The build samples the ground context at every instance (slope, height, wetness, water distance, crowding read past the region border) and applies the class's adapt mappings to size, lean, tint and the wetness/snow modifiers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A session-free build: the caller passes the graph text, the baked terrain (heights and stored masks), the referenced recipes and a region, and reads back classes, instances with their ground context, water bodies, the water_distance mask and the carved heights through a handle. The engine crate wraps it as Engine::world_build / world_check. Tests on both sides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WorldInstanceFile writes and reads the versioned, little-endian .cinst format (classes, then instances in square chunks for per-chunk buffers); WorldCache stores bakes under their cache key, which now also covers the baked terrain, the masks and the instance budget. C ABI: write/read cinst, cache key and a cached build; Rust bindings and tests on both sides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A class may map the ground context onto up to four exposed parameters of its nature recipe; the build reports the values per instance, the .cinst bake and the C ABI carry them (with the class's parameter names), so the editor can bake a model per value set or, for a unique class, per instance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One entity with the World Instances component (Bake, Models, Draw distance, Cast shadows) draws every instance of a bake: a cache loads the .cinst and the models file once per change, whole chunks are culled by frustum and draw distance, and each visible instance becomes ordinary mesh draws that the existing instancing batches (tint quantised to keep batches large). Saved with the scene; pure logic in world/WorldInstanceDraw with tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…poser A nature graph can expose a node parameter by name (`expose <name> <node>.<param> [min max]`, backward compatible: graphs without it print as before). bake_nature_instance bakes with values for exposed parameters; the cache key folds them in (sorted, bit-exact) and equals the plain variant key when there are none. quantize_param buckets values into a small pool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…errides recipe::Kind::World opens *.generator.world in a new World tab (Library, Composition, Rules, status). Build resolves every reference, bakes the terrain recipe, builds through the engine's bake cache and places the result: small worlds as one entity per instance with baked nature parts, large ones as a .cinst + models file on a World Instances entity; parameter-driven and unique classes bake through bake_nature_instance. Save as prefab keeps the link to the recipe; remove-in-region writes override lines. UiIds, MCP actions (world_*), tests and a headless flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orld test A remove brush in the Viewport writes override remove lines per stroke (one undo step); Library recipes drag onto the Composition; lakes are placed as water entities with their recipe's look; carved terrain is applied also when the bake cache answers; the small-world threshold is a tab field and the large-world path (.cinst + models + World Instances) is tested. The world fixture joins the headless reference; scripts/capture-world-docs.sh makes the doc captures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th borrow The Composition column now has a Graph card (node_canvas) wiring Terrain, Water, Material and Class building blocks into a World output node, so the composition reads as a node graph of generators feeding one result instead of a flat list. Click a class node to select it (drives the existing Rules panel); drag to rearrange (layout only, not saved with the recipe). The underlying .generator.world format and C ABI are unchanged. Also fixes an E0499 in recipe_ref::nature_variants_with: Option::as_deref_mut() ties its output lifetime to the &mut self borrow instead of reborrowing the trait object, so each loop iteration held onto the previous one (NLL 'problem case #3'). Reborrow explicitly instead.
- 'Doppio' nav group merges editor + doppio + plugins (the generator guides and World Composer were previously unlisted and fell into 'Project'). - 'Engine' group absorbs 'assets' and renames 'ui' to 'runtime-ui'. - New 'Ecosystem' group for the other Caffeine repositories. - ~30 dead doppio/docs/* links fixed across README/HISTORY/MASTER/editor pages (EN+PT); world-composition.md documents the new Graph view.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.