Biome System
Hytale’s biome system controls terrain characteristics, block placement, vegetation, and environmental properties across different regions of the world. This system uses pattern generation and interpolation to create smooth biome transitions.
Core Classes
Section titled “Core Classes”The abstract base class for all biomes, located in com.hypixel.hytale.server.worldgen.biome.Biome:
import com.hypixel.hytale.server.worldgen.biome.Biome;import com.hypixel.hytale.server.worldgen.biome.BiomeInterpolation;import com.hypixel.hytale.procedurallib.condition.IHeightThresholdInterpreter;import com.hypixel.hytale.procedurallib.property.NoiseProperty;
public abstract class Biome { // Identity public int getId(); public String getName(); public int getMapColor();
// Interpolation settings public BiomeInterpolation getInterpolation();
// Terrain generation public IHeightThresholdInterpreter getHeightmapInterpreter(); public NoiseProperty getHeightmapNoise();
// Block placement containers public CoverContainer getCoverContainer(); public LayerContainer getLayerContainer(); public PrefabContainer getPrefabContainer();
// Visual and environment public TintContainer getTintContainer(); public EnvironmentContainer getEnvironmentContainer(); public WaterContainer getWaterContainer(); public FadeContainer getFadeContainer();}Key Properties:
id- Unique biome identifier used for lookups and masksname- Human-readable biome nameinterpolation- Controls how this biome blends with neighborsheightmapInterpreter- Determines terrain height based on noisecoverContainer- Top surface blocks (grass, sand, etc.)layerContainer- Subsurface layers (dirt, stone, etc.)prefabContainer- Structure placement (trees, rocks, etc.)mapColor- Color displayed on maps
TileBiome
Section titled “TileBiome”Standard biomes that use tile-based pattern generation:
import com.hypixel.hytale.server.worldgen.biome.TileBiome;
public class TileBiome extends Biome { public double getWeight(); // Generation frequency public double getSizeModifier(); // Scale of biome patches}Usage:
weight- Higher values make the biome more common (used in weighted selection)sizeModifier- Affects the scale parameter passed to point generators
CustomBiome
Section titled “CustomBiome”Specialized biomes with custom generation logic:
import com.hypixel.hytale.server.worldgen.biome.CustomBiome;import com.hypixel.hytale.server.worldgen.biome.CustomBiomeGenerator;
public class CustomBiome extends Biome { public CustomBiomeGenerator getCustomBiomeGenerator();}
// The generator controls when and where the custom biome appearspublic class CustomBiomeGenerator { // Check if biome should generate at position public boolean shouldGenerateAt(int seed, double x, double z, ZoneGeneratorResult zoneResult, Biome customBiome);
// Check if parent biome is valid public boolean isValidParentBiome(int index);
// Priority for overlapping custom biomes public int getPriority();}Custom Biome Generation:
Custom biomes override tile biomes based on:
- Noise threshold -
NoisePropertyandIDoubleThresholddetermine if noise values match - Parent biome mask - Only generates over specific tile biomes
- Zone fade - Respects zone borders using
FadeContainer.getMaskFactor() - Priority - Higher priority custom biomes take precedence
Biome Pattern Generation
Section titled “Biome Pattern Generation”BiomePatternGenerator
Section titled “BiomePatternGenerator”Generates the biome layout across the world:
import com.hypixel.hytale.server.worldgen.biome.BiomePatternGenerator;import com.hypixel.hytale.procedurallib.logic.point.IPointGenerator;import com.hypixel.hytale.common.map.IWeightedMap;
public class BiomePatternGenerator { // Get biome at position public TileBiome getBiome(int seed, int x, int z);
// Direct biome lookup (no point generation) public TileBiome getBiomeDirect(int seed, int x, int z);
// Generate final biome (includes custom biomes) public Biome generateBiomeAt(ZoneGeneratorResult zoneResult, int seed, int x, int z);
// Check for custom biome override public CustomBiome getCustomBiomeAt(int seed, double x, double z, ZoneGeneratorResult zoneResult, Biome parentResult);
// Get all biomes (tile + custom) public Biome[] getBiomes();
// Get only custom biomes public CustomBiome[] getCustomBiomes();
// Get interpolation extents public int getExtents();}Pattern Generation Process:
- Point generation -
IPointGeneratordetermines biome cell centers - Weighted selection -
IWeightedMap<TileBiome>selects biome based on weight - Custom override - Checks if any
CustomBiomeshould replace the tile biome - Priority sorting - When multiple custom biomes match, highest priority wins
Creating a BiomePatternGenerator
Section titled “Creating a BiomePatternGenerator”// Define point generator for biome placementIPointGenerator pointGenerator = /* ... */;
// Create weighted map of tile biomesIWeightedMap<TileBiome> tileBiomes = /* ... */;// Add biomes with weights:// - Higher weight = more common// - Weights are relative to each other
// Create array of custom biomesCustomBiome[] customBiomes = new CustomBiome[] { // Custom biomes that can override tile biomes};
BiomePatternGenerator generator = new BiomePatternGenerator( pointGenerator, tileBiomes, customBiomes);
// Use in world generationBiome biome = generator.generateBiomeAt(zoneResult, seed, x, z);Biome Interpolation
Section titled “Biome Interpolation”BiomeInterpolation
Section titled “BiomeInterpolation”Controls how biomes blend at their borders:
import com.hypixel.hytale.server.worldgen.biome.BiomeInterpolation;import it.unimi.dsi.fastutil.ints.Int2IntMap;
public class BiomeInterpolation { // Default interpolation (radius 5) public static final BiomeInterpolation DEFAULT;
// Create custom interpolation public static BiomeInterpolation create(int radius, Int2IntMap biomeRadii2);
// Get interpolation radius public int getRadius();
// Get squared radius for specific biome public int getBiomeRadius2(int biome);}Interpolation Settings:
radius- Default interpolation distance (default: 5 blocks)biomeRadii2- Per-biome squared radius overrides (map of biome ID to radius²)- Interpolation affects block placement, heightmap, and visual properties
Usage Example:
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
// Create custom interpolationInt2IntOpenHashMap biomeRadii = new Int2IntOpenHashMap();biomeRadii.put(FOREST_BIOME_ID, 7 * 7); // Forest: 7 block radiusbiomeRadii.put(DESERT_BIOME_ID, 3 * 3); // Desert: 3 block radius
BiomeInterpolation interpolation = BiomeInterpolation.create( 5, // Default radius biomeRadii // Per-biome overrides);Biome Containers
Section titled “Biome Containers”Biomes use containers to define their characteristics:
CoverContainer
Section titled “CoverContainer”Surface blocks (grass, sand, snow, etc.):
// Referenced by biome.getCoverContainer()// Controls the top layer of blocksLayerContainer
Section titled “LayerContainer”Subsurface layers (dirt, stone, gravel, etc.):
// Referenced by biome.getLayerContainer()// Controls underground block layersPrefabContainer
Section titled “PrefabContainer”Structure placement (trees, rocks, plants, etc.):
public PrefabContainer getPrefabContainer();
// Get max prefab size for bounds calculationpublic int getMaxSize();The extents value in BiomePatternGenerator is calculated from the maximum prefab size across all biomes.
TintContainer
Section titled “TintContainer”Color tinting for blocks and foliage:
// Referenced by biome.getTintContainer()// Applies color variations to grass, leaves, water, etc.EnvironmentContainer
Section titled “EnvironmentContainer”Environmental properties (particles, sounds, sky color):
// Referenced by biome.getEnvironmentContainer()// Defines ambient effects and atmosphereWaterContainer
Section titled “WaterContainer”Water-specific properties:
// Referenced by biome.getWaterContainer()// Controls water color, behavior, and placementFadeContainer
Section titled “FadeContainer”Zone border fading:
public FadeContainer getFadeContainer();
// Get mask fade parameterspublic double getMaskFadeSum();public double getMaskFactor(ZoneGeneratorResult zoneResult);Used by custom biome generators to fade out near zone borders.
Custom Biome Implementation
Section titled “Custom Biome Implementation”Creating a Custom Biome
Section titled “Creating a Custom Biome”import com.hypixel.hytale.server.worldgen.biome.CustomBiome;import com.hypixel.hytale.server.worldgen.biome.CustomBiomeGenerator;import com.hypixel.hytale.procedurallib.property.NoiseProperty;import com.hypixel.hytale.procedurallib.condition.IDoubleThreshold;import com.hypixel.hytale.procedurallib.condition.IIntCondition;
// Create noise property for custom biomeNoiseProperty noise = /* noise configuration */;
// Create threshold (e.g., noise > 0.5)IDoubleThreshold threshold = /* threshold condition */;
// Create biome mask (which parent biomes are valid)IIntCondition biomeMask = /* parent biome condition */;
// Create the generatorCustomBiomeGenerator generator = new CustomBiomeGenerator( noise, // Noise property threshold, // Noise threshold biomeMask, // Parent biome mask 10 // Priority (higher = more important));
// Create the custom biomeCustomBiome customBiome = new CustomBiome( id, // Unique ID "MyCustomBiome", // Name interpolation, // Biome interpolation generator, // Custom generator heightmapInterpreter, // Height interpreter coverContainer, // Surface blocks layerContainer, // Subsurface layers prefabContainer, // Structures tintContainer, // Color tints environmentContainer, // Environment effects waterContainer, // Water properties fadeContainer, // Zone fading heightmapNoise, // Heightmap noise mapColor // Map color);Custom Biome Generation Logic
Section titled “Custom Biome Generation Logic”The shouldGenerateAt method determines biome placement:
public boolean shouldGenerateAt(int seed, double x, double z, ZoneGeneratorResult zoneResult, Biome customBiome) { // 1. Get noise value at position double noise = noiseProperty.get(seed, x, z);
// 2. Check if near zone border if (zoneResult.getBorderDistance() < customBiome.getFadeContainer().getMaskFadeSum()) { // Apply fade factor near borders double factor = customBiome.getFadeContainer().getMaskFactor(zoneResult); return isThreshold(noise, factor); }
// 3. Normal threshold check return isThreshold(noise);}
public boolean isValidParentBiome(int index) { // Check if this custom biome can generate over the parent biome return biomeMask.eval(index);}Integration with Zones
Section titled “Integration with Zones”Biomes are associated with zones through the Zone record:
import com.hypixel.hytale.server.worldgen.zone.Zone;
// Each zone has its own biome pattern generatorZone zone = /* ... */;BiomePatternGenerator biomeGen = zone.biomePatternGenerator();
// Generate biomes in context of zoneZoneGeneratorResult zoneResult = /* zone lookup */;Biome biome = biomeGen.generateBiomeAt(zoneResult, seed, x, z);Best Practices
Section titled “Best Practices”Biome Design
Section titled “Biome Design”- Use reasonable weights - Balance biome frequency (typical range: 0.5 to 2.0)
- Set appropriate size modifiers - Larger biomes need higher values (typical: 0.8 to 1.5)
- Design smooth transitions - Use interpolation radius based on biome characteristics
- Test border fading - Ensure custom biomes fade properly at zone boundaries
Custom Biome Guidelines
Section titled “Custom Biome Guidelines”- Use specific noise patterns - Make custom biomes visually distinct
- Set appropriate thresholds - Control rarity (tighter threshold = rarer)
- Limit parent biomes - Restrict to thematically appropriate base biomes
- Use priority wisely - Higher priority for more specific/rare biomes
- Consider zone borders - Implement proper fade container settings
Performance Considerations
Section titled “Performance Considerations”- Cache biome lookups - Biome generation can be expensive
- Minimize custom biomes - Each adds overhead to pattern generation
- Optimize noise properties - Complex noise is costly
- Use extents correctly - Affects chunk generation bounds
Integration
Section titled “Integration”- Coordinate with zones - Ensure biomes fit the zone theme
- Match cave systems - Some cave types use biome masks
- Align with prefabs - Prefab placement depends on biome
- Sync with tinting - Visual consistency across biome features