How piratejl/archetype-ecs-lib works
Archetype ECS Lib is a small TypeScript runtime for managing entities and component data, querying that data, and running game systems. An application creates a World, adds systems, and advances it with World.update or a multiphase Schedule. Systems can query entities, access singleton resources, emit events, and queue structural changes for safe flushing. World snapshots and profiling are additional capabilities. The tree and excerpts establish these major modules, but do not expose every internal call, so uncertain wiring is omitted.
Main entry points: World.ts World · Schedule.ts Schedule · Commands.ts Deferred Commands · Events.ts Event Channels
Components 14
World API
- World
src/ecs/World.ts - World Resources
src/ecs/World.ts - Public Exports
src/index.ts
Entity Storage
- Archetype Tables
src/ecs/Archetype.ts - Entity Manager
src/ecs/EntityManager.ts - Signatures
src/ecs/Signature.ts - Type Registry
src/ecs/TypeRegistry.ts
Systems and Services
- Schedule
src/ecs/Schedule.ts - Deferred Commands
src/ecs/Commands.ts - Event Channels
src/ecs/Events.ts
Snapshots and Profiling
- Snapshot Store
src/ecs/WorldSnapshotStore.ts - Stats Overlay
src/ecs/stats/StatsOverlay.ts
Other components
- Game Application
- Systems
Connections 17
- Game Application → Public Exports: imports
- Game Application → World: creates
- Game Application → Schedule: configures
- Schedule → Systems: runs
- Schedule → World: runs phases on
- Systems → World: queries and accesses
- Systems → Deferred Commands: queues changes
- Systems → Event Channels: uses
- World → Entity Manager: allocates entities
- World → Archetype Tables: stores and queries
- World → Signatures: matches signatures
- World → Type Registry: resolves types
- World → World Resources: reads and writes
- World → Deferred Commands: flushes
- World → Event Channels: manages channels
- World → Snapshot Store: saves and restores
- World → Stats Overlay: profiles frames