@plasius/gpu-world-generator 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +73 -0
  3. package/dist/field.wgsl +225 -0
  4. package/dist/fractal-prepass.wgsl +290 -0
  5. package/dist/index.cjs +1942 -0
  6. package/dist/index.cjs.map +1 -0
  7. package/dist/index.d.cts +447 -0
  8. package/dist/index.d.ts +447 -0
  9. package/dist/index.js +1848 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/terrain.wgsl +451 -0
  12. package/docs/adrs/adr-0001-package-scope.md +18 -0
  13. package/docs/adrs/adr-0002-world-tiling-lod-stitching.md +28 -0
  14. package/docs/adrs/adr-0003-terrain-generation-style-mixing.md +21 -0
  15. package/docs/adrs/index.md +5 -0
  16. package/docs/biomes.md +206 -0
  17. package/docs/lod-zoning.md +22 -0
  18. package/docs/plan.md +107 -0
  19. package/docs/procedural-surface.md +73 -0
  20. package/docs/resources.md +55 -0
  21. package/package.json +53 -0
  22. package/src/biomes/temperate.ts +387 -0
  23. package/src/field.wgsl +225 -0
  24. package/src/fields.ts +321 -0
  25. package/src/fractal-prepass.ts +237 -0
  26. package/src/fractal-prepass.wgsl +290 -0
  27. package/src/generator.ts +106 -0
  28. package/src/hex.ts +54 -0
  29. package/src/index.ts +11 -0
  30. package/src/mesh.ts +285 -0
  31. package/src/perf-monitor.ts +133 -0
  32. package/src/shaders/demo-terrain.wgsl +193 -0
  33. package/src/shaders/demo-trees.wgsl +172 -0
  34. package/src/shaders/demo-water-sim.wgsl +361 -0
  35. package/src/shaders/library/common.wgsl +38 -0
  36. package/src/shaders/library/materials.wgsl +175 -0
  37. package/src/terrain.wgsl +451 -0
  38. package/src/tile-cache.ts +274 -0
  39. package/src/tiles.ts +417 -0
  40. package/src/types.ts +220 -0
  41. package/src/wgsl/field.job.wgsl +225 -0
  42. package/src/wgsl/terrain.job.wgsl +451 -0
  43. package/src/wgsl.ts +77 -0
package/docs/biomes.md ADDED
@@ -0,0 +1,206 @@
1
+ # Biome Taxonomy (Earth-like)
2
+
3
+ This list defines macro biomes and their expected sub-biomes. Each sub-biome notes typical surface covers and micro features. Use these as defaults; procedural rules can blend and override locally.
4
+
5
+ Legend:
6
+ - Surfaces: ground/material layer
7
+ - Features: props, vegetation, structures
8
+
9
+ ## Polar
10
+ - Ice Cap
11
+ - Surfaces: Ice, Snowpack, Rock
12
+ - Features: Ice spike, wind-scoured rock
13
+ - Glacier
14
+ - Surfaces: Ice, Snowpack
15
+ - Features: Crevasse lines, ice ridges
16
+ - Polar Desert
17
+ - Surfaces: Snowpack, Gravel, Rock
18
+ - Features: Sparse boulder fields
19
+ - Frozen Sea
20
+ - Surfaces: Ice, Water (lead openings)
21
+ - Features: Pressure ridges, cracks
22
+
23
+ ## Cold Temperate
24
+ - Taiga
25
+ - Surfaces: Snowpack, Dirt, Rock
26
+ - Features: Conifer tree, fallen log, shrub
27
+ - Boreal Forest
28
+ - Surfaces: Dirt, Grass, Snowpack (seasonal)
29
+ - Features: Conifer tree, bush, moss
30
+ - Cold Steppe
31
+ - Surfaces: Grass, Dirt, Gravel
32
+ - Features: Grass tuft, scattered rock
33
+ - Frozen River
34
+ - Surfaces: Ice, Water
35
+ - Features: Ice shelf, reeds (edge)
36
+
37
+ ## Temperate
38
+ - Mixed Forest
39
+ - Surfaces: Dirt, Grass, Leaf litter
40
+ - Features: Tree (deciduous), bush, fallen log
41
+ - Plains
42
+ - Surfaces: Grass, Dirt
43
+ - Features: Grass tuft, flower patch
44
+ - Meadow
45
+ - Surfaces: Grass
46
+ - Features: Tall grass, wildflowers
47
+ - River Valley
48
+ - Surfaces: Grass, Mud, Water
49
+ - Features: Reeds, riparian trees, boulders
50
+ - Hills
51
+ - Surfaces: Grass, Rock
52
+ - Features: Rock outcrop, shrubs
53
+
54
+ ## Arid
55
+ - Desert (Sandy)
56
+ - Surfaces: Sand, Rock
57
+ - Features: Dunes, dry shrubs
58
+ - Desert (Rocky)
59
+ - Surfaces: Rock, Gravel
60
+ - Features: Boulder fields, mesas
61
+ - Savanna
62
+ - Surfaces: Grass, Dirt
63
+ - Features: Sparse trees, shrubs
64
+ - Badlands
65
+ - Surfaces: Dirt, Rock, Clay
66
+ - Features: Eroded spires, gullies
67
+ - Oasis
68
+ - Surfaces: Water, Grass, Mud
69
+ - Features: Palm trees, reeds
70
+ - Dry Riverbed
71
+ - Surfaces: Gravel, Sand
72
+ - Features: Scoured stones
73
+
74
+ ## Tropical
75
+ - Jungle
76
+ - Surfaces: Dirt, Mud, Leaf litter
77
+ - Features: Dense trees, vines, ferns
78
+ - Tropical Forest
79
+ - Surfaces: Grass, Dirt
80
+ - Features: Tall canopy, shrubs
81
+ - Mangrove
82
+ - Surfaces: Mud, Water
83
+ - Features: Mangrove roots, reeds
84
+ - Swamp
85
+ - Surfaces: Mud, Water
86
+ - Features: Reeds, stumps, fallen logs
87
+ - Floodplain
88
+ - Surfaces: Mud, Grass, Water (seasonal)
89
+ - Features: Reeds, wetland grass
90
+
91
+ ## Alpine
92
+ - Mountain Ridge
93
+ - Surfaces: Rock, Snowpack
94
+ - Features: Cliff faces, boulder fields
95
+ - High Meadow
96
+ - Surfaces: Grass, Rock
97
+ - Features: Alpine shrubs, grass tuft
98
+ - Scree
99
+ - Surfaces: Rock, Gravel
100
+ - Features: Loose stones, talus
101
+ - Snowline
102
+ - Surfaces: Snowpack, Rock
103
+ - Features: Sparse shrubs
104
+ - Glacier Valley
105
+ - Surfaces: Ice, Snowpack, Rock
106
+ - Features: Moraines
107
+
108
+ ## Volcanic
109
+ - Lava Field
110
+ - Surfaces: Basalt, Ash
111
+ - Features: Lava cracks, fumaroles
112
+ - Ash Plain
113
+ - Surfaces: Ash, Rock
114
+ - Features: Sparse shrubs, soot drift
115
+ - Geothermal
116
+ - Surfaces: Rock, Mud
117
+ - Features: Steam vents, hot springs
118
+ - Obsidian Ridge
119
+ - Surfaces: Rock (obsidian), Ash
120
+ - Features: Jagged spires
121
+
122
+ ## Freshwater
123
+ - River
124
+ - Surfaces: Water, Gravel, Mud
125
+ - Features: Reeds, ripples, rocks
126
+ - Lake
127
+ - Surfaces: Water, Mud
128
+ - Features: Shore reeds, shallow shelf
129
+ - Wetland
130
+ - Surfaces: Water, Mud, Grass
131
+ - Features: Reeds, shrubs
132
+ - Marsh
133
+ - Surfaces: Mud, Water
134
+ - Features: Tall reeds
135
+ - Bog
136
+ - Surfaces: Mud, Water, Moss
137
+ - Features: Stunted trees, pools
138
+
139
+ ## Coastal
140
+ - Beach
141
+ - Surfaces: Sand, Gravel
142
+ - Features: Driftwood, tide lines
143
+ - Cliff Coast
144
+ - Surfaces: Rock, Gravel
145
+ - Features: Cliff faces, sea spray
146
+ - Estuary
147
+ - Surfaces: Mud, Water
148
+ - Features: Reeds, shallow channels
149
+ - Delta
150
+ - Surfaces: Mud, Water, Sand
151
+ - Features: Sandbars, channels
152
+ - Reef
153
+ - Surfaces: Rock, Water
154
+ - Features: Coral (if supported), shallows
155
+
156
+ ## Urban
157
+ - City Core
158
+ - Surfaces: Cobble, Road
159
+ - Features: Buildings, walls, plazas
160
+ - Town
161
+ - Surfaces: Road, Dirt, Grass
162
+ - Features: Houses, fences, wells
163
+ - Village
164
+ - Surfaces: Dirt, Grass
165
+ - Features: Huts, gardens
166
+ - Castle
167
+ - Surfaces: Cobble, Rock
168
+ - Features: Walls, towers, gatehouses
169
+ - Farmland
170
+ - Surfaces: Dirt, Grass
171
+ - Features: Crops, irrigation channels
172
+
173
+ ## Underground
174
+ - Caverns
175
+ - Surfaces: Rock, Gravel, Mud
176
+ - Features: Stalactite, stalagmite, cave pools
177
+ - Lava Tubes
178
+ - Surfaces: Basalt, Ash
179
+ - Features: Lava crust, vent glow
180
+ - Crystal Caves
181
+ - Surfaces: Crystal, Rock
182
+ - Features: Crystal spires, reflective shards
183
+ - Subterranean River
184
+ - Surfaces: Water, Rock, Mud
185
+ - Features: Underground stream, slick stones
186
+ - Fungal Groves
187
+ - Surfaces: Mud, Dirt
188
+ - Features: Giant fungi, spores
189
+ - Mine Shafts
190
+ - Surfaces: Rock, Dirt
191
+ - Features: Timber supports, rails, carts, lanterns
192
+ - Sewers
193
+ - Surfaces: Water, Cobble, Sludge
194
+ - Features: Grates, brick tunnels, runoff channels
195
+
196
+ ## Cross-Biome Generic Types
197
+ - Rock: outcrops, boulders, cliffs, crystal spires
198
+ - Water: rivers, lakes, puddles, marsh
199
+ - Vegetation: tree, bush, grass tuft, reed
200
+ - Pathing: road, trail, bridge
201
+
202
+ ## Stitching Suggestions
203
+ - Blend macro biomes over 1-2 hex rings using heat/moisture gradients.
204
+ - Sub-biomes should respect parent macro constraints (e.g., no desert inside Polar).
205
+ - Surface cover transitions should be gradual: grass -> dirt -> snowpack.
206
+ - Feature density derived from surface cover + moisture to avoid hard seams.
@@ -0,0 +1,22 @@
1
+ # LOD Zoning (Hex Rings)
2
+
3
+ ## Goal
4
+ Use hexagons only for streaming and LOD control around the viewport, not for generation. The world surface is continuous; hexes partition which areas get higher sampling density and richer features.
5
+
6
+ ## Ring Layout
7
+ - Center ring: highest resolution (small step size, full features).
8
+ - Mid ring: medium resolution (reduced step size, fewer features).
9
+ - Far ring: low resolution (coarse step size, minimal features).
10
+
11
+ ## Sampling Strategy
12
+ - Each ring defines a sampling step (meters per sample).
13
+ - The same procedural field functions are evaluated at different step sizes.
14
+ - Cross-fade between rings to reduce popping.
15
+
16
+ ## Caching
17
+ - Cache generated tiles per ring with a key `(ringId, q, r, seed)`.
18
+ - Evict far tiles based on camera movement thresholds.
19
+
20
+ ## Determinism
21
+ - The same input field functions must be used across rings.
22
+ - Only the sampling step and feature density change by ring.
package/docs/plan.md ADDED
@@ -0,0 +1,107 @@
1
+ # GPU World Generator Plan
2
+
3
+ ## Summary
4
+ A shader-first world generator that synthesizes continuous surface fields using deterministic mathematics (Mandelbrot/Julia/multibrot stacks). Materials and features are applied in post-surface rule passes (grass/trees/rocks/sand, etc). Hexagons are retained only for LOD zoning and streaming control around the viewport, not for generation.
5
+
6
+ ## Core References
7
+ - `docs/procedural-surface.md` for the deterministic surface field stack (Mandelbrot + warps + blends).
8
+ - `docs/lod-zoning.md` for hex-based LOD rings around the viewport.
9
+ - `docs/biomes.md` for the Earth-like biome taxonomy and sub-biome options.
10
+ - `docs/resources.md` for subsurface resource generation below terrain.
11
+
12
+ ## Surface Field Generation (Shader-First)
13
+ Inputs:
14
+ - World coordinates (x, z) mapped to the complex plane.
15
+ - Seed + global parameters (scale, height, heat, moisture, roughness).
16
+
17
+ Outputs:
18
+ - Height (0..1), heat (0..1), moisture (0..1), roughness (0..1), rockiness (0..1), water mask (0..1).
19
+ - Cumulative trend band: `0.0..0.2` downward slope, `0.2..0.8` flat, `0.8..1.0` upward slope.
20
+ - Feature/obstacle mask (0..1).
21
+ - Foliage density mask (0..1).
22
+
23
+ Shader stages (field stack):
24
+ 1. Base fractal field (Mandelbrot/Julia or multibrot, smooth iteration count).
25
+ 2. Domain warping to break symmetry (secondary fractal offsets).
26
+ 3. Multiplicative blends to combine large/mid/small detail.
27
+ 4. Ridge/valley shaping (abs/threshold transforms).
28
+ 5. Optional erosion heuristics (slope/curvature approximations).
29
+
30
+ ## Rule Passes (Material + Features)
31
+ 1. Hydrology: water fills local minima, flattens surface, and follows flow paths.
32
+ 2. Material selection: slope + height + moisture -> rock/sand/grass/mud/ice.
33
+ 3. Feature placement: trees/rocks/props based on material + local noise.
34
+ 4. Structural overlays: towns/roads/castles (deterministic hash rules).
35
+
36
+ ## LOD Zoning (Hex Rings Around Viewport)
37
+ - Hexes define streaming and LOD rings only.
38
+ - Nearest ring: highest sample resolution (smallest step).
39
+ - Mid ring: medium resolution.
40
+ - Far ring: low resolution + simplified materials/features.
41
+ - Cross-fade or blend across ring boundaries to avoid popping.
42
+
43
+ ## Biome Hierarchy (Suggested)
44
+ The same cell is classified at multiple levels. Each stage constrains the next to keep seams predictable.
45
+
46
+ See `docs/biomes.md` for the full Earth-like biome taxonomy and sub-biome options.
47
+ See `docs/resources.md` for subsurface resource generation below terrain.
48
+
49
+ ### Level 0: Macro Biomes (regional)
50
+ - Polar (ice cap, glacier belt)
51
+ - Cold Temperate (taiga, boreal forest)
52
+ - Temperate (mixed forest, plains)
53
+ - Arid (desert, savanna)
54
+ - Tropical (jungle, mangrove)
55
+ - Alpine (mountainous, highlands)
56
+ - Volcanic (lava fields, ash plains)
57
+ - Freshwater (river/lake basins)
58
+ - Coastal/Marine (coastline, estuary)
59
+ - Urban (major settlement regions)
60
+ - Underground (caverns, tunnels)
61
+
62
+ ### Level 1: Sub-biomes (local terrain)
63
+ Examples by macro:
64
+ - Polar: Ice, Snow, Tundra
65
+ - Cold Temperate: Tundra, Pine Forest, Frozen River
66
+ - Temperate: Plains, Mixed Forest, River, Hills
67
+ - Arid: Savanna, Desert, Oasis, Dry Riverbed
68
+ - Tropical: Jungle, Swamp, River, Mangrove
69
+ - Alpine: Mountainous, Cliff, Scree, Snowline
70
+ - Volcanic: Lava, Basalt, Ash, Geothermal
71
+ - Freshwater: River, Lake, Wetland
72
+ - Coastal/Marine: Beach, Cliffs, Reef, Estuary
73
+ - Urban: City, Town, Village, Castle
74
+
75
+ ### Level 2: Surface Cover (ground/material)
76
+ - Grass, Dirt, Sand, Rock, Gravel, Snowpack, Ice, Mud, Ash, Cobble, Road
77
+ - Water surfaces: River, Lake, Coastal surf
78
+
79
+ ### Level 3: Micro Features (prop/placement)
80
+ - Tree, Bush, Grass Tuft, Reed, Rock, Boulder, Water Ripple, Ice Spike
81
+ - Structures: Hut, Wall, Bridge, Gate, Tower, Ruin
82
+
83
+ ### Stitching Rules
84
+ - Macro boundaries blend over 1-2 hex rings using weighted masks (heat/moisture/height).
85
+ - Sub-biomes inherit and override surface covers gradually (e.g., grass -> dirt -> snow).
86
+ - Feature density derived from surface cover and moisture to avoid hard seams.
87
+ ## Terrain Targets (Initial)
88
+ - Tundra, Savanna, River, City, Village, Ice, Snow, Mountainous, Volcanic, Road, Town, Castle.
89
+ - Additional neutral base: Plains (default).
90
+
91
+ ## Particle + Shader Attachments
92
+ - Tree shader: base mesh + leaf instancing.
93
+ - Particle system tags: e.g., `leaves_falling` attached to Tree biome + season.
94
+ - Local effects triggered by biome + heat/moisture (e.g., snow drift, ash fall).
95
+
96
+ ## Package Deliverables
97
+ - WGSL field stack for deterministic surface generation.
98
+ - TypeScript helpers to sample fields and apply rule passes.
99
+ - LOD zoning manager (hex rings) for streaming control.
100
+
101
+ ## Development Steps
102
+ 1. Add deterministic fractal field stack (Mandelbrot/Julia/multibrot).
103
+ 2. Add domain warp + multiplicative blending controls.
104
+ 3. Implement hydrology + material rule passes.
105
+ 4. Add feature placement (trees/rocks/props) based on rules.
106
+ 5. Add LOD zoning manager (hex rings) and cross-fade.
107
+ 6. Integrate in demo + shader tuning pass.
@@ -0,0 +1,73 @@
1
+ # Procedural Surface (Deterministic Math)
2
+
3
+ ## Goal
4
+ Generate height/heat/moisture/roughness fields from deterministic mathematics (Mandelbrot/Julia/multibrot) and then apply rule-based materials + features. The same `(x, z, seed)` input always yields the same surface, enabling reproducible worlds.
5
+
6
+ ## Coordinate Mapping
7
+ - Map world `(x, z)` to complex plane `c = (u, v)`.
8
+ - Use seeded transforms to avoid symmetry:
9
+ - `u = (x * scale + offsetX) * skewX + warpX`
10
+ - `v = (z * scale + offsetZ) * skewZ + warpZ`
11
+ - Keep scale separate per band: large (continental), mid (regional), small (local).
12
+
13
+ ## Fractal Field Stack
14
+ Each layer returns a smooth iteration count `f(x, z)` in `[0, 1]`.
15
+
16
+ 1. Base set (Mandelbrot or Julia):
17
+ - `z = 0; z = z^p + c` or `z = z^p + k` for Julia.
18
+ - Use smooth iteration for continuity.
19
+ 2. Domain warp (secondary fractal):
20
+ - `c' = c + warpStrength * vec2(f2(x, z), f3(x, z))`.
21
+ 3. Multiplicative blend:
22
+ - `height = clamp(fA^a * fB^b * fC^c, 0, 1)`.
23
+ 4. Ridged transform:
24
+ - `ridge = 1 - abs(2 * f - 1)`.
25
+ 5. Composite fields:
26
+ - `heat = mix(fHeat1, fHeat2, ridge)`
27
+ - `moisture = mix(fMoist1, fMoist2, fMask)`
28
+
29
+ ## Derived Maps
30
+ From the height field:
31
+ - Slope (for rock exposure).
32
+ - Curvature (for valleys vs ridges).
33
+ - Flow accumulation (for rivers/wetlands).
34
+ - Roughness (for biome texture and LOD decisions).
35
+
36
+ ## Style Mixing (Macro Map)
37
+ To avoid uniform terrain, use a low-frequency macro map to blend between
38
+ two different height styles per region.
39
+ - Style A: earth-like dramatic (ridged multifractal, smoother slopes).
40
+ - Style B: surreal (terracing + crater basins + sharper ridges).
41
+
42
+ `styleMask = macroMap(x, z)` → `height = mix(styleA, styleB, styleMask)`
43
+
44
+ ## Signed Height Pipeline
45
+ Heights can extend outside `[0, 1]` internally (e.g. `[-0.35..1.6]`):
46
+ - `rawHeight` drives mesh elevation.
47
+ - `height01 = clamp(rawHeight, 0, 1)` is used for heat/moisture/water/biomes.
48
+
49
+ ## Terraces + Craters
50
+ - **Terracing**: quantize height into steps with smooth interpolation.
51
+ - **Crater field**: hashed radial basins that carve the surface.
52
+ - These modifiers are blended in as part of style B and remain deterministic.
53
+
54
+ ## Rule Passes (Post Surface)
55
+ - Water:
56
+ - Flatten water at local minima and flow along gradients.
57
+ - Beach/silt where slope is low and moisture high.
58
+ - Rock exposure:
59
+ - High slope + high roughness -> rock.
60
+ - Vegetation:
61
+ - Moisture + low slope + moderate heat -> grass/forest.
62
+ - Sand:
63
+ - High heat + low moisture + low slope -> sand.
64
+
65
+ ## Determinism
66
+ All parameters (seed, scale, warps) must be explicit.
67
+ No random calls without a seed.
68
+
69
+ ## Suggested Parameters (Starter)
70
+ - Iterations: 24–96 (based on LOD band).
71
+ - Multibrot exponent `p`: 2.0–3.5.
72
+ - Warp strength: 0.05–0.25.
73
+ - Blend exponents: 0.8–1.4.
@@ -0,0 +1,55 @@
1
+ # Subsurface Resources (Below Terrain)
2
+
3
+ This defines what a player might find when digging below the surface. The goal is to generate a resource profile per hex cell based on macro biome, sub-biome, and depth bands.
4
+
5
+ ## Depth Bands (Suggested)
6
+ - 0-1 m: Litter/topsoil (organic debris, roots)
7
+ - 1-5 m: Subsoil (clay, compacted dirt, small stones)
8
+ - 5-30 m: Soft rock/strata (limestone, sandstone, shale)
9
+ - 30-200 m: Hard rock (granite, basalt, metamorphic)
10
+ - 200+ m: Deep strata (rare ores, geothermal pockets)
11
+
12
+ ## Resource Categories
13
+ - Soil/organic: topsoil, peat, compost
14
+ - Stone/common: limestone, sandstone, shale, granite, basalt
15
+ - Metals/common: iron, copper, tin
16
+ - Metals/rare: silver, gold, platinum
17
+ - Crystals/minerals: quartz, crystal clusters, geodes
18
+ - Volatiles: coal, sulfur, gas pockets
19
+ - Water: aquifers, underground rivers, brine
20
+ - Special: relics, ruins, lost tech (gameplay-dependent)
21
+
22
+ ## Resource Rules (High-Level)
23
+ - Each hex cell has a resource profile per depth band (density + rarity).
24
+ - Macro biome influences baseline probability (e.g., Volcanic -> basalt/sulfur; Arid -> sandstone; Polar -> permafrost/ice lenses).
25
+ - Sub-biome refines (e.g., River -> aquifers; Mountainous -> ore veins; Urban -> ruins/utility tunnels).
26
+ - Height + heat + moisture bias ore types and water tables.
27
+
28
+ ## Example Resource Bias by Macro Biome
29
+ - Polar: ice lenses, permafrost, low metal density.
30
+ - Cold Temperate: iron + copper pockets, shallow aquifers.
31
+ - Temperate: balanced stone + water, moderate metal density.
32
+ - Arid: sandstone, salt, deep water.
33
+ - Tropical: rich organic topsoil, shallow water, softer rock.
34
+ - Alpine: high ore density, hard rock, sparse water.
35
+ - Volcanic: basalt, sulfur, obsidian, geothermal pockets.
36
+ - Freshwater: high water tables, sedimentary rock.
37
+ - Coastal: brine, sand/clay layers.
38
+ - Urban: utility tunnels, debris layers, old foundations.
39
+ - Underground: mineral-rich, crystal clusters, cave water.
40
+
41
+ ## Generation Approach (Per Cell)
42
+ 1. Compute base strata material via (q, r, depth) noise.
43
+ 2. Apply macro biome bias table (weights per resource category).
44
+ 3. Apply sub-biome overrides (e.g., river -> water table upshift).
45
+ 4. Run ore vein placement (3D noise thresholds + connected blobs).
46
+ 5. Output per-depth resource layers (density, rarity, type).
47
+
48
+ ## Data Model (Proposed)
49
+ - ResourceLayer: { depthStartM, depthEndM, materialType, density, rarity }
50
+ - VeinNode: { center, radiusM, resourceType, richness }
51
+ - Aquifer: { depthM, thicknessM, saturation }
52
+
53
+ ## Stitching Notes
54
+ - Blend resource profiles across hex edges to avoid sudden changes.
55
+ - Ensure veins can cross neighboring hexes (connected components).
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@plasius/gpu-world-generator",
3
+ "version": "0.0.4",
4
+ "description": "GPU-assisted world generation with hex-grid terrain synthesis.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "private": false,
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "files": [
11
+ "dist",
12
+ "src",
13
+ "docs",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/index.cjs"
21
+ },
22
+ "./terrain.wgsl": "./dist/terrain.wgsl",
23
+ "./field.wgsl": "./dist/field.wgsl",
24
+ "./fractal-prepass.wgsl": "./dist/fractal-prepass.wgsl",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "scripts": {
28
+ "build": "tsup && cp src/terrain.wgsl dist/terrain.wgsl && cp src/field.wgsl dist/field.wgsl && cp src/fractal-prepass.wgsl dist/fractal-prepass.wgsl",
29
+ "test": "node --test",
30
+ "test:coverage": "c8 --reporter=lcov --reporter=text node --test"
31
+ },
32
+ "dependencies": {
33
+ "@plasius/gpu-worker": "^0.1.2"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^22.10.0",
37
+ "tsup": "^8.5.0",
38
+ "typescript": "^5.9.3",
39
+ "c8": "^10.1.3"
40
+ },
41
+ "license": "Apache-2.0",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/Plasius-LTD/gpu-world-generator.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/Plasius-LTD/gpu-world-generator/issues"
51
+ },
52
+ "homepage": "https://github.com/Plasius-LTD/gpu-world-generator#readme"
53
+ }