You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enum typed buffer and documentation improvements. (#90)
* bumped
* feat: add enum typed buffer, fix perftest deploy, update docs
Add a new "enum" typed buffer type that stores enumerated values
efficiently as Uint8Array indices instead of full JS values. Includes
backward-compatible deserialization of legacy array-serialized enum
buffers.
Fix the ECS performance test link by updating the GitHub Pages deploy
workflow to include dist/ in docs/ and restoring the README link.
Made-with: Cursor
* fix: bump script now enforces consistent versions across all packages
The old script ran `pnpm version patch` independently in each package,
so packages could drift out of sync. Now it bumps the root, captures
that version, and sets every child to the same value.
Made-with: Cursor
@@ -76,7 +76,7 @@ An `Observable<T>` is a subscription function that you can pass a callback funct
76
76
77
77
Your callback function *may* be called back synchronously (before the initial call returns) zero or one times and asynchronously later any number of times.
78
78
79
-
For more information see the [Observable API documentation](./docs/api/modules/observe.html)
79
+
For more information see the [Observable API documentation](https://adobe.github.io/data/)
80
80
81
81
### Observable Types
82
82
@@ -181,116 +181,33 @@ Contains some standard data type schemas in JSON Schema format for convenience.
181
181
182
182
## Entity Component System (ECS)
183
183
184
-
This ECS database is a highperformance, strongly typed typescript implementation inspired by the Sanders Mertens C++ based [Flecs](https://www.flecs.dev/flecs/md_docs_2Docs.html).
184
+
A high-performance, strongly typed ECS database for TypeScript, inspired by [Flecs](https://www.flecs.dev/flecs/md_docs_2Docs.html). All application state is modeled as composable plugins, and all mutations flow through observable, undoable transactions.
185
185
186
-
This library provides two main interfaces for ECS operations: **Store** and **Database**. They share the same read API but differ significantly in their approach to writing and observability.
187
-
188
-
### Store Interface
189
-
190
-
The **Store** is the foundational, low-level interface for direct ECS data operations.
191
-
192
-
**Key Characteristics:**
193
-
-**Direct Access**: Provides immediate, synchronous read/write access to entities, components, and resources
194
-
-**No Transaction Control**: Changes are applied directly without transaction boundaries
195
-
-**No Observability**: Changes are not automatically observable or trackable
196
-
-**High Performance**: Minimal overhead for direct operations using Structure of Arrays (SoA) with linear memory layout of numeric types for optimal cache performance
197
-
-**Core ECS Operations**: Includes entity creation, component updates, archetype querying, and resource management
198
-
199
-
**Usage**: Ideal for scenarios requiring fast, direct ECS manipulation where you don't need change tracking or transactional safety.
186
+
For a complete guide covering plugins, transactions, observability, composition, and transient/ephemeral semantics, see the **[ECS README](./packages/data/src/ecs/README.md)**.
200
187
201
188
```typescript
202
-
// Create a store with components, resources, and archetypes
203
-
const store =createStore(
204
-
{
205
-
position: Vec3.schema,
206
-
health: { type: "number" },
207
-
player: { const: true }
208
-
},
209
-
{
210
-
gravity: { default: 9.8asnumber }
211
-
},
212
-
{
213
-
Player: ["position", "health", "player"],
214
-
Particle: ["position"]
215
-
}
216
-
);
217
-
218
-
// Direct operations
219
-
const playerId =store.archetypes.Player.insert({
220
-
position: [0, 0, 0],
221
-
health: 100,
222
-
player: true
223
-
});
224
-
store.update(playerId, { position: [1, 1, 1] });
225
-
store.resources.gravity=10.0;
226
-
```
227
-
228
-
### Database Interface
229
-
230
-
The **Database** wraps a Store to provide **transaction-based operations** with **full observability**.
231
-
232
-
**Key Characteristics:**
233
-
-**Transaction-Based**: All changes must occur within predefined atomic transactions that can be undone.
234
-
-**Full Observability**: Every change is observable through the `observe` API
235
-
-**Predefined Operations**: Uses predefined transaction functions rather than direct mutations
-**Change Tracking**: Tracks which entities, components, and archetypes changed
238
-
-**Event Notifications**: Automatically notifies observers of changes
189
+
import { Database } from"@adobe/data/ecs";
239
190
240
-
**Usage**: Ideal for applications requiring change history, multiplayer synchronization, undo/redo functionality, or reactive UI updates.
241
-
242
-
**Important Note**: Even when using a Database, transaction functions are written as direct modifications to the underlying Store interface. The Database wraps these operations to provide transactional guarantees and observability.
In addition to the Entity, Component and System definitions which are standard, we also use the term Resource. A Resource is just a value which is defined globally on the ECS itself and not attached to any specific Entity. You can think of them as a singleton Component.
In addition to the standard Entity, Component, and System definitions, we also use the term **Resource** — a global singleton value defined on the ECS itself, not attached to any specific entity.
0 commit comments