116 lines
3.4 KiB
Markdown
116 lines
3.4 KiB
Markdown
---
|
|
title: World Generation
|
|
type: docs
|
|
weight: 10
|
|
---
|
|
|
|
The World Generation system creates procedural terrain, caves, biomes, and structures for Hytale worlds.
|
|
|
|
**Packages:**
|
|
- `com.hypixel.hytale.server.worldgen`
|
|
- `com.hypixel.hytale.builtin.hytalegenerator`
|
|
|
|
{{< cards >}}
|
|
{{< card link="world-loader" title="World Loader" subtitle="Chunk loading and generation pipeline" >}}
|
|
{{< card link="chunk-generation" title="Chunk Generation" subtitle="Block placement and terrain" >}}
|
|
{{< card link="cave-generation" title="Cave Generation" subtitle="Underground cave systems" >}}
|
|
{{< card link="climate-biomes" title="Climate & Biomes" subtitle="Biome distribution and climate" >}}
|
|
{{< card link="prefabs" title="Prefabs" subtitle="Structure and building placement" >}}
|
|
{{< card link="zones" title="Zones" subtitle="Zone definitions and regions" >}}
|
|
{{< card link="hytale-generator" title="Hytale Generator" subtitle="Default procedural generator" >}}
|
|
{{< card link="density-functions" title="Density Functions" subtitle="Terrain shape definition" >}}
|
|
{{< card link="material-providers" title="Material Providers" subtitle="Block selection logic" >}}
|
|
{{< card link="prop-placement" title="Prop Placement" subtitle="Vegetation and object placement" >}}
|
|
{{< card link="generation-patterns" title="Generation Patterns" subtitle="Patterns and fields" >}}
|
|
{{< /cards >}}
|
|
|
|
## Architecture Overview
|
|
|
|
The world generation system operates in several phases:
|
|
|
|
```
|
|
World Generation Pipeline
|
|
├── Climate Generation
|
|
│ └── Biome Assignment
|
|
├── Terrain Generation
|
|
│ ├── Density Functions (shape)
|
|
│ ├── Material Providers (blocks)
|
|
│ └── Surface Decoration
|
|
├── Cave Generation
|
|
│ ├── Cave Carving
|
|
│ └── Cave Features
|
|
├── Structure Placement
|
|
│ ├── Prefab Selection
|
|
│ └── Prefab Positioning
|
|
└── Prop Placement
|
|
├── Vegetation
|
|
└── Objects
|
|
```
|
|
|
|
## Packages Overview
|
|
|
|
| Package | Files | Description |
|
|
|---------|-------|-------------|
|
|
| `loader/` | 75 | World loading system |
|
|
| `util/` | 35 | Generation utilities |
|
|
| `cave/` | 32 | Cave generation |
|
|
| `climate/` | 12 | Climate and biomes |
|
|
| `chunk/` | 12 | Chunk generation |
|
|
| `prefab/` | 8 | Structure placement |
|
|
| `zone/` | 7 | Zone definitions |
|
|
| `cache/` | 7 | Generation caching |
|
|
|
|
## Hytale Generator
|
|
|
|
The built-in Hytale generator provides the default world generation:
|
|
|
|
| Package | Files | Description |
|
|
|---------|-------|-------------|
|
|
| `assets/` | 232 | Generator asset definitions |
|
|
| `density/` | 76 | Density functions |
|
|
| `materialproviders/` | 29 | Block selection |
|
|
| `props/` | 24 | Prop placement |
|
|
| `patterns/` | 13 | Generation patterns |
|
|
| `fields/` | 8 | Field generation |
|
|
|
|
## Quick Example
|
|
|
|
```java
|
|
// Get world generator
|
|
WorldGenerator generator = world.getGenerator();
|
|
|
|
// Generate chunk
|
|
generator.generateChunk(chunkX, chunkZ);
|
|
|
|
// Get biome at position
|
|
Biome biome = generator.getBiome(position);
|
|
|
|
// Check if structure can generate
|
|
boolean canPlace = generator.canPlacePrefab(prefab, position);
|
|
```
|
|
|
|
## Configuration
|
|
|
|
World generation is configured through YAML assets:
|
|
|
|
```yaml
|
|
# worldgen/my_generator.yaml
|
|
Type: WorldGenerator
|
|
Id: my_generator
|
|
Seed: 12345
|
|
Climate:
|
|
Type: StandardClimate
|
|
Biomes:
|
|
- forest
|
|
- plains
|
|
- mountains
|
|
Density:
|
|
Type: MultipleDensity
|
|
Functions:
|
|
- terrain_base
|
|
- terrain_hills
|
|
Prefabs:
|
|
- Type: Village
|
|
Frequency: 0.01
|
|
```
|