Public API
Headless systems, optional adapters.
Import every public type from src/index.js during development or from release/littleenvironment.min.js in a browser.
| Area | Exports | Purpose |
|---|---|---|
| Events | EnvironmentEventBus, EnvironmentEvents | Stable listener registration and canonical lifecycle names. |
| Time | CalendarEngine, CelestialClock | Continuous normalised time, 24-hour conversion, solar and lunar vectors, seasons, years, and persistence. |
| Lighting | AmbientColorGradient, LightSource, LightingCompositor | Cyclic palette evaluation, deterministic harmonic flicker, viewport culling, and opt-in Canvas compositing. |
| Weather | ClimateMatrix, PrecipitationParticle, WeatherSystem | Biome-weighted weather selection, interpolated climate values, and particles recycled within active bounds. |
| Survival | HeatSource, ThermodynamicModel, SurvivalVitalManager | Radiant heat, conduction, vital depletion, stamina recovery, submersion, and threshold conditions. |
| Combat | ModifierType, StatModifier, Attribute, DamagePayload, CombatResolver | Dirty-cached modifier values, criticals, armour or elemental mitigation, shields, true damage, and receipts. |
| Effects | StackPolicy, StatusEffect, StatusEffectManager | Refresh, intensity, duration, and independent effects with drift-free ticks and targeted dispels. |
| Progression | ExperienceCurve, CharacterProgression | Exponential or polynomial requirements, level ceilings, overflow rollover, stat growth, and perk points. |
| Persistence | SchemaMigrator, EnvironmentSerialiser | Versioned compact JSON and contiguous forward migrations. |
Typical integration
import { CelestialClock, WeatherSystem } from './release/littleenvironment.min.js';
const clock = new CelestialClock({ dayDurationSeconds: 900 });
const weather = new WeatherSystem();
export function update(deltaSeconds, cameraBounds) {
clock.update(deltaSeconds);
return weather.update(deltaSeconds, cameraBounds).climate;
}