@jael-ecs/core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +33 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Jael (Just Another ECS Library)
4
4
 
5
- [![npm version](https://badge.fury.io/js/%40jael%2Fcore.svg)](https://badge.fury.io/js/%40jael%2Fcore)
5
+ [![npm version](https://badge.fury.io/js/@jael-ecs%2Fcore.svg)](https://badge.fury.io/js/@jael-ecs%2Fcore)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9+-blue.svg)](https://www.typescriptlang.org/)
8
8
 
@@ -32,18 +32,18 @@ _A modern, performant, and user-friendly Entity Component System library written
32
32
 
33
33
  - **User Friendly API** - Clean, fluent api that's easy to learn
34
34
  - **High Performance** - Optimized SparseSet implementation for fast entity lookups
35
- - **Minimal Bundle size** - Compact bundle size without dependencies.
35
+ - **Minimal Bundle size** - Compact bundle size without dependencies.(34kb 📦)
36
36
 
37
37
  ## Installation
38
38
 
39
39
  ```bash
40
- npm install @jael/core
40
+ npm install @jael-ecs/core
41
41
  ```
42
42
 
43
43
  ## Quick Start
44
44
 
45
45
  ```typescript
46
- import { World, System } from "@jael/core";
46
+ import { World, System } from "@jael-ecs/core";
47
47
 
48
48
  // Create your world
49
49
  const world = new World();
@@ -71,15 +71,15 @@ world.addComponent(enemy, "velocity", { dx: -1, dy: 0 });
71
71
  // Create a system
72
72
  const movementSystem: System = {
73
73
  priority: 0,
74
- update(dt) {
74
+ update() {
75
75
  const query = world.include("position", "velocity");
76
76
 
77
77
  for (const entity of query.entities) {
78
78
  const position = entity.get<Position>("position");
79
79
  const velocity = entity.get<Velocity>("velocity");
80
80
 
81
- position.x += velocity.dx * (dt || 0.016);
82
- position.y += velocity.dy * (dt || 0.016);
81
+ position.x += velocity.dx * (Time.delta || 0.016);
82
+ position.y += velocity.dy * (Time.delta || 0.016);
83
83
  }
84
84
  },
85
85
  };
@@ -88,8 +88,8 @@ const movementSystem: System = {
88
88
  world.addSystem(movementSystem);
89
89
 
90
90
  // Game loop
91
- function gameLoop(dt: number) {
92
- world.update(dt);
91
+ function gameLoop() {
92
+ world.update();
93
93
  }
94
94
  ```
95
95
 
@@ -199,8 +199,9 @@ Systems contain the game logic that processes entities with specific components.
199
199
  ```typescript
200
200
  interface System {
201
201
  priority: number; // Execution order (lower = earlier)
202
+ init?(): void // Runs when added to the world
202
203
  exit?(): void; // Cleanup when removed
203
- update(dt?: number): void; // Main update logic
204
+ update(): void; // Main update logic
204
205
  }
205
206
  ```
206
207
 
@@ -210,6 +211,10 @@ interface System {
210
211
  const renderSystem: System = {
211
212
  priority: 100, // Render after all other systems
212
213
 
214
+ init(){
215
+ console.log('This runs first')
216
+ }
217
+
213
218
  update(dt) {
214
219
  const renderableQuery = world.include("position", "sprite");
215
220
 
@@ -404,7 +409,23 @@ class MovementSystem implements System {
404
409
  this.movementQuery = world.include('position', 'velocity');
405
410
  }
406
411
 
407
- update(dt?: number) {
412
+ update() {
413
+ for (const entity of this.movementQuery.entities) {
414
+ // Process movement
415
+ }
416
+ }
417
+ }
418
+
419
+ // ✅ Also good: Use js Object:
420
+ const movementSystem: System = {
421
+ movementQuery: Query;
422
+ priority: number = 1;
423
+
424
+ init(){
425
+ this.movementQuery = world.include('position', 'velocity');
426
+ }
427
+
428
+ update(){
408
429
  for (const entity of this.movementQuery.entities) {
409
430
  // Process movement
410
431
  }
@@ -412,7 +433,7 @@ class MovementSystem implements System {
412
433
  }
413
434
 
414
435
  // ✅ Also good: Use world.include/exclude for simple cases
415
- update(dt?: number) {
436
+ update() {
416
437
  const entities = this.world.include('position', 'velocity');
417
438
  // ...
418
439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jael-ecs/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Entity Component System library with typescript",
5
5
  "keywords": [
6
6
  "ecs",