mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
A fast, portable Entity Component System for Luau.
https://ukendio.github.io/jecs/
data-orienteddata-oriented-designecsentity-component-systemgame-developmentgamedevjecslualuauno-dependencies
.github | ||
assets | ||
benches | ||
demo | ||
docs | ||
examples | ||
test | ||
thesis | ||
tools | ||
.gitignore | ||
.luaurc | ||
.prettierrc | ||
bench.project.json | ||
CHANGELOG.md | ||
default.project.json | ||
demo.rbxl | ||
jecs.d.ts | ||
jecs.luau | ||
LICENSE | ||
mirror.luau | ||
mkdocs.yml | ||
package-lock.json | ||
package.json | ||
README.md | ||
rokit.toml | ||
selene.toml | ||
stress.project.json | ||
stylua.toml | ||
testez.d.luau | ||
tsconfig.json | ||
wally.toml |
Jecs - Just a Stupidly Fast ECS
A high-performance Entity Component System (ECS) for Roblox games, supporting both Luau and TypeScript.
Features
- Blazing Fast: Iterate over hundreds of thousands of entities at 60 frames per second. Benchmark results are available in the documentation.
- Entity Relationships: First-class support for defining and querying relationships between entities.
- Type Safety: Fully typed API for both Luau and TypeScript, enhancing code maintainability and reducing errors.
- Zero Dependencies: No external dependencies required, simplifying integration into your project.
- Optimized Storage: Cache-friendly archetype/SoA (Structure of Arrays) storage for optimal performance.
- Battle-tested: Rigorously unit tested for stability and reliability.
- Comprehensive Documentation: Detailed documentation guides you through installation, usage, and advanced concepts.
Documentation
- Getting Started
- API Reference (Note: This link may need updating to reflect the actual location of the API docs if they are generated separately)
- Concepts
- Entities and Components
- Queries
- Relationships
- Component Traits
- Addons
- Examples
- FAQ
- Contributing
Quick Example (Luau)
local world = jecs.World.new()
local Position = world:component() :: jecs.Entity<Vector3>
local Velocity = world:component() :: jecs.Entity<Vector3>
local entity = world:entity()
world:set(entity, Position, Vector3.new(0, 0, 0))
world:set(entity, Velocity, Vector3.new(1, 0, 0))
-- Update system (example)
for id, position, velocity in world:query(Position, Velocity) do
world:set(id, Position, position + velocity)
end
Quick Example (TypeScript)
import { World } from "@rbxts/jecs";
const world = new World();
const Position = world.component<Vector3>();
const Velocity = world.component<Vector3>();
const entity = world.entity();
world.set(entity, Position, new Vector3(0, 0, 0));
world.set(entity, Velocity, new Vector3(1, 0, 0));
// Update system (example)
for (const [id, position, velocity] of world.query(Position, Velocity)) {
world.set(id, Position, position.add(velocity));
}
Performance
Benchmark results demonstrating Jecs' performance are available in the documentation. These include query and insertion performance tests.
Installation
Using Wally (Luau)
Add Jecs to your wally.toml
:
[dependencies]
jecs = "ukendio/jecs@0.2.3"
Then run:
wally install
Using npm (Roblox-ts)
npm install @rbxts/jecs
Standalone Installation
- Download
jecs.rbxm
from the releases page. - Import it into your Roblox project.
Contributing
We welcome contributions! Please see our contribution guidelines for details.
Community & Support
- Discord Community
- GitHub Issues
- API Documentation (Note: This link may need updating)
License
Jecs is MIT licensed.