mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 08:14:45 +00:00
Purpose seeds follow one rule; unknown noise styles fail
PackWorld.seed(purpose) is a default method, WorldRandom.purposeSeed of the world seed, for every host and purpose: the exception that let a host answer its own built-ins with older seeds is gone. An unknown style name or a missing expression now fails like a missing image map, instead of sampling flat or falling back to the base style.
This commit is contained in:
1 parent
264f754297
commit
e8fca6d8c6
9 files changed
+17
-32
No files matched your search
+4
-4
@@ -217,8 +217,8 @@ running Iris is the pack publisher's responsibility.
|
||||
(`InvocationContext.world()`), to service calls and to hooks. Use `WorldStates` (or the same rules) for its store.
|
||||
A placement a tool makes outside those worlds (a studio paste) gets a `PackWorld` of its own: the pack's resources
|
||||
and settings, a seed the host picks, a store closed when the placement ends, and no hooks. `world()` never throws.
|
||||
- Answer `PackWorld.seed(purpose)` with `WorldRandom.purposeSeed(seed(), purpose)`, except for ids of your own built-ins
|
||||
whose existing worlds depend on other seeds; the same world and purpose always get the same seed.
|
||||
- Don't override `PackWorld.seed(purpose)`: its default, `WorldRandom.purposeSeed(seed(), purpose)`, is the rule for
|
||||
every purpose, the host's own built-ins included.
|
||||
- Answer `PackWorld.running()` for a world the host runs, empty for a tool's world. Its `layout()` covers every column of
|
||||
the world (not one chunk), with the same values chunk stages read; its `settings()` are the settings at a column and a
|
||||
biome's declarations as chunk stages see them; `highest` is the platform's highest block now; `caveFloors` are
|
||||
@@ -259,8 +259,8 @@ running Iris is the pack publisher's responsibility.
|
||||
(`EXPRESSIONS`, `IMAGE_MAPS` among them);
|
||||
rendering a value type with the host's own description of the same JSON is allowed.
|
||||
- Serve `PackResources.noise()`: build each style's noise from the host's generators, expressions and image maps,
|
||||
the same values for the same style and seed, cached per pack snapshot; an unknown style name is flat, a missing
|
||||
expression falls back to the base style, and a missing image map fails.
|
||||
the same values for the same style and seed, cached per pack snapshot; an unknown style name, a missing expression and a
|
||||
missing image map fail.
|
||||
Answer `NoiseSampler.signed(...)` with the generator's own signed read (and its per-thread coordinate memo) when it
|
||||
has one; the default is `sample * 2 - 1`.
|
||||
Answer `NoiseSampler.scaled(factor)` by building the generator again with the factor folded into its scale, leaving the sampler it
|
||||
|
||||
@@ -938,7 +938,8 @@ Why these lines:
|
||||
of one field again and again, so the memo is the difference between caves that cost what they always did and caves that
|
||||
do not. A default method (`sample * 2 - 1`) keeps every other sampler valid.
|
||||
- **Style names are text with `@Ref(NOISE_STYLE)`**, not an enum: the host owns the list, and an API enum would
|
||||
pin it. An unknown name samples flat, as Iris has always read one.
|
||||
pin it. An unknown name fails when the noise is built, as a missing expression or image map does: a silent
|
||||
flat noise hides the pack's typo.
|
||||
- **`isFlat()` is stricter than Iris's**: a flat base style with an expression or image map is not flat.
|
||||
- **Block properties are text.** `{"waterlogged": true}` decodes to `"true"`, which is what the platform's state
|
||||
key holds; the host's studio description may accept the JSON types it accepted before.
|
||||
|
||||
@@ -148,9 +148,8 @@ stage uses its own stream within one invocation and must not share or keep it.
|
||||
|
||||
A module's own world-wide randoms and noise take `world.seed(purpose)`, the seed the world gives a purpose id such as
|
||||
`example:moss/patches`: the same for the same world and purpose, independent across purposes, so two modules never
|
||||
mix the world seed into the same value by hand. Hosts answer `WorldRandom.purposeSeed(world.seed(), purpose)`, pinned
|
||||
like every other `WorldRandom` value; Iris answers its built-ins' `iris:seed/*` purposes with the seeds its worlds
|
||||
always had.
|
||||
mix the world seed into the same value by hand. It is `WorldRandom.purposeSeed(world.seed(), purpose)` for every
|
||||
purpose and host (a default method of `PackWorld`), pinned like every other `WorldRandom` value.
|
||||
|
||||
## The mantle pipeline and reach
|
||||
|
||||
|
||||
@@ -13,9 +13,8 @@ public interface NoiseFactory {
|
||||
* <p>A style with its own seed ({@link NoiseStyle#seed()}) ignores {@code seed}: the host rolls it from that number
|
||||
* and the seed of the world the pack generates, so every reader of the same seeded style gets the same noise.
|
||||
*
|
||||
* <p>A style name the host does not know samples as {@link NoiseStyle#FLAT}, and an expression the pack does not
|
||||
* have falls back to the base style, as packs have always been read. An image map the pack does not have, or cannot
|
||||
* use as noise, throws {@link IllegalArgumentException}.
|
||||
* <p>A style name the host does not know, an expression the pack does not have, and an image map the pack does not
|
||||
* have or cannot use as noise throw {@link IllegalArgumentException}.
|
||||
*/
|
||||
NoiseSampler sampler(NoiseStyle style, long seed);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public final class NoiseStyle {
|
||||
public static final String FLAT = "FLAT";
|
||||
|
||||
@Ref(Reference.NOISE_STYLE)
|
||||
@Desc("The noise generator. Used when neither expression nor imageMap is set, and when an expression fails.")
|
||||
@Desc("The noise generator. Used when neither expression nor imageMap is set.")
|
||||
private String style = FLAT;
|
||||
|
||||
@Desc("Above 0, the noise is turned into cells of this frequency.")
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.volmit.world;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.placement.Placements;
|
||||
import com.volmit.random.WorldRandom;
|
||||
import com.volmit.resource.PackResources;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import java.util.Optional;
|
||||
@@ -30,11 +31,12 @@ public interface PackWorld {
|
||||
/**
|
||||
* The seed this world gives {@code purpose}, such as {@code example:moss/patches}: the same for the same world and
|
||||
* purpose, independent across purposes. Seed a module's own randoms and noise with it instead of mixing
|
||||
* {@link #seed()} by hand. A host answers {@link com.volmit.random.WorldRandom#purposeSeed} of the world's seed,
|
||||
* except for purposes of its own modules whose worlds already depend on other seeds: Iris answers the ids of
|
||||
* {@code iris:} purposes its built-in modules use with the seeds its worlds always had.
|
||||
* {@link #seed()} by hand. It is {@link com.volmit.random.WorldRandom#purposeSeed} of the world's seed, for every
|
||||
* purpose and every host.
|
||||
*/
|
||||
long seed(ResourceId purpose);
|
||||
default long seed(ResourceId purpose) {
|
||||
return WorldRandom.purposeSeed(seed(), purpose);
|
||||
}
|
||||
|
||||
/** The pack snapshot this world generates with. */
|
||||
PackResources resources();
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.placement.Placements;
|
||||
import com.volmit.resource.PackResources;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
import com.volmit.world.RunningWorld;
|
||||
import java.util.Objects;
|
||||
@@ -37,11 +36,6 @@ final class ModuleWorld implements PackWorld {
|
||||
return world.seed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long seed(ResourceId purpose) {
|
||||
return world.seed(purpose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackResources resources() {
|
||||
return world.resources();
|
||||
|
||||
@@ -11,9 +11,7 @@ import com.volmit.generation.GenerationContext;
|
||||
import com.volmit.hunk.Hunk;
|
||||
import com.volmit.mantle.Mantle;
|
||||
import com.volmit.placement.Placements;
|
||||
import com.volmit.random.WorldRandom;
|
||||
import com.volmit.resource.PackResources;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.stage.Pipeline;
|
||||
import com.volmit.stage.Stage;
|
||||
import com.volmit.support.TestContexts;
|
||||
@@ -84,7 +82,6 @@ class ExtensionsTest {
|
||||
}
|
||||
|
||||
public long seed() { return TestContexts.SEED; }
|
||||
public long seed(ResourceId purpose) { return WorldRandom.purposeSeed(seed(), purpose); }
|
||||
public PackResources resources() { throw new AssertionError("Unused resources"); }
|
||||
public PackSettings settings() { throw new AssertionError("Unused settings"); }
|
||||
public int minWorldY() { return 0; }
|
||||
|
||||
@@ -6,10 +6,8 @@ import com.volmit.config.PackSettings;
|
||||
import com.volmit.config.SettingsStack;
|
||||
import com.volmit.host.ModuleLogs;
|
||||
import com.volmit.host.WorldStates;
|
||||
import com.volmit.random.WorldRandom;
|
||||
import com.volmit.placement.Placements;
|
||||
import com.volmit.resource.PackResources;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
import com.volmit.world.RunningWorld;
|
||||
import java.util.Optional;
|
||||
@@ -34,11 +32,6 @@ public final class TestWorld implements PackWorld, AutoCloseable {
|
||||
return TestContexts.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long seed(ResourceId purpose) {
|
||||
return WorldRandom.purposeSeed(seed(), purpose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackResources resources() {
|
||||
throw new AssertionError("Unused resources");
|
||||
|
||||
Reference in new issue
Block a user