Skip to content

Architecture

Strata is built as a layered architecture, with each layer building on the previous one. This design provides flexibilityโ€”you can use the high-level components for rapid development, or drop down to lower levels for fine-grained control.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Layer 4: Game Framework & Presets โ”‚
โ”‚ Ready-to-use configurations, game state, controllers โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Layer 3: React Three Fiber Components โ”‚
โ”‚ <Water>, <Terrain>, <GrassInstances>, <ProceduralSky> โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Layer 2: Core Algorithms โ”‚
โ”‚ SDF, Marching Cubes, Noise, Materials โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Layer 1: GLSL Shaders โ”‚
โ”‚ Water, Terrain, Sky, Volumetrics, Materials โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Layer 0: TypeScript Types & Utilities โ”‚
โ”‚ Type definitions, math utilities, helpers โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The foundation layer provides TypeScript type definitions and utility functions used throughout the library.

import type {
BiomeConfig,
WaterConfig,
SkyConfig,
TerrainChunk
} from '@strata-game-library/core/types';
import {
clamp,
lerp,
smoothstep,
vec3
} from '@strata-game-library/core/utils';

The shader layer contains all GLSL vertex and fragment shaders. These can be used independently with any Three.js project.

import {
waterVertexShader,
waterFragmentShader,
skyVertexShader,
skyFragmentShader
} from '@strata-game-library/shaders';
// Use with Three.js ShaderMaterial
const material = new THREE.ShaderMaterial({
vertexShader: waterVertexShader,
fragmentShader: waterFragmentShader,
uniforms: {
uTime: { value: 0 },
uWaterColor: { value: new THREE.Color(0x0077be) },
}
});

Available shader categories:

  • Terrain: Height-based blending, triplanar mapping
  • Water: Wave animation, reflections, refractions
  • Sky: Atmospheric scattering, sun/moon
  • Clouds: Volumetric and layered clouds
  • Volumetrics: Fog, god rays, underwater
  • Materials: Toon, hologram, dissolve, forcefield, glitch
  • Vegetation: Wind animation for grass and trees

Pure TypeScript implementations of core algorithms with no React dependencies.

import {
sdSphere,
sdBox,
sdCapsule,
sdTorus,
opUnion,
opSubtraction,
opSmoothUnion
} from '@strata-game-library/core';
// Combine shapes
const scene = opSmoothUnion(
sdSphere(point, center, radius),
sdBox(point, boxCenter, boxSize),
0.5 // smoothness
);
import {
noise3D,
fbm,
warpedFbm
} from '@strata-game-library/core';
// Generate terrain height
const height = fbm(x * 0.01, 0, z * 0.01, {
octaves: 6,
persistence: 0.5,
lacunarity: 2.0
});
import {
marchingCubes,
createGeometryFromMarchingCubes,
generateTerrainChunk
} from '@strata-game-library/core';
// Generate terrain mesh
const geometry = generateTerrainChunk({
position: [0, 0, 0],
size: 32,
resolution: 64,
sdfFunction: terrainSDF
});
import {
createWaterMaterial,
createAdvancedWaterMaterial,
createSkyMaterial,
createRaymarchingMaterial
} from '@strata-game-library/core';
const waterMaterial = createWaterMaterial({
color: new THREE.Color(0x0077be),
opacity: 0.8,
reflectivity: 0.5
});

High-level React Three Fiber components that wrap the core algorithms.

import { Water, AdvancedWater } from '@strata-game-library/core';
<Water size={100} depth={20} />
<AdvancedWater
size={200}
waveHeight={2}
reflections
caustics
/>
import {
GrassInstances,
TreeInstances,
RockInstances,
GPUInstancedMesh
} from '@strata-game-library/core';
<GrassInstances count={10000} spread={100} />
<TreeInstances count={500} spread={200} />
import { ProceduralSky } from '@strata-game-library/core';
<ProceduralSky
sunPosition={[100, 50, 100]}
turbidity={10}
rayleigh={2}
/>
import {
VolumetricEffects,
VolumetricFogMesh,
UnderwaterOverlay,
EnhancedFog
} from '@strata-game-library/core';
<VolumetricFogMesh density={0.02} />
<UnderwaterOverlay depth={10} />

The highest layer provides ready-to-use configurations and game framework utilities.

import { createTerrainPreset, TerrainBiomes } from '@strata-game-library/presets/terrain';
import { createWeatherPreset, WeatherPresets } from '@strata-game-library/presets/weather';
import { createWaterPreset, WaterTypes } from '@strata-game-library/presets/water';
const terrain = createTerrainPreset({
biomes: [TerrainBiomes.GRASSLAND, TerrainBiomes.MOUNTAIN],
resolution: 128
});
const weather = createWeatherPreset(WeatherPresets.RAIN);
const water = createWaterPreset(WaterTypes.OCEAN);
import {
useGameState,
useCharacterController,
useInventory
} from '@strata-game-library/core/game';

Strata is organized as multiple packages for flexibility:

The core library with components, algorithms, and utilities:

// Main package - components
import { Water, ProceduralSky, Terrain, GrassInstances } from '@strata-game-library/core';
// Subpath: Core algorithms
import { marchingCubes, noise3D, sdSphere } from '@strata-game-library/core';
// Subpath: Utility functions
import { clamp, lerp, smoothstep } from '@strata-game-library/core/utils';
// Subpath: TypeScript types
import type { BiomeConfig, WaterConfig } from '@strata-game-library/core/types';

Standalone GLSL shaders (works with any Three.js project):

import {
waterVertexShader,
waterFragmentShader,
skyVertexShader,
skyFragmentShader
} from '@strata-game-library/shaders';

Pre-configured settings (requires @strata-game-library/core):

import { createTerrainPreset, TerrainBiomes } from '@strata-game-library/presets/terrain';
import { createWaterPreset, WaterTypes } from '@strata-game-library/presets/water';

Platform-specific capabilities:

// React Native
import { useDevice, useHaptics } from '@strata-game-library/react-native-plugin';
// Capacitor (Web/iOS/Android/Electron)
import { useDevice, useInput } from '@strata-game-library/capacitor-plugin/react';
@strata-game-library/core/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ api/ # Public API contracts
โ”‚ โ”œโ”€โ”€ components/ # React Three Fiber components
โ”‚ โ”œโ”€โ”€ compose/ # Component composition utilities
โ”‚ โ”œโ”€โ”€ core/ # Core algorithms (SDF, noise, marching cubes)
โ”‚ โ”œโ”€โ”€ game/ # Game framework (coming soon)
โ”‚ โ”œโ”€โ”€ hooks/ # React hooks
โ”‚ โ”œโ”€โ”€ presets/ # Pre-configured settings
โ”‚ โ”œโ”€โ”€ shaders/ # GLSL shaders
โ”‚ โ”œโ”€โ”€ types/ # TypeScript type definitions
โ”‚ โ”œโ”€โ”€ utils/ # Utility functions
โ”‚ โ””โ”€โ”€ world/ # World generation utilities

Start with high-level components, drop down to lower layers when needed.

Everything works out of the box with sensible defaults.

Every parameter is configurable when you need control.

GPU-accelerated by default, mobile-optimized.

Full type safety with excellent IDE support.