Commit Graph

13 Commits

Author SHA1 Message Date
hypercross 365b2c4d13 fix: handle edge object in serialization tests
Add `typecheck` script to package.json, expand tsconfig include
paths to cover tests and examples, and update serialization tests
to correctly resolve player IDs from relationship edges.
2026-06-02 18:05:47 +08:00
hypercross cd6350e0b1 feat: add support for data-carrying relationships
Introduce the ability to attach optional data payloads to
relationships. This includes:

- Updating `defineRelationship` to accept default values.
- Adding `getRelData` and `setRelData` to the `World` class.
- Allowing `relate` to accept an optional data override.
- Updating serialization to include relationship data in snapshots.
- Implementing lazy storage for relationship data using `SparseSet`.
2026-06-02 17:56:12 +08:00
hypercross 5d125167cc refactor: make getRelatedTo return an iterator
Convert `getRelatedTo` from returning an array to returning an
`IterableIterator`. This improves memory efficiency by yielding
entities lazily instead of allocating a new array on every call.
2026-06-02 06:39:07 +08:00
hypercross 3620e80807 feat(bt): add repeat and selector task kinds 2026-06-01 22:57:14 +08:00
hypercross 4e37e03d3f feat: add behavior tree implementation
Introduces a `TaskRunner` for executing behavior trees within the
ECS world. Supports leaf, sequential, parallel, and random task
kinds, along with status propagation (succeeded, failed, cancelled).
2026-06-01 22:52:10 +08:00
hypercross 9e788b135b feat: add CommandQueue for pull-based command processing
Introduces a `CommandQueue` to handle command components. It allows
registering handlers that are executed when `execute()` is called,
automatically removing the command component and cleaning up empty
entities. Includes an interruption mechanism to pause processing
during asynchronous operations.
2026-06-01 14:20:56 +08:00
hypercross 87c01858e7 test: add missing types to serialization tests 2026-05-31 16:36:25 +08:00
hypercross 05674a349f refactor: improve type safety in World and tests
Replace `any` types with specific interfaces like `WorldEvent`,
`QueryUpdate`, and `Entity` to strengthen type checking. This includes
refining the deserialization logic in `World.fromSnapshot` to use
properly typed component definitions.
2026-05-31 16:24:59 +08:00
hypercross 9953c7c556 test: expand serialization test coverage 2026-05-31 16:13:01 +08:00
hypercross 1c55485f9f feat: add world serialization support
Introduce `toJSON` and `fromJSON` methods to the `World` class to
allow saving and restoring world states. This requires components and
relationships to have human-readable names for stable serialization.
2026-05-31 16:10:19 +08:00
hypercross d0bb119911 feat: implement relationship system 2026-05-31 15:54:29 +08:00
hypercross ba4a688f57 test: add vitest and implement unit tests 2026-05-31 15:47:19 +08:00
hypercross 4ede2d7f3b feat: implement core ECS engine with RxJS observability
Initial implementation of an Entity-Component-System (ECS) featuring:
- Sparse set-based component storage for efficient access.
- Entity lifecycle management with generation-based recycling.
- Reactive query system using RxJS for change tracking.
- Batched event flushing to support frame-based updates.
- Type-safe component definitions via TypeScript inference.
2026-05-31 15:45:20 +08:00