Skip to content

World Generation Overview

The World Generation system creates terrain, structures, and biomes for Hytale worlds. It uses a procedural generation pipeline with zones, biomes, caves, and prefabs.

  • Providers: com.hypixel.hytale.server.core.universe.world.worldgen.provider
  • Hytale generator: com.hypixel.hytale.server.worldgen
  • Generated chunks: com.hypixel.hytale.server.core.universe.world.worldgen
  • Procedural generator: com.hypixel.hytale.builtin.hytalegenerator
  • WorldGen modifiers: com.hypixel.hytale.builtin.worldgen.modifier
flowchart TB
    subgraph WorldGen["World Generation"]
        subgraph Provider["HytaleWorldGenProvider"]
            subgraph ChunkGen["ChunkGenerator"]
                ZonePattern["ZonePattern<br/>Generator"]
                BiomePattern["BiomePattern<br/>Generator"]
                CaveGen["CaveGenerator"]
                Heightmap["Heightmap<br/>Generator"]
                Prefab["Prefab<br/>Generator"]
                Populator
            end
        end
    end
public interface IWorldGenProvider {
IWorldGen getGenerator() throws WorldGenLoadException;
}

The default world generation provider for Hytale:

public class HytaleWorldGenProvider implements IWorldGenProvider {
public static final String ID = "Hytale";
// Configuration
String name = "Default"; // Generator name
String path; // Custom path (optional)
}
{
"WorldGen": {
"Type": "Hytale",
"Name": "MyWorldGen",
"Path": "path/to/worldgen/config"
}
}
ProviderDescription
HytaleWorldGenProviderFull procedural terrain (in server.worldgen package)
FlatWorldGenProviderFlat terrain
VoidWorldGenProviderEmpty void world
DummyWorldGenProviderNo generation
HandleProviderCustom handle-based generator (in builtin.hytalegenerator)

The core class that generates chunks:

public class ChunkGenerator implements IBenchmarkableWorldGen, IWorldMapProvider {
// Pool size based on CPU cores
public static final int POOL_SIZE = Math.max(2,
(int) Math.ceil(Runtime.getRuntime().availableProcessors() * 0.75));
// Get zone data at coordinates
public ZoneBiomeResult getZoneBiomeResultAt(int seed, int x, int z);
// Get height at coordinates
public int getHeight(int seed, int x, int z);
// Get cave data
public Cave getCave(CaveType caveType, int seed, int x, int z);
// Get spawn points
public Transform[] getSpawnPoints(int seed);
}

The StagedChunkGenerator at com.hypixel.hytale.builtin.hytalegenerator.engine.chunkgenerator manages chunk generation through a pipeline of Stage implementations:

StageDescription
BiomeStageDetermines biome at each position
BiomeDistanceStageCalculates distance to biome edges
TerrainStageGenerates terrain density and block placement
PropStagePlaces props and decorations
EnvironmentStageApplies environment settings
TintStageApplies block tinting

Each stage implements Stage with run(Context), getInputTypesAndBounds_bufferGrid(), getOutputTypes(), and getName().

  1. Zone Generation: Determine zone at position
  2. Biome Generation: Determine biome within zone
  3. Heightmap: Generate terrain height
  4. Block Placement: Place blocks based on layers
  5. Cave Carving: Carve caves and caverns
  6. Prefab Placement: Place structures
  7. Population: Add details (ores, plants, etc.)

Zones are large-scale regions of the world with distinct generation rules.

public record Zone(
int id,
String name,
ZoneDiscoveryConfig discoveryConfig,
CaveGenerator caveGenerator,
BiomePatternGenerator biomePatternGenerator,
UniquePrefabContainer uniquePrefabContainer
) {}
{
"Id": 1,
"Name": "Plains",
"DiscoveryConfig": {
"DiscoverKey": "zone_plains",
"DiscoverRadius": 100
},
"CaveGenerator": "DefaultCaves",
"BiomePattern": "plains_biomes.png"
}

Generates zone layout based on patterns:

public class ZonePatternProvider {
// Zone pattern generation
}
public class ZonePatternGenerator {
// Generate zone at coordinates
}

Biomes define terrain characteristics within zones.

public abstract class Biome {
int id;
String name;
BiomeInterpolation interpolation;
IHeightThresholdInterpreter heightmapInterpreter;
// Containers
CoverContainer coverContainer; // Surface cover (grass, etc.)
LayerContainer layerContainer; // Block layers
PrefabContainer prefabContainer; // Structures
TintContainer tintContainer; // Color tinting
EnvironmentContainer environmentContainer; // Environment settings
WaterContainer waterContainer; // Water features
FadeContainer fadeContainer; // Biome transitions
// Noise
NoiseProperty heightmapNoise;
// Visual
int mapColor;
}
ContainerDescription
CoverContainerSurface blocks (grass, snow)
LayerContainerBlock layer definitions
PrefabContainerStructure placement
TintContainerBlock tinting rules
EnvironmentContainerEnvironment settings
WaterContainerWater/fluid settings
FadeContainerTransition rules

Defines block layers from surface to bedrock:

{
"Layers": [
{
"Block": "Grass",
"Depth": 1
},
{
"Block": "Dirt",
"Depth": 3
},
{
"Block": "Stone",
"Depth": -1
}
]
}
public class CaveGenerator {
// Generate caves for a region
}
public enum CaveType {
// Cave type definitions
}
public class Cave {
// Cave data
}
{
"CaveType": "Standard",
"Frequency": 0.5,
"MinHeight": 10,
"MaxHeight": 64,
"Radius": {
"Min": 2,
"Max": 5
}
}

Prefabs are pre-built structures placed during generation.

public class PrefabContainer {
// Prefab placement rules
}
public class PrefabLoadingCache {
// Cache for loaded prefabs
}
{
"Prefabs": [
{
"Id": "Village_House",
"Chance": 0.1,
"MinDistance": 100,
"GroundLevel": "Surface"
}
]
}

Special one-per-world prefabs:

public class UniquePrefabContainer {
// Unique prefab management
public static class UniquePrefabEntry {
boolean isSpawnLocation();
Vector3i getPosition();
Vector3d getSpawnOffset();
Rotation getRotation();
}
}

Props are decorative elements placed during world generation.

public abstract class Prop {
public abstract boolean generate(Prop.Context context);
public abstract Bounds3i getReadBounds_voxelGrid();
public abstract Bounds3i getWriteBounds_voxelGrid();
public static class Context {
public Vector3i position;
public VoxelSpace<Material> materialReadSpace;
public VoxelSpace<Material> materialWriteSpace;
public EntityFunnel entityWriteBuffer;
public double distanceToBiomeEdge;
}
}
PropDescription
CuboidPropCuboid generation
DensityPropDensity-based block placement (rewritten in v4)
DensitySelectorPropDensity-based prop selection
EmptyPropNo-op singleton (EmptyProp.INSTANCE)
LocatorPropLocator-based placement
ManualPropManual block placement
MaskPropMasking support
OffsetPropPosition offset applied to child prop
OrienterPropOrientation handling
PrefabPropPrefab structure placement
PondFillerPropPond filling
QueuePropQueued prop execution
StaticRotatorPropStatic rotation
UnionPropUnion of multiple props
WeightedPropWeight-based random selection

Selects a child prop randomly based on weight probability:

public class WeightedProp extends Prop {
private final WeightedMap<Prop> props;
}

Configuration:

Weighted prop example
{
"Type": "Weighted",
"Entries": [
{ "Prop": "Tree_Oak_Large", "Weight": 0.1 },
{ "Prop": "Tree_Oak_Medium", "Weight": 0.3 },
{ "Prop": "Tree_Oak_Small", "Weight": 0.6 }
]
}
FieldTypeDescription
EntriesarrayList of weighted prop entries
Entries[].PropstringProp ID to place
Entries[].WeightfloatRelative weight (higher = more likely)

Use Cases:

  • Varied tree sizes (mostly small, occasionally large)
  • Rock formations with random sizes
  • Flower variety in meadows

Applies a position offset to a child prop:

public class OffsetProp extends Prop {
private final Vector3i offset;
private final Prop childProp;
}

Configuration:

Offset prop example
{
"Type": "Offset",
"Prop": "Mushroom_Cluster",
"Offset": { "X": 0, "Y": -1, "Z": 0 }
}
FieldTypeDescription
PropstringChild prop ID
OffsetVector3iPosition offset to apply

Use Cases:

  • Partially buried objects
  • Floating elements (vines, hanging plants)
  • Stacked prop combinations

Provides horizontal positions for prop placement:

public class SimpleHorizontalPositionProvider implements PositionProvider {
// Generates horizontal positions within a region
}

Configuration:

Position provider example
{
"Type": "SimpleHorizontal",
"Density": 0.1,
"MinSpacing": 2.0,
"MaxSpacing": 8.0
}

Scanners find valid positions for prop placement within a region.

public abstract class Scanner {
@Deprecated
public abstract void scan(Scanner.Context context);
public abstract void scan(Vector3i position, Pipe.One<Vector3i> pipe);
public abstract Bounds3i getBounds_voxelGrid();
public Bounds3i getBoundsWithPattern_voxelGrid(Pattern pattern);
}
ScannerDescription
DirectScannerDirect position scanning (replaces OriginScanner)
EmptyScannerNo-op singleton
LinearScannerLinear scanning pattern
QueueScannerQueue-based scanning
RadialScannerRadial scanning pattern
RandomScannerRandom position scanning

Position providers generate candidate positions for prop distribution.

public abstract class PositionProvider {
public abstract void generate(PositionProvider.Context context);
public static class Context {
public Bounds3d bounds;
public Pipe.One<Vector3d> pipe;
public Vector3d anchor;
}
}
public class Pipe {
@FunctionalInterface
public interface One<Input> {
void accept(Input input, Control control);
}
@FunctionalInterface
public interface Two<InputA, InputB> {
void accept(InputA a, InputB b, Control control);
}
}
public class Control {
public boolean stop = false;
public void reset();
}

Setting control.stop = true within a pipe callback signals the caller to stop iterating, allowing early termination of position or prop generation.

Prop distributions manage how props are selected and positioned within biomes.

DistributionDescription
AssignedPropDistributionDistribution with prop assignments
ConstantPropDistributionConstant prop distribution
NoPropDistributionNo-op distribution
PositionsPropDistributionPosition-based distribution
UnionPropDistributionUnion of multiple distributions
public interface VoxelSpace<T> {
void set(T value, int x, int y, int z);
void set(T value, Vector3i pos);
void setAll(T value);
T get(int x, int y, int z);
T get(Vector3i pos);
Bounds3i getBounds();
}
ImplementationDescription
ArrayVoxelSpaceArray-backed storage
MaskVoxelSpaceBoolean mask (replaces BooleanVoxelSpace)
NullSpaceNull-pattern implementation
RotationVoxelSpaceRotation-aware access
WindowVoxelSpaceWindowed view into another space

The RNG system at com.hypixel.hytale.builtin.hytalegenerator.rng provides deterministic random number generation for world generation.

ClassDescription
RngStatic utility with getRandomInt(seed, key), mix(seed, a, b), splitMixLong(n)
RngFieldPosition-seeded RNG field with get(x, y, z) and get(x, y)
SeedBoxSeed container (relocated from seed/)

Modifiers target specific world-gen configurations and apply operations (add/remove) to biome and cave content lists. This allows plugins to inject or remove biome covers, layers, prefabs, tints, cave types, and more.

public class WorldGenModifier {
protected String id;
protected EventPriority priority;
protected Target target;
protected Map<EventType, Op[]> content;
}
FieldTypeDescription
PriorityEventPriorityOrder relative to other modifiers
TargetTargetWhich world-gen configuration to modify
ContentMap<EventType, Op[]>Operations to apply per event type
public class Target {
private String root = "Default";
private String[] rules;
}
  • Root: the world-gen root configuration folder name to target
  • Rules: glob patterns to match asset file paths within the root
Event TypeDescription
Biome_CoversSurface cover blocks
Biome_EnvironmentsEnvironment settings
Biome_FluidsFluid configurations
Biome_Dynamic_LayersDynamic block layers
Biome_Static_LayersStatic block layers
Biome_PrefabsStructure placement
Biome_TintsBlock tinting
Cave_TypesCave type definitions
Cave_CoversCave surface covers
Cave_PrefabsCave structure placement

Two built-in operations are available:

  • Add: adds content to the target list via a Content reference (file path or inline JSON)
  • Remove: removes entries matching glob Rules. Supports "*" to clear all entries. Glob matching is implemented for prefab paths and cave type names.
WorldGen modifier example
{
"Priority": "NORMAL",
"Target": {
"Root": "Default",
"Rules": ["Biomes/Plains/*"]
},
"Content": {
"Biome_Prefabs": [
{
"Operation": "Add",
"Content": {
"Type": "File",
"Path": "MyPlugin.Prefabs.CustomTree"
}
}
]
}
}

The EventHandler is scoped per thread and acquired for a root configuration path. It collects all matching modifiers, sorts them by priority and asset pack order, and dispatches operations against ModifyEvent instances during asset loading.

Populators add details after basic terrain is generated.

PopulatorDescription
BlockPopulatorPlace additional blocks
CavePopulatorCarve caves
WaterPopulatorAdd water features
PrefabPopulatorPlace structures
public interface IPopulator {
void populate(GeneratedChunk chunk, Random random);
}

The output of chunk generation:

public class GeneratedChunk {
// Block data
GeneratedBlockChunk blockChunk;
// Block states
GeneratedBlockStateChunk blockStateChunk;
// Entities
GeneratedEntityChunk entityChunk;
}

World generation uses noise for natural variation.

public class NoiseProperty {
// Noise configuration
}
public interface IHeightThresholdInterpreter {
// Interpret height thresholds for biome-specific terrain
}

The procedural library provides tools for generation:

// Height-based conditions
IHeightThresholdInterpreter
// Block-based conditions
HashSetBlockFluidCondition
FilteredBlockFluidCondition
BlockMaskCondition
ICoordinateDoubleSupplier
ConstantCoordinateDoubleSupplier
RandomCoordinateDoubleSupplier
public interface IWorldBounds {
int getMinX();
int getMaxX();
int getMinZ();
int getMaxZ();
}
public interface IChunkBounds {
int getMinChunkX();
int getMaxChunkX();
int getMinChunkZ();
int getMaxChunkZ();
}

World generation uses extensive caching:

public class ChunkGeneratorCache {
// Cache zone/biome results
// Cache heights
// Cache interpolated values
}
public class CaveGeneratorCache {
// Cache cave data
}
public class PrefabLoadingCache {
// Cache loaded prefabs
}

Main world generation configuration:

{
"Zones": "zones/",
"DefaultZone": "Plains",
"SeaLevel": 64,
"WorldHeight": 256,
"Caves": {
"Enabled": true,
"Types": ["Standard", "Cavern"]
}
}

Each zone has its own configuration:

  • Directoryworldgen/
    • World.json
    • Directoryzones/
      • DirectoryPlains/
        • zone.json
        • Directorybiomes/
          • Grassland.json
          • Forest.json
      • DirectoryMountains/
        • zone.json
        • Directorybiomes/
          • Alpine.json
    • Directoryprefabs/
      • Directoryvillage/
      • Directorydungeons/
public class MyWorldGenProvider implements IWorldGenProvider {
public static final BuilderCodec<MyWorldGenProvider> CODEC =
BuilderCodec.builder(MyWorldGenProvider.class, MyWorldGenProvider::new)
// Add configuration fields
.build();
@Override
public IWorldGen getGenerator() throws WorldGenLoadException {
return new MyChunkGenerator();
}
}
@Override
protected void setup() {
IWorldGenProvider.CODEC.register(
Priority.DEFAULT,
"MyPlugin_WorldGen",
MyWorldGenProvider.class,
MyWorldGenProvider.CODEC
);
}
public class WorldGenTimingsCollector {
// Collect generation timings
}
// ChunkGenerator implements MetricProvider
public interface MetricProvider {
MetricResults getMetrics();
}
  1. Use caching: Leverage built-in caches for performance
  2. Async generation: Use thread pool for heavy operations
  3. Seed consistency: Ensure deterministic generation from seed
  4. Validate output: Use ValidatableWorldGen interface
  5. Profile performance: Use benchmarking tools
  6. Modular design: Separate zones, biomes, and populators