jecs/README.md
2025-02-19 21:40:38 +05:30

2.6 KiB

License: MIT Wally

Jecs - Just a Stupidly Fast ECS

A high-performance Entity Component System (ECS) for Roblox games.

Features

  • 🚀 Blazing Fast: Iterate over 800,000 entities at 60 frames per second
  • 🔗 Entity Relationships: First-class support for entity relationships
  • 🔒 Type Safety: Fully typed API for both Luau and TypeScript
  • 📦 Zero Dependencies: No external dependencies required
  • Optimized Storage: Cache-friendly archetype/SoA storage
  • Battle-tested: Rigorously unit tested for stability

Documentation

Quick Example

local world = jecs.World.new()
local pair = jecs.pair

-- Define components
local Position = world:component() :: jecs.Entity<Vector3>
local Velocity = world:component() :: jecs.Entity<Vector3>

-- Create an entity
local entity = world:entity()
world:set(entity, Position, Vector3.new(0, 0, 0))
world:set(entity, Velocity, Vector3.new(1, 0, 0))

-- Update system
for id, position, velocity in world:query(Position, Velocity) do
    world:set(id, Position, position + velocity)
end

Performance

Query Performance

21,000 entities, 125 archetypes, 4 random components queried: Queries

Insertion Performance

Inserting 8 components to an entity and updating them over 50 times: Insertions

Installation

Using Wally

[dependencies]
jecs = "ukendio/jecs@0.2.3"

Using npm (roblox-ts)

npm i @rbxts/jecs

Standalone

Download jecs.rbxm from our releases page.

Contributing

We welcome contributions! Please see our contribution guidelines for details.

Community & Support

License

Jecs is MIT licensed.