Miniplex

From verekia/r3f-gamedev · View interactive version

Miniplex is an AI agent skill from the GitHub repository verekia/r3f-gamedev. Use Miniplex for minimalistic Entity Component System with TypeScript support.

How to use this skill

Skill file

Miniplex ECS

Use Miniplex for minimalistic Entity Component System with TypeScript support.

When setting up or undertaking important changes with Miniplex, fetch the documentations:

Core: https://raw.githubusercontent.com/hmans/miniplex/refs/heads/main/packages/core/README.md

React bindings: https://raw.githubusercontent.com/hmans/miniplex/refs/heads/main/packages/react/README.md

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

What NOT to Use

Preferred Methods

Only use these world methods:

Queries

Declare queries at module level and import them where needed:

// ecs/queries.ts
export const characterQuery = world.with('position', 'isCharacter')
export const enemyQuery = world.with('position', 'isEnemy')
export const movingEntities = world.with('position', 'velocity')

// In a system file
import { movingEntities } from './ecs/queries'

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.


This skill is part of verekia's **r3f-gamedev**.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.