This repository contains a collection of packages and a playground for the Dacite framework. Dacite is a modular and extensible framework for building games and simulations using an Entity-Component-System (ECS) architecture. Below is an overview of the packages and their purposes.
The core package provides the foundational components, systems, and utilities for building games using Dacite. It includes physics, rendering, input handling, and more.
- Entity-Component-System (ECS) integration.
- Physics systems using
planck. - Rendering with
pixi.js. - Tilemap and sprite management.
npm install @dacite/coreimport Engine, { Vector2, Transform, Rigidbody } from "@dacite/core";
const game = new Engine();
await game.init();
const player = game.ecs.entity("Player")
.set(new Transform(new Vector2(0, 0)))
.set(new Rigidbody());For more details, refer to the @dacite/core source code.
A standalone ECS library that powers the Dacite framework. It provides a flexible and efficient way to manage entities, components, and systems.
- Lightweight and modular ECS implementation.
- Query-based entity filtering.
- Support for custom systems and component sets.
npm install @dacite/ecsimport { Scope, EntitySystem, Query } from "@dacite/ecs";
const scope = new Scope();
class Position {
constructor(public x: number, public y: number) {}
}
const entity = scope.entity("Player").set(new Position(10, 20));
class MovementSystem extends EntitySystem {
query = new Query().has(Position);
onEntityUpdated(entity) {
const position = entity.get(Position);
position.x += 1;
position.y += 1;
}
}
scope.addSystem(new MovementSystem());
scope.update();For more details, refer to the @dacite/ecs README.
A Vue-based developer tool for inspecting and debugging ECS entities and components in real-time.
- Entity list and search.
- Component inspection and editing.
- Real-time updates.
npm install @dacite/ecs-inspectorimport createInspector from "@dacite/ecs-inspector";
import { Scope } from "@dacite/ecs";
const scope = new Scope();
createInspector({ scope });The inspector will appear as a sidebar in your application, allowing you to inspect and modify entities and components.
A playground application for testing and experimenting with the Dacite framework. It includes example entities, systems, and resources.
- Example player entity with animations and physics.
- Camera system with zoom and follow functionality.
- Heart system for collectible items.
- Player controller system for movement and jumping.
Run the playground locally:
npm run devThe playground demonstrates how to use the Dacite framework to create a simple game with a player, collectibles, and physics.
The repository is organized as a monorepo using the following structure:
dacite/
├── packages/
│ ├── core/ # Core package
│ ├── ecs/ # ECS library
│ ├── ecs-inspector/ # ECS Inspector
│ └── playground/ # Playground application
└── tsconfig.json # Shared TypeScript configuration
To build all packages:
npm run buildTo build a specific package:
cd packages/<package-name>
npm run buildTo start the playground:
cd packages/playground
npm run devThis project is licensed under the ISC License. See the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests to improve the Dacite framework.
Happy coding! 🎮