Miniplex ECS
Miniplex ECS
Use Miniplex for minimalistic Entity Component System with TypeScript support.
Technique
Define an entity type with optional properties, create a world, and query entities based on their properties. Use miniplex-react for React bindings with the Entities component.
Key Concepts
- Entity type defines all possible components as optional properties
world.with('prop1', 'prop2')creates typed queriesworld.add()andworld.remove()for entity lifecycle<Entities in={query}>{Component}</Entities>renders entities reactively- Entity props are passed directly to child components
Usage
type Entity = {
position?: { x: number; y: number }
isCharacter?: true
}
const world = new World<Entity>()
const characters = world.with('position', 'isCharacter')
// Add entity
world.add({ position: { x: 0, y: 0 }, isCharacter: true })
// Render
<Entities in={characters}>{Character}</Entities>
Note: Miniplex is feature-complete but no longer maintained.
More from verekia/r3f-gamedev
smooth-interpolation
Animate values smoothly using exponential decay instead of linear interpolation.
12ui-useframe
Sync UI elements outside the Canvas with the render loop using R3F v10's external useFrame.
8r3f-setup
Set up a React Three Fiber project with WebGPU support.
7reactive-polling
Poll for changes to any value and trigger React re-renders when it changes.
7miniplex
Use Miniplex for minimalistic Entity Component System with TypeScript support.
6bone-attachment
Attach meshes to bones of a skinned mesh, such as attaching a sword to a character's hand.
6